Neels Hofmeyr has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/70/12270/1

diff --git a/src/libosmo-mgcp-client/mgcp_client.c 
b/src/libosmo-mgcp-client/mgcp_client.c
index fc9c5d3..f5eee95 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -717,11 +717,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;
        }
@@ -736,13 +738,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;
 }
@@ -803,12 +805,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;
 }

@@ -846,9 +848,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: newchange
Gerrit-Change-Id: Iae728192f499330d16836d9435648f6b8ed213b6
Gerrit-Change-Number: 12270
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to