[MERGED] openbsc[master]: gsup client, gsup_test_client: move logging to DLGSUP category

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Dec 13 14:54:06 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: gsup client, gsup_test_client: move logging to DLGSUP category
......................................................................


gsup client, gsup_test_client: move logging to DLGSUP category

Use the DLGSUP logging category for GSUP.

Bump the required version of libosmocore to 0.9.5 to benefit from the DLGSUP
logging category fix in core/logging.[hc].
(Id974c7be158e4d60421a98110f5c807aefd31119)

Todo: we're using a "Library" logging category, which is not really what the
library category was intended for. Instead, the GSUP client should probably be
given a logging category like DVLR or DGPRS in its initialization API.

Related: OS#1592
Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee
---
M openbsc/configure.ac
M openbsc/src/gprs/gprs_gsup_client.c
M openbsc/src/gprs/gsup_test_client.c
3 files changed, 20 insertions(+), 25 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/openbsc/configure.ac b/openbsc/configure.ac
index 123048f..4fe1050 100644
--- a/openbsc/configure.ac
+++ b/openbsc/configure.ac
@@ -30,7 +30,7 @@
 AC_SUBST(LIBRARY_DL)
 
 
-PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.4)
+PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5)
 PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
 PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
 PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.4)
diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c
index 6195fa6..b991563 100644
--- a/openbsc/src/gprs/gprs_gsup_client.c
+++ b/openbsc/src/gprs/gprs_gsup_client.c
@@ -55,29 +55,29 @@
 		return 0;
 
 	if (osmo_timer_pending(&gsupc->connect_timer)) {
-		LOGP(DLINP, LOGL_DEBUG,
+		LOGP(DLGSUP, LOGL_DEBUG,
 		     "GSUP connect: connect timer already running\n");
 		osmo_timer_del(&gsupc->connect_timer);
 	}
 
 	if (osmo_timer_pending(&gsupc->ping_timer)) {
-		LOGP(DLINP, LOGL_DEBUG,
+		LOGP(DLGSUP, LOGL_DEBUG,
 		     "GSUP connect: ping timer already running\n");
 		osmo_timer_del(&gsupc->ping_timer);
 	}
 
 	if (ipa_client_conn_clear_queue(gsupc->link) > 0)
-		LOGP(DLINP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n");
+		LOGP(DLGSUP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n");
 
 	rc = ipa_client_conn_open(gsupc->link);
 
 	if (rc >= 0) {
-		LOGP(DGPRS, LOGL_INFO, "GSUP connecting to %s:%d\n",
+		LOGP(DLGSUP, LOGL_INFO, "GSUP connecting to %s:%d\n",
 		     gsupc->link->addr, gsupc->link->port);
 		return 0;
 	}
 
-	LOGP(DGPRS, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n",
+	LOGP(DLGSUP, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n",
 	     gsupc->link->addr, gsupc->link->port, strerror(-rc));
 
 	if (rc == -EBADF || rc == -ENOTSOCK || rc == -EAFNOSUPPORT ||
@@ -87,7 +87,7 @@
 	osmo_timer_schedule(&gsupc->connect_timer,
 			    GSUP_CLIENT_RECONNECT_INTERVAL, 0);
 
-	LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n",
+	LOGP(DLGSUP, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n",
 	     gsupc->link->addr, gsupc->link->port);
 
 	return 0;
@@ -119,7 +119,7 @@
 	rc = oap_register(&gsupc->oap_state, &msg_tx);
 
 	if ((rc < 0) || (!msg_tx)) {
-		LOGP(DGPRS, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n");
+		LOGP(DLGSUP, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n");
 		return;
 	}
 
@@ -130,7 +130,7 @@
 {
 	struct gsup_client *gsupc = link->data;
 
-	LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n",
+	LOGP(DLGSUP, LOGL_INFO, "GSUP link to %s:%d %s\n",
 		     link->addr, link->port, up ? "UP" : "DOWN");
 
 	gsupc->is_connected = up;
@@ -181,7 +181,7 @@
 	rc = ipaccess_bts_handle_ccm(link, &ipa_dev, msg);
 
 	if (rc < 0) {
-		LOGP(DGPRS, LOGL_NOTICE,
+		LOGP(DLGSUP, LOGL_NOTICE,
 		     "GSUP received an invalid IPA/CCM message from %s:%d\n",
 		     link->addr, link->port);
 		/* Link has been closed */
@@ -194,7 +194,7 @@
 		uint8_t msg_type = *(msg->l2h);
 		/* CCM message */
 		if (msg_type == IPAC_MSGT_PONG) {
-			LOGP(DGPRS, LOGL_DEBUG, "GSUP receiving PONG\n");
+			LOGP(DLGSUP, LOGL_DEBUG, "GSUP receiving PONG\n");
 			gsupc->got_ipa_pong = 1;
 		}
 
@@ -223,7 +223,7 @@
 	return 0;
 
 invalid:
-	LOGP(DGPRS, LOGL_NOTICE,
+	LOGP(DLGSUP, LOGL_NOTICE,
 	     "GSUP received an invalid IPA message from %s:%d, size = %d\n",
 	     link->addr, link->port, msgb_length(msg));
 
@@ -235,7 +235,7 @@
 {
 	struct gsup_client *gsupc = gsupc_;
 
-	LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n",
+	LOGP(DLGSUP, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n",
 	     gsupc->is_connected ? "connected" : "not connected",
 	     gsupc->got_ipa_pong ? "got" : "didn't get");
 
@@ -244,7 +244,7 @@
 		return;
 	}
 
-	LOGP(DGPRS, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n");
+	LOGP(DLGSUP, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n");
 	ipa_client_conn_close(gsupc->link);
 	gsupc->is_connected = 0;
 
@@ -258,7 +258,7 @@
 
 	gsupc->got_ipa_pong = 0;
 	osmo_timer_schedule(&gsupc->ping_timer, GSUP_CLIENT_PING_INTERVAL, 0);
-	LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n");
+	LOGP(DLGSUP, LOGL_DEBUG, "GSUP sending PING\n");
 	gsup_client_send_ping(gsupc);
 }
 
diff --git a/openbsc/src/gprs/gsup_test_client.c b/openbsc/src/gprs/gsup_test_client.c
index c8ed03d..1889c6f 100644
--- a/openbsc/src/gprs/gsup_test_client.c
+++ b/openbsc/src/gprs/gsup_test_client.c
@@ -260,17 +260,12 @@
 void *tall_bsc_ctx = NULL;
 
 /* default categories */
-static struct log_info_cat gprs_categories[] = {
-	[DGPRS] = {
-		.name = "DGPRS",
-		.description = "GPRS Packet Service",
-		.enabled = 1, .loglevel = LOGL_INFO,
-	},
+static struct log_info_cat default_categories[] = {
 };
 
-static const struct log_info gprs_log_info = {
-	.cat = gprs_categories,
-	.num_cat = ARRAY_SIZE(gprs_categories),
+static const struct log_info gsup_test_client_log_info = {
+	.cat = default_categories,
+	.num_cat = ARRAY_SIZE(default_categories),
 };
 
 int main(int argc, char **argv)
@@ -279,7 +274,7 @@
 	char *server_host = "127.0.0.1";
 	uint16_t server_port = 2222;
 
-	osmo_init_logging(&gprs_log_info);
+	osmo_init_logging(&gsup_test_client_log_info);
 
 	g_gc = gsup_client_create(server_host, server_port, gsupc_read_cb,
 				       NULL);

-- 
To view, visit https://gerrit.osmocom.org/1386
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id3938267fa062e1a997d3704cd678874306f86ee
Gerrit-PatchSet: 4
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list