Change in osmo-trx[master]: Make logging category DLMS generic and reusable for other backends

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/.

pespin gerrit-no-reply at lists.osmocom.org
Thu Jan 2 15:56:06 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/16698 )


Change subject: Make logging category DLMS generic and reusable for other backends
......................................................................

Make logging category DLMS generic and reusable for other backends

Make sure old configs using "logging level lms <level>" are still accepted.
Initialization order of VTY componenets need to be resorted since newly
introduced command requires logging VTY node to be already setup
beforehand.

Change-Id: Ia195a74a62a8a3dd6267fb1359acaa5628208d8e
---
M CommonLibs/debug.c
M CommonLibs/debug.h
M CommonLibs/trx_vty.c
M Transceiver52M/device/lms/LMSDevice.cpp
M Transceiver52M/osmo-trx.cpp
5 files changed, 20 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/98/16698/1

diff --git a/CommonLibs/debug.c b/CommonLibs/debug.c
index cc5be44..c227435 100644
--- a/CommonLibs/debug.c
+++ b/CommonLibs/debug.c
@@ -65,9 +65,9 @@
 		.color = NULL,
 		.enabled = 1, .loglevel = LOGL_INFO,
 	},
-	[DLMS] = {
-		.name = "DLMS",
-		.description = "Logging from within LimeSuite itself",
+	[DDEVDRV] = {
+		.name = "DDEVDRV",
+		.description = "Logging from external device driver library implementing lower level specifics",
 		.color = NULL,
 		.enabled = 1, .loglevel = LOGL_NOTICE,
 	},
diff --git a/CommonLibs/debug.h b/CommonLibs/debug.h
index 3837329..0dca2ee 100644
--- a/CommonLibs/debug.h
+++ b/CommonLibs/debug.h
@@ -15,7 +15,7 @@
 	DTRXDDL,
 	DTRXDUL,
 	DDEV,
-	DLMS,
+	DDEVDRV,
 };
 
 #define CLOGC(category, level, fmt, args...) do { \
diff --git a/CommonLibs/trx_vty.c b/CommonLibs/trx_vty.c
index 02d6572..3519788 100644
--- a/CommonLibs/trx_vty.c
+++ b/CommonLibs/trx_vty.c
@@ -528,6 +528,18 @@
 	return CMD_SUCCESS;
 }
 
+#define OBSOLETE_MSG "Obsolete\n"
+DEFUN_DEPRECATED(log_level_lms, log_level_lms_cmd,
+	"logging level lms (debug|info|notice|error|fatal)",
+	".HIDDEN\n" OBSOLETE_MSG OBSOLETE_MSG OBSOLETE_MSG OBSOLETE_MSG
+	OBSOLETE_MSG OBSOLETE_MSG OBSOLETE_MSG OBSOLETE_MSG)
+{
+	vty_out(vty, "%% 'logging level lms' is now called 'logging level devdrv'"
+		", please update your config %s", VTY_NEWLINE);
+
+	return CMD_SUCCESS;
+}
+
 static int dummy_config_write(struct vty *v)
 {
 	return CMD_SUCCESS;
@@ -704,6 +716,8 @@
 
 	install_element(CONFIG_NODE, &cfg_trx_cmd);
 
+	install_element(CFG_LOG_NODE, &log_level_lms_cmd);
+
 	install_node(&trx_node, config_write_trx);
 	install_element(TRX_NODE, &cfg_bind_ip_cmd);
 	install_element(TRX_NODE, &cfg_remote_ip_cmd);
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index b5993b8..19fe6e8 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -93,7 +93,7 @@
 	if ((unsigned int) lvl >= ARRAY_SIZE(lvl_map))
 		lvl = ARRAY_SIZE(lvl_map)-1;
 
-	LOGLV(DLMS, lvl_map[lvl]) << msg;
+	LOGLV(DDEVDRV, lvl_map[lvl]) << msg;
 }
 
 static void print_range(const char* name, lms_range_t *range)
diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index 16047a9..0ad60ef 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -588,10 +588,10 @@
 	log_enable_multithread();
 	osmo_stats_init(tall_trx_ctx);
 	vty_init(&g_vty_info);
+	logging_vty_add_cmds();
 	ctrl_vty_init(tall_trx_ctx);
 	trx_vty_init(g_trx_ctx);
 
-	logging_vty_add_cmds();
 	osmo_talloc_vty_add_cmds();
 	osmo_stats_vty_add_cmds();
 

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

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Ia195a74a62a8a3dd6267fb1359acaa5628208d8e
Gerrit-Change-Number: 16698
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200102/4d788059/attachment.htm>


More information about the gerrit-log mailing list