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
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;