pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/38885?usp=email )
Change subject: ctrl: logging improvements ......................................................................
ctrl: logging improvements
Change-Id: Id555fe0dc27e49af3c931ffb33124a15784ccfb3 --- M src/ctrl/control_cmd.c M src/ctrl/control_if.c 2 files changed, 8 insertions(+), 6 deletions(-)
Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve
diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index db20551..b630620 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -425,7 +425,7 @@ osmo_escape_str(var, -1)); goto err; } - LOGP(DLCTRL, LOGL_DEBUG, "Command: GET %s\n", cmd->variable); + LOGP(DLCTRL, LOGL_DEBUG, "Command: GET %s %s\n", cmd->id, cmd->variable); break; case CTRL_TYPE_SET: var = strtok_r(NULL, " ", &saveptr); @@ -457,7 +457,7 @@ goto err; }
- LOGP(DLCTRL, LOGL_DEBUG, "Command: SET %s = "%s"\n", cmd->variable, + LOGP(DLCTRL, LOGL_DEBUG, "Command: SET %s %s = "%s"\n", cmd->id, cmd->variable, osmo_escape_str(cmd->value, -1)); break; #define REPLY_CASE(TYPE, NAME) \ @@ -481,11 +481,11 @@ cmd->reply = talloc_strdup(cmd, val); \ if (!cmd->variable || !cmd->reply) \ goto oom; \ - LOGP(DLCTRL, LOGL_DEBUG, "Command: " NAME " %s: %s\n", cmd->variable, \ + LOGP(DLCTRL, LOGL_DEBUG, "Command: " NAME " %s %s: %s\n", cmd->id, cmd->variable, \ osmo_escape_str(cmd->reply, -1)); \ break - REPLY_CASE(CTRL_TYPE_GET_REPLY, "GET REPLY"); - REPLY_CASE(CTRL_TYPE_SET_REPLY, "SET REPLY"); + REPLY_CASE(CTRL_TYPE_GET_REPLY, "GET_REPLY"); + REPLY_CASE(CTRL_TYPE_SET_REPLY, "SET_REPLY"); REPLY_CASE(CTRL_TYPE_TRAP, "TRAP"); #undef REPLY_CASE case CTRL_TYPE_ERROR: diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index c265c3a..83148c3 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -445,10 +445,10 @@
if (!cmd) { /* should never happen */ + LOGP(DLCTRL, LOGL_ERROR, "Command parser error: %s\n", msgb_hexdump(msg)); cmd = talloc_zero(ccon, struct ctrl_cmd); if (!cmd) return -ENOMEM; - LOGP(DLCTRL, LOGL_ERROR, "Command parser error.\n"); cmd->type = CTRL_TYPE_ERROR; cmd->id = "err"; cmd->reply = "Command parser error."; @@ -474,6 +474,8 @@
send_reply: /* There is a reply or error that should be reported back to the sender. */ + LOGP(DLCTRL, LOGL_DEBUG, "Tx Command reply: %s %s %s %s\n", + get_value_string(ctrl_type_vals, cmd->type), cmd->id, cmd->variable, cmd->reply); ctrl_cmd_send2(ccon, cmd); just_free: talloc_free(cmd);