pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bts/+/38871?usp=email )
Change subject: bts-omldummy: Support configuring logging through cmdline
......................................................................
bts-omldummy: Support configuring logging through cmdline
Add cmdline args to control logging, as already present in other more
usual bts models.
This is extremely important here since there's no VTY at all to
configure them.
Change-Id: I0b33919d71bacefe60be192810518fd927625127
---
M src/osmo-bts-omldummy/main.c
1 file changed, 20 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/71/38871/1
diff --git a/src/osmo-bts-omldummy/main.c b/src/osmo-bts-omldummy/main.c
index 167d43a..088fa52 100644
--- a/src/osmo-bts-omldummy/main.c
+++ b/src/osmo-bts-omldummy/main.c
@@ -7,6 +7,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/application.h>
+#include <osmocom/core/logging.h>
#include <osmo-bts/logging.h>
#include <osmo-bts/abis.h>
#include <osmo-bts/bts.h>
@@ -44,10 +45,14 @@
static struct option long_options[] = {
{"help", 0, 0, 'h'},
{"features", 1, 0, 'f'},
+ { "debug", 1, 0, 'd' },
+ { "disable-color", 0, 0, 's' },
+ { "timestamp", 0, 0, 'T' },
+ { "log-level", 1, 0, 'e' },
{0}
};
- c = getopt_long(argc, argv, "hf:", long_options, &option_index);
+ c = getopt_long(argc, argv, "hf:d:sTe:", long_options, &option_index);
if (c == -1)
break;
@@ -58,6 +63,18 @@
case 'f':
cmdline.features = optarg;
break;
+ case 's':
+ log_set_use_color(osmo_stderr_target, 0);
+ break;
+ case 'd':
+ log_parse_category_mask(osmo_stderr_target, optarg);
+ break;
+ case 'T':
+ log_set_print_timestamp(osmo_stderr_target, 1);
+ break;
+ case 'e':
+ log_set_log_level(osmo_stderr_target, atoi(optarg));
+ break;
default:
/* catch unknown options *as well as* missing arguments. */
fprintf(stderr, "Error in command line options. Exiting.\n");
@@ -111,13 +128,13 @@
struct bsc_oml_host *bsc_oml_host;
int i;
- parse_cmdline(argc, argv);
-
tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context");
msgb_talloc_ctx_init(tall_bts_ctx, 10*1024);
osmo_init_logging2(tall_bts_ctx, &bts_log_info);
+ parse_cmdline(argc, argv);
+
g_bts_sm = gsm_bts_sm_alloc(tall_bts_ctx);
if (!g_bts_sm)
exit(1);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bts/+/38871?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I0b33919d71bacefe60be192810518fd927625127
Gerrit-Change-Number: 38871
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>