move from printf() debug output to libosmocore logging

Change-Id: I6b652554c472c0fa7d180b533ef1ed4b92b49ab9
This commit is contained in:
Harald Welte 2020-06-28 15:14:05 +02:00
parent 7f08470706
commit 946eaba82b
4 changed files with 19 additions and 8 deletions

View File

@ -107,10 +107,12 @@ _e1_rx_hdlcfs(struct e1_ts *ts, uint8_t *buf, int len)
);
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 @@ _e1_tx_hdlcfs(struct e1_ts *ts, uint8_t *buf, int len)
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 @@ _e1_tx_hdlcfs(struct e1_ts *ts, uint8_t *buf, int len)
);
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;
@ -218,7 +223,7 @@ e1_line_demux_in(struct e1_line *line, const uint8_t *buf, int size)
int ftr;
if (size <= 0) {
printf("IN ERROR: %d\n", size);
LOGP(DXFR, LOGL_ERROR, "IN ERROR: %d\n", size);
return -1;
}

View File

@ -33,6 +33,11 @@ static const struct log_info_cat default_categories[] = {
.loglevel = LOGL_DEBUG,
.enabled = 1,
},
[DXFR] = {
.name = "DXFR",
.loglevel = LOGL_DEBUG,
.enabled = 1,
},
};
const struct log_info log_info = {

View File

@ -28,6 +28,7 @@
enum {
DE1D,
DXFR,
};
extern const struct log_info log_info;

View File

@ -118,7 +118,7 @@ e1_usb_xfer_out(struct e1_usb_flow *flow, uint8_t *buf, int size)
int fts;
if (size <= 0) {
printf("OUT ERROR: %d\n", size);
LOGP(DXFR, LOGL_ERROR, "OUT ERROR: %d\n", size);
return -1;
}