[MERGED] osmo-trx[master]: osmo-trx: Re-introduce -l cmd line parameter

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
Tue Mar 6 19:38:56 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: osmo-trx: Re-introduce -l cmd line parameter
......................................................................


osmo-trx: Re-introduce -l cmd line parameter

Parameter -l to set the terminal logging levle was removed in
3da1f8352e337fb032bf7a58c2909d3ba918e237, but afterwards it was decided
to keep the cmd line options for a bit more to easy migration to VTY
cfg.

The command line no longer accepts keywords ("DEBUG", "INFO", etc.) but
log level numbers, due to libosmocore APIs log_parse_level and
log_level_str being marked as deprecated and for internal use only.

Keep in mind the log level is overridden by VTY cfg if any line sets log
levels for log stderr in there.

Explicit cast to unsigned int for loglvel is issued to avoid iostream
printing it as a char.

Change-Id: I91c35ecded177b7976045d9b693855adb9e18f8a
---
M Transceiver52M/osmo-trx.cpp
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index f975500..2eb8309 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -211,7 +211,7 @@
 	std::vector<std::string> rx_paths, tx_paths;
 	bool rx_paths_set = false, tx_paths_set = false;
 
-	while ((option = getopt(argc, argv, "ha:i:j:p:c:dmxgfo:s:b:r:A:R:Set:y:z:C:")) != -1) {
+	while ((option = getopt(argc, argv, "ha:l:i:j:p:c:dmxgfo:s:b:r:A:R:Set:y:z:C:")) != -1) {
 		switch (option) {
 		case 'h':
 			print_help();
@@ -220,6 +220,10 @@
 		case 'a':
 			print_deprecated(option);
 			osmo_talloc_replace_string(trx, &trx->cfg.dev_args, optarg);
+			break;
+		case 'l':
+			print_deprecated(option);
+			log_set_log_level(osmo_stderr_target, atoi(optarg));
 			break;
 		case 'i':
 			print_deprecated(option);
@@ -377,6 +381,7 @@
 	std::ostringstream ost("");
 
 	ost << "Config Settings" << std::endl;
+	ost << "   Log Level............... " << (unsigned int) osmo_stderr_target->loglevel << std::endl;
 	ost << "   Device args............. " << charp2str(trx->cfg.dev_args) << std::endl;
 	ost << "   TRX Base Port........... " << trx->cfg.base_port << std::endl;
 	ost << "   TRX Address............. " << charp2str(trx->cfg.bind_addr) << std::endl;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I91c35ecded177b7976045d9b693855adb9e18f8a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list