[PATCH] libosmo-sccp[master]: osmo-stp: Remove hack to always enable debug 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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Apr 14 15:12:46 UTC 2017


Review at  https://gerrit.osmocom.org/2341

osmo-stp: Remove hack to always enable debug logging

... and rather use the config file based logging configuration, like
other osmocom programs, too.

Change-Id: I7e0fb869bd778d8c276dc8afd16ecd7f1965b74a
---
M doc/examples/osmo-stp.cfg
M stp/stp_main.c
2 files changed, 13 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/41/2341/1

diff --git a/doc/examples/osmo-stp.cfg b/doc/examples/osmo-stp.cfg
index 45a822b..960bf33 100644
--- a/doc/examples/osmo-stp.cfg
+++ b/doc/examples/osmo-stp.cfg
@@ -2,6 +2,15 @@
 ! osmo-stp (0.0.6.3.179-b248) configuration saved from vty
 !!
 !
+log stderr
+  logging filter all 1
+  logging color 1
+  logging print category 1
+  logging timestamp 0
+  logging level lss7 debug
+  logging level lsccp debug
+  logging level lsua debug
+  logging level lm3ua debug
 line vty
  no login
 !
diff --git a/stp/stp_main.c b/stp/stp_main.c
index 6fbc634..5412223 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -31,6 +31,7 @@
 #include <osmocom/vty/vty.h>
 #include <osmocom/vty/ports.h>
 #include <osmocom/vty/telnet_interface.h>
+#include <osmocom/vty/logging.h>
 
 #include <osmocom/sigtran/osmo_ss7.h>
 #include <osmocom/sigtran/sccp_sap.h>
@@ -38,6 +39,7 @@
 #include <osmocom/sigtran/protocol/sua.h>
 #include <osmocom/sigtran/protocol/m3ua.h>
 
+/* we only use logging sub-systems of the various libraries so far */
 static const struct log_info_cat log_info_cat[] = {
 };
 
@@ -45,18 +47,6 @@
 	.cat = log_info_cat,
 	.num_cat = ARRAY_SIZE(log_info_cat),
 };
-
-/* Hack to enable debug logging for all relevant (used?) subsystems */
-static void init_logging(void)
-{
-	const int log_cats[] = { DLSS7, DLSUA, DLM3UA, DLSCCP, DLINP };
-	unsigned int i;
-
-	osmo_init_logging(&log_info);
-
-	for (i = 0; i < ARRAY_SIZE(log_cats); i++)
-		log_set_category_filter(osmo_stderr_target, log_cats[i], 1, LOGL_DEBUG);
-}
 
 static const char stp_copyright[] =
 	"Copyright (C) 2015-2017 by Harald Welte <laforge at gnumonks.org>\r\n"
@@ -82,10 +72,11 @@
 	fputs(stp_copyright, stdout);
 	fputs("\n", stdout);
 
-	init_logging();
+	osmo_init_logging(&log_info);
 	osmo_ss7_init();
 	osmo_fsm_log_addr(false);
 	vty_init(&vty_info);
+	logging_vty_add_cmds(&log_info);
 	osmo_ss7_vty_init_sg();
 
 	rc = vty_read_config_file(config_file, NULL);

-- 
To view, visit https://gerrit.osmocom.org/2341
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e0fb869bd778d8c276dc8afd16ecd7f1965b74a
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list