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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19057 ) Change subject: Always log context (interface/line/timeslot) when available ...................................................................... Always log context (interface/line/timeslot) when available We always want to know as much context as possible. Which exact timeslot on which line of which interface ha logged something? Change-Id: I3d8909b396928ed3c023b8ac47fa9ec72c99e681 --- M src/intf_line.c M src/log.h M src/usb.c 3 files changed, 21 insertions(+), 12 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved tnt: Looks good to me, but someone else must approve diff --git a/src/intf_line.c b/src/intf_line.c index 7b85b4c..305f5dd 100644 --- a/src/intf_line.c +++ b/src/intf_line.c @@ -143,13 +143,13 @@ if (rv > 0) { int bytes_to_write = rv; - LOGP(DXFR, LOGL_DEBUG, "RX Message: %d %d [ %s]\n", - ts->id, rv, osmo_hexdump(ts->rx_buf, rv)); + LOGPTS(ts, DXFR, LOGL_DEBUG, "RX Message: %d [ %s]\n", + rv, osmo_hexdump(ts->rx_buf, rv)); rv = write(ts->fd, ts->rx_buf, bytes_to_write); if (rv < 0) return rv; } else if (rv < 0 && ts->id == 4) { - LOGP(DXFR, LOGL_ERROR, "ERR RX: %d %d %d [ %s]\n", + LOGPTS(ts, DXFR, LOGL_ERROR, "ERR RX: %d %d %d [ %s]\n", rv,oi,cl, osmo_hexdump(buf, len)); } @@ -171,8 +171,8 @@ if (!ts->tx_len) { rv = read(ts->fd, ts->tx_buf, sizeof(ts->tx_buf)); if (rv > 0) { - LOGP(DXFR, LOGL_DEBUG, "TX Message: %d %d [ %s]\n", - ts->id, rv, osmo_hexdump(ts->tx_buf, rv)); + LOGPTS(ts, DXFR, LOGL_DEBUG, "TX Message: %d [ %s]\n", + rv, osmo_hexdump(ts->tx_buf, rv)); ts->tx_len = rv; ts->tx_ofs = 0; } else if (rv < 0) @@ -186,10 +186,10 @@ ); if (rv < 0) - LOGP(DXFR, LOGL_ERROR, "ERR TX: %d\n", rv); + LOGPTS(ts, DXFR, LOGL_ERROR, "ERR TX: %d\n", rv); if (ts->tx_ofs < ts->tx_len) { - LOGP(DXFR, LOGL_DEBUG, "TX chunk %d/%d %d [ %s]\n", + LOGPTS(ts, DXFR, LOGL_DEBUG, "TX chunk %d/%d %d [ %s]\n", ts->tx_ofs, ts->tx_len, cl, osmo_hexdump(&buf[ts->tx_ofs], rv)); } @@ -269,7 +269,7 @@ int ftr; if (size <= 0) { - LOGP(DXFR, LOGL_ERROR, "IN ERROR: %d\n", size); + LOGPLI(line, DXFR, LOGL_ERROR, "IN ERROR: %d\n", size); return -1; } diff --git a/src/log.h b/src/log.h index 2a9b210..d46a5a7 100644 --- a/src/log.h +++ b/src/log.h @@ -31,4 +31,13 @@ DXFR, }; +#define LOGPIF(itf, ss, lvl, fmt, args...) \ + LOGP(ss, lvl, "(I%u) " fmt, (itf)->id, ## args) + +#define LOGPLI(li, ss, lvl, fmt, args...) \ + LOGP(ss, lvl, "(I%u:L%u) " fmt, (li)->intf->id, (li)->id, ## args) + +#define LOGPTS(ts, ss, lvl, fmt, args...) \ + LOGP(ss, lvl, "(I%u:L%u:T%u) " fmt, (ts)->line->intf->id, (ts)->line->id, (ts)->id, ## args) + extern const struct log_info log_info; diff --git a/src/usb.c b/src/usb.c index 5d38d32..578bc34 100644 --- a/src/usb.c +++ b/src/usb.c @@ -118,7 +118,7 @@ int fts; if (size <= 0) { - LOGP(DXFR, LOGL_ERROR, "OUT ERROR: %d\n", size); + LOGPLI(line, DXFR, LOGL_ERROR, "OUT ERROR: %d\n", size); return -1; } @@ -144,10 +144,10 @@ struct e1_usb_line_data *ld = (struct e1_usb_line_data *) flow->line->drv_data; if (size < 0) { - LOGP(DE1D, LOGL_ERROR, "Feedback transfer error\n"); + LOGPLI(flow->line, DE1D, LOGL_ERROR, "Feedback transfer error\n"); return 0; } else if (size != 3) { - LOGP(DE1D, LOGL_ERROR, "Feedback packet invalid size (%d)\n", size); + LOGPLI(flow->line, DE1D, LOGL_ERROR, "Feedback packet invalid size (%d)\n", size); return 0; } @@ -193,7 +193,7 @@ rv = libusb_submit_transfer(xfr); if (rv) - LOGP(DE1D, LOGL_ERROR, "Failed to resubmit buffer for transfer\n"); + LOGPLI(flow->line, DE1D, LOGL_ERROR, "Failed to resubmit buffer for transfer\n"); } static struct e1_usb_flow * -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/19057 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I3d8909b396928ed3c023b8ac47fa9ec72c99e681 Gerrit-Change-Number: 19057 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-Assignee: tnt <tnt at 246tNt.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: tnt <tnt at 246tNt.com> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200630/7e5679b0/attachment.htm>