Change in osmo-mgw[master]: mgcp_client: logging tweaks

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Dec 19 22:47:53 UTC 2018


Neels Hofmeyr has submitted this change and it was merged. ( https://gerrit.osmocom.org/12270 )

Change subject: mgcp_client: logging tweaks
......................................................................

mgcp_client: logging tweaks

Fix typos, use osmo_sock_get_name2() to show the tx source and target IP:port,
shorten some wording.

Depends: I8ad89ac447c9c582742e70d082072bdd40a5a398 (libosmocore)
Change-Id: Iae728192f499330d16836d9435648f6b8ed213b6
---
M src/libosmo-mgcp-client/mgcp_client.c
1 file changed, 12 insertions(+), 12 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index 2ceab3c..8fa82cd 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -651,11 +651,13 @@
 
 	ret = read(fd->fd, msg->data, 4096 - 128);
 	if (ret <= 0) {
-		LOGP(DLMGCP, LOGL_ERROR, "Failed to read: %d/%s\n", errno, strerror(errno));
+		LOGP(DLMGCP, LOGL_ERROR, "Failed to read: %s: %d='%s'\n", osmo_sock_get_name2(fd->fd),
+		     errno, strerror(errno));
+
 		msgb_free(msg);
 		return -1;
 	} else if (ret > 4096 - 128) {
-		LOGP(DLMGCP, LOGL_ERROR, "Too much data: %d\n", ret);
+		LOGP(DLMGCP, LOGL_ERROR, "Too much data: %s: %d\n", osmo_sock_get_name2(fd->fd), ret);
 		msgb_free(msg);
 		return -1;
 	}
@@ -670,13 +672,13 @@
 {
 	int ret;
 
-	LOGP(DLMGCP, LOGL_DEBUG, "Sending msg to MGCP GW size: len=%u '%s'...\n",
-	     msg->len, osmo_escape_str((const char*)msg->data, OSMO_MIN(42, msg->len)));
+	LOGP(DLMGCP, LOGL_DEBUG, "Tx MGCP: %s: len=%u '%s'...\n",
+	     osmo_sock_get_name2(fd->fd), msg->len, osmo_escape_str((const char*)msg->data, OSMO_MIN(42, msg->len)));
 
 	ret = write(fd->fd, msg->data, msg->len);
 	if (ret != msg->len)
-		LOGP(DLMGCP, LOGL_ERROR, "Failed to Tx MGCP: %d='%s'; msg: len=%u '%s'...\n",
-		     errno, strerror(errno),
+		LOGP(DLMGCP, LOGL_ERROR, "Failed to Tx MGCP: %s: %d='%s'; msg: len=%u '%s'...\n",
+		     osmo_sock_get_name2(fd->fd), errno, strerror(errno),
 		     msg->len, osmo_escape_str((const char*)msg->data, OSMO_MIN(42, msg->len)));
 	return ret;
 }
@@ -733,12 +735,12 @@
 
 		/* Choose a new port number to try next */
 		LOGP(DLMGCP, LOGL_NOTICE,
-		     "MGCPGW faild to bind to port %u, retrying with port %u -- check configuration!\n",
-		     mgcp->actual.local_port, mgcp->actual.local_port + 1);
+		     "MGCPGW failed to bind to %s:%u, retrying with port %u\n",
+		     mgcp->actual.local_addr, mgcp->actual.local_port, mgcp->actual.local_port + 1);
 		mgcp->actual.local_port++;
 	}
 
-	LOGP(DLMGCP, LOGL_FATAL, "MGCPGW faild to find a port to bind on %i times.\n", i);
+	LOGP(DLMGCP, LOGL_FATAL, "MGCPGW failed to find a port to bind on %i times.\n", i);
 	return -EINVAL;
 }
 
@@ -776,9 +778,7 @@
 	wq->read_cb = mgcp_do_read;
 	wq->write_cb = mgcp_do_write;
 
-	LOGP(DLMGCP, LOGL_INFO, "MGCP GW connection: %s:%u -> %s:%u\n",
-	     mgcp->actual.local_addr, mgcp->actual.local_port,
-	     mgcp->actual.remote_addr, mgcp->actual.remote_port);
+	LOGP(DLMGCP, LOGL_INFO, "MGCP GW connection: %s\n", osmo_sock_get_name2(wq->bfd.fd));
 
 	return 0;
 error_close_fd:

-- 
To view, visit https://gerrit.osmocom.org/12270
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iae728192f499330d16836d9435648f6b8ed213b6
Gerrit-Change-Number: 12270
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181219/f945ece9/attachment.htm>


More information about the gerrit-log mailing list