From cb99991127826e97fe455d548960a81b45c096c3 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 27 Jul 2022 20:40:56 +0200 Subject: [PATCH] Introduce logging category smscb The smscb_message_fsm is totally independent of CBSP. Change-Id: I6e686747ddde9540ff3f765ef461bfca812615ba --- doc/examples/osmo-cbc/osmo-cbc.cfg | 1 + include/osmocom/cbc/debug.h | 1 + src/cbc_main.c | 7 +++++++ src/smscb_message_fsm.c | 8 ++++---- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/examples/osmo-cbc/osmo-cbc.cfg b/doc/examples/osmo-cbc/osmo-cbc.cfg index 7f5ebdc..9874a39 100644 --- a/doc/examples/osmo-cbc/osmo-cbc.cfg +++ b/doc/examples/osmo-cbc/osmo-cbc.cfg @@ -1,5 +1,6 @@ log stderr logging level main notice + logging level smscb notice logging level cbsp notice logging level sbcap notice logging level asn1c notice diff --git a/include/osmocom/cbc/debug.h b/include/osmocom/cbc/debug.h index c0b3864..e07cfdd 100644 --- a/include/osmocom/cbc/debug.h +++ b/include/osmocom/cbc/debug.h @@ -2,6 +2,7 @@ enum { DMAIN, + DSMSCB, DCBSP, DSBcAP, DASN1C, diff --git a/src/cbc_main.c b/src/cbc_main.c index 5096dc8..7e13e52 100644 --- a/src/cbc_main.c +++ b/src/cbc_main.c @@ -62,6 +62,13 @@ static const struct log_info_cat log_info_cat[] = { .enabled = 1, .loglevel = LOGL_NOTICE, }, + [DSMSCB] = { + .name = "DSMSCB", + .description = "SMS Cell Broadcast handling", + .color = "\033[1;35m", + .enabled = 1, + .loglevel = LOGL_NOTICE, + }, [DCBSP] = { .name = "DCBSP", .description = "Cell Broadcast Service Protocol (CBC-BSC)", diff --git a/src/smscb_message_fsm.c b/src/smscb_message_fsm.c index ba17910..40d4535 100644 --- a/src/smscb_message_fsm.c +++ b/src/smscb_message_fsm.c @@ -335,7 +335,7 @@ static struct osmo_fsm smscb_fsm = { .allstate_event_mask = S(SMSCB_E_CHILD_DIED), .allstate_action = smscb_fsm_allstate, .timer_cb = smscb_fsm_timer_cb, - .log_subsys = DCBSP, + .log_subsys = DSMSCB, .event_names = smscb_fsm_event_names, .cleanup= smscb_fsm_cleanup, }; @@ -349,7 +349,7 @@ struct cbc_message *cbc_message_alloc(void *ctx, const struct cbc_message *orig_ char idbuf[32]; if (cbc_message_by_id(orig_msg->msg.message_id)) { - LOGP(DCBSP, LOGL_ERROR, "Cannot create message_id %u (already exists)\n", + LOGP(DSMSCB, LOGL_ERROR, "Cannot create message_id %u (already exists)\n", orig_msg->msg.message_id); return NULL; } @@ -357,13 +357,13 @@ struct cbc_message *cbc_message_alloc(void *ctx, const struct cbc_message *orig_ snprintf(idbuf, sizeof(idbuf), "%s-%u", orig_msg->cbe_name, orig_msg->msg.message_id); fi = osmo_fsm_inst_alloc(&smscb_fsm, ctx, NULL, LOGL_INFO, idbuf); if (!fi) { - LOGP(DCBSP, LOGL_ERROR, "Cannot allocate cbc_message fsm\n"); + LOGP(DSMSCB, LOGL_ERROR, "Cannot allocate cbc_message fsm\n"); return NULL; } smscb = talloc(fi, struct cbc_message); if (!smscb) { - LOGP(DCBSP, LOGL_ERROR, "Cannot allocate cbc_message\n"); + LOGP(DSMSCB, LOGL_ERROR, "Cannot allocate cbc_message\n"); osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL); return NULL; }