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/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/5813 logging: vty: add 'logging print file (0|1|with-cat)' cmd Add a VTY command that allows configuring the output of source filename. So far, this was not configurable by VTY at all. Accomodate the (what I see as) legacy behavior of including the log category in hex form as argument 'with-cat'. 0 disables file output, 1 enables only file output without the hex category. The default behavior on startup still is to log file and hex category, to stay backwards compatible. Change-Id: If1bd79026a3c680ccf7587d545d12f7759a998fc --- M src/vty/logging_vty.c 1 file changed, 29 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/13/5813/1 diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index 5914822..4e2cefc 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -220,6 +220,30 @@ return CMD_SUCCESS; } +DEFUN(logging_prnt_file, + logging_prnt_file_cmd, + "logging print file (0|1|with-cat)", + LOGGING_STR "Log output settings\n" + "Configure log message\n" + "Don't prefix each log message\n" + "Prefix each log message with the source file and line\n" + "Prefix each log message with the subsys in hex and the source file and line" + " (legacy behavior)\n") +{ + struct log_target *tgt = osmo_log_vty2tgt(vty); + int val; + + if (!tgt) + return CMD_WARNING; + + if (!strcmp(argv[0], "with-cat")) + val = 1; + else + val = atoi(argv[0])? 2 : 0; + log_set_print_filename(tgt, val); + return CMD_SUCCESS; +} + DEFUN(logging_level, logging_level_cmd, NULL, /* cmdstr is dynamically set in logging_vty_add_cmds(). */ @@ -753,6 +777,9 @@ tgt->print_timestamp ? 1 : 0, VTY_NEWLINE); if (tgt->print_level) vty_out(vty, " logging print level 1%s", VTY_NEWLINE); + if (tgt->print_filename) + vty_out(vty, " logging print file %s%s", + tgt->print_filename_subsys_hex? "with-cat" : "1", VTY_NEWLINE); /* stupid old osmo logging API uses uppercase strings... */ osmo_str2lower(level_lower, log_level_str(tgt->loglevel)); @@ -803,6 +830,7 @@ install_element_ve(&logging_prnt_ext_timestamp_cmd); install_element_ve(&logging_prnt_cat_cmd); install_element_ve(&logging_prnt_level_cmd); + install_element_ve(&logging_prnt_file_cmd); install_element_ve(&logging_set_category_mask_cmd); install_element_ve(&logging_set_category_mask_old_cmd); @@ -820,6 +848,7 @@ install_element(CFG_LOG_NODE, &logging_prnt_ext_timestamp_cmd); install_element(CFG_LOG_NODE, &logging_prnt_cat_cmd); install_element(CFG_LOG_NODE, &logging_prnt_level_cmd); + install_element(CFG_LOG_NODE, &logging_prnt_file_cmd); install_element(CFG_LOG_NODE, &logging_level_cmd); install_element(CONFIG_NODE, &cfg_log_stderr_cmd); -- To view, visit https://gerrit.osmocom.org/5813 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If1bd79026a3c680ccf7587d545d12f7759a998fc Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>