Change in osmo-remsim[master]: add '-d' command line argument to configure stderr logging verbosity

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
Mon May 25 12:56:30 UTC 2020


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


Change subject: add '-d' command line argument to configure stderr logging verbosity
......................................................................

add '-d' command line argument to configure stderr logging verbosity

The '-d' option is pretty much tradition in most osmocom programs,
particularly for those without a VTY / config file it is the only
option to configure per-subsystem logging verbosity.

Change-Id: I0abecc26a5d8b6a5607e1eb8982af4c05909afed
---
M src/bankd/bankd_main.c
M src/client/remsim_client_main.c
M src/server/remsim_server.c
3 files changed, 17 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/49/18449/1

diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c
index b3e38b3..b8ba642 100644
--- a/src/bankd/bankd_main.c
+++ b/src/bankd/bankd_main.c
@@ -271,6 +271,7 @@
 	printf(
 "  -h --help			Print this help message\n"
 "  -V --version			Print the version of the program\n"
+"  -d --debug option            Enable debug logging (e.g. DMAIN:DST2)\n"
 "  -i --server-host A.B.C.D	remsim-server IP address (default: 127.0.0.1)\n"
 "  -p --server-port <1-65535>	remsim-server TCP port (default: 9998)\n"
 "  -b --bank-id <1-65535>	Bank Identifier of this SIM bank (default: 1)\n"
@@ -292,6 +293,7 @@
 		static const struct option long_options[] = {
 			{ "help", 0, 0, 'h' },
 			{ "version", 0, 0, 'V' },
+			{ "debug", 1, 0, 'd' },
 			{ "server-host", 1, 0, 'i' },
 			{ "server-port", 1, 0, 'p' },
 			{ "bank-id", 1, 0, 'b' },
@@ -302,7 +304,7 @@
 			{ 0, 0, 0, 0 }
 		};
 
-		c = getopt_long(argc, argv, "hVi:o:b:n:N:I:P:", long_options, &option_index);
+		c = getopt_long(argc, argv, "hVd:i:o:b:n:N:I:P:", long_options, &option_index);
 		if (c == -1)
 			break;
 
@@ -315,6 +317,9 @@
 			printf("osmo-remsim-bankd version %s\n", VERSION);
 			exit(0);
 			break;
+		case 'd':
+			log_parse_category_mask(osmo_stderr_target, optarg);
+			break;
 		case 'i':
 			g_bankd->srvc.server_host = optarg;
 			break;
diff --git a/src/client/remsim_client_main.c b/src/client/remsim_client_main.c
index 6587e6b..bc916b9 100644
--- a/src/client/remsim_client_main.c
+++ b/src/client/remsim_client_main.c
@@ -24,6 +24,7 @@
 	printf(
 		"  -h --help                  Print this help message\n"
 		"  -v --version               Print program version\n"
+		"  -d --debug option          Enable debug logging (e.g. DMAIN:DST2)\n"
 		"  -i --server-ip A.B.C.D     remsim-server IP address\n"
 		"  -p --server-port 13245     remsim-server TCP port\n"
 		"  -c --client-id <0-65535>   RSPRO ClientId of this client\n"
@@ -50,6 +51,7 @@
 		static const struct option long_options[] = {
 			{ "help", 0, 0, 'h' },
 			{ "version", 0, 0, 'v' },
+			{ "debug", 1, 0, 'd' },
 			{ "server-ip", 1, 0, 'i' },
 			{ "server-port", 1, 0, 'p' },
 			{ "client-id", 1, 0, 'c' },
@@ -68,7 +70,7 @@
 			{ 0, 0, 0, 0 }
 		};
 
-		c = getopt_long(argc, argv, "hvi:p:c:n:e:"
+		c = getopt_long(argc, argv, "hvd:i:p:c:n:e:"
 #ifdef USB_SUPPORT
 						"V:P:C:I:S:A:H:"
 #endif
@@ -86,6 +88,9 @@
 			printf("osmo-remsim-client version %s\n", VERSION);
 			exit(0);
 			break;
+		case 'd':
+			log_parse_category_mask(osmo_stderr_target, optarg);
+			break;
 		case 'i':
 			osmo_talloc_replace_string(cfg, &cfg->server_host, optarg);
 			break;
diff --git a/src/server/remsim_server.c b/src/server/remsim_server.c
index 9d3268f..6ec5f37 100644
--- a/src/server/remsim_server.c
+++ b/src/server/remsim_server.c
@@ -33,6 +33,7 @@
 	printf( "  Some useful help...\n"
 		"  -h --help			This text\n"
 		"  -V --version			Print version of the program\n"
+		"  -d --debug option            Enable debug logging (e.g. DMAIN:DST2)\n"
 		);
 }
 
@@ -43,6 +44,7 @@
 		static struct option long_options[] = {
 			{ "help", 0, 0, 'h' },
 			{ "version", 0, 0, 'V' },
+			{ "debug", 1, 0, 'd' },
 			{0, 0, 0, 0}
 		};
 
@@ -55,6 +57,9 @@
 			print_help();
 			exit(0);
 			break;
+		case 'd':
+			log_parse_category_mask(osmo_stderr_target, optarg);
+			break;
 		case 'V':
 			printf("osmo-resmim-server version %s\n", VERSION);
 			exit(0);

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

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I0abecc26a5d8b6a5607e1eb8982af4c05909afed
Gerrit-Change-Number: 18449
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/20200525/b2e5a1f8/attachment.htm>


More information about the gerrit-log mailing list