Change in osmo-e1d[master]: move from printf() debug output to libosmocore logging

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.org
Sun Jun 28 16:29:47 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19034 )


Change subject: move from printf() debug output to libosmocore logging
......................................................................

move from printf() debug output to libosmocore logging

Change-Id: I6b652554c472c0fa7d180b533ef1ed4b92b49ab9
---
M src/intf_line.c
M src/log.c
M src/log.h
M src/usb.c
4 files changed, 19 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/34/19034/1

diff --git a/src/intf_line.c b/src/intf_line.c
index 87cc22a..a2a623a 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -107,10 +107,12 @@
 		);
 
 		if (rv > 0) {
-			printf("RX Message: %d %d [ %s]\n", ts->id, rv, osmo_hexdump(ts->rx_buf, rv));
+			LOGP(DXFR, LOGL_DEBUG, "RX Message: %d %d [ %s]\n",
+				ts->id, rv, osmo_hexdump(ts->rx_buf, rv));
 			write(ts->fd, ts->rx_buf, rv);
 		} else  if (rv < 0 && ts->id == 4) {
-			printf("ERR RX: %d %d %d [ %s]\n",rv,oi,cl, osmo_hexdump(buf, len));
+			LOGP(DXFR, LOGL_ERROR, "ERR RX: %d %d %d [ %s]\n",
+				rv,oi,cl, osmo_hexdump(buf, len));
 		}
 
 		oi += cl;
@@ -131,7 +133,8 @@
 		if (!ts->tx_len) {
 			rv = read(ts->fd, ts->tx_buf, sizeof(ts->tx_buf));
 			if (rv > 0) {
-				printf("TX Message: %d %d [ %s]\n", ts->id, rv, osmo_hexdump(ts->tx_buf, rv));
+				LOGP(DXFR, LOGL_DEBUG, "TX Message: %d %d [ %s]\n",
+					ts->id, rv, osmo_hexdump(ts->tx_buf, rv));
 				ts->tx_len = rv; 
 				ts->tx_ofs = 0;
 			}
@@ -144,10 +147,12 @@
 		);
 
 		if (rv < 0)
-			printf("ERR TX: %d\n", rv);
+			LOGP(DXFR, LOGL_ERROR, "ERR TX: %d\n", rv);
 
-		if (ts->tx_ofs < ts->tx_len)
-			printf("TX chunk %d/%d %d [ %s]\n", ts->tx_ofs, ts->tx_len, cl, osmo_hexdump(&buf[ts->tx_ofs], rv));
+		if (ts->tx_ofs < ts->tx_len) {
+			LOGP(DXFR, LOGL_DEBUG, "TX chunk %d/%d %d [ %s]\n",
+				ts->tx_ofs, ts->tx_len, cl, osmo_hexdump(&buf[ts->tx_ofs], rv));
+		}
 
 		if (rv > 0)
 			oo += rv;
diff --git a/src/log.c b/src/log.c
index 805d355..c50efe5 100644
--- a/src/log.c
+++ b/src/log.c
@@ -33,6 +33,11 @@
 		.loglevel = LOGL_DEBUG,
 		.enabled = 1,
 	},
+	[DXFR] = {
+		.name = "DXFR",
+		.loglevel = LOGL_DEBUG,
+		.enabled = 1,
+	},
 };
 
 const struct log_info log_info = {
diff --git a/src/log.h b/src/log.h
index b3bed47..2a9b210 100644
--- a/src/log.h
+++ b/src/log.h
@@ -28,6 +28,7 @@
 
 enum {
 	DE1D,
+	DXFR,
 };
 
 extern const struct log_info log_info;
diff --git a/src/usb.c b/src/usb.c
index c7b8f13..f35f548 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -111,7 +111,7 @@
 	int ftr;
 
 	if (size <= 0) {
-		printf("IN ERROR: %d\n", size);
+		LOGP(DXFR, LOGL_ERROR, "IN ERROR: %d\n", size);
 		return -1;
 	}
 
@@ -151,7 +151,7 @@
 	int fts, tsz;
 
 	if (size <= 0) {
-		printf("OUT ERROR: %d\n", size);
+		LOGP(DXFR, LOGL_ERROR, "OUT ERROR: %d\n", size);
 		return -1;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/19034
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I6b652554c472c0fa7d180b533ef1ed4b92b49ab9
Gerrit-Change-Number: 19034
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200628/675fc84b/attachment.htm>


More information about the gerrit-log mailing list