From bd7bd3947d4882bd7939e34d4565027c64524742 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 16 Jan 2018 01:52:29 +0100 Subject: logging: separate the '<000b>' subsys from filename logging Add a separate flag and API to switch the category-in-hex output: log_set_print_category_hex(). Add log_set_print_filename2() to modify only the print_filename flag. The old log_set_print_filename() function still affects both flags. Explain the rationale in the comment for log_set_print_filename(). There is no need to deprecate log_set_print_filename(); it might cause compiler warnings and break strict builds unnecessarily. Add VTY command 'logging print category-hex (0|1)'. Since there is no VTY command to switch filename output, nothing needs to be adjusted there (a command will be added in a subsequent patch). Change-Id: Iba03a2b7915853c6dccaf6c393c31405320538b4 --- src/vty/logging_vty.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/vty/logging_vty.c') diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index 59148225..fd76d043 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -203,6 +203,23 @@ DEFUN(logging_prnt_cat, return CMD_SUCCESS; } +DEFUN(logging_prnt_cat_hex, + logging_prnt_cat_hex_cmd, + "logging print category-hex (0|1)", + LOGGING_STR "Log output settings\n" + "Configure log message\n" + "Don't prefix each log message\n" + "Prefix each log message with category/subsystem nr in hex ('<000b>')\n") +{ + struct log_target *tgt = osmo_log_vty2tgt(vty); + + if (!tgt) + return CMD_WARNING; + + log_set_print_category_hex(tgt, atoi(argv[0])); + return CMD_SUCCESS; +} + DEFUN(logging_prnt_level, logging_prnt_level_cmd, "logging print level (0|1)", @@ -802,6 +819,7 @@ void logging_vty_add_cmds() install_element_ve(&logging_prnt_timestamp_cmd); install_element_ve(&logging_prnt_ext_timestamp_cmd); install_element_ve(&logging_prnt_cat_cmd); + install_element_ve(&logging_prnt_cat_hex_cmd); install_element_ve(&logging_prnt_level_cmd); install_element_ve(&logging_set_category_mask_cmd); install_element_ve(&logging_set_category_mask_old_cmd); @@ -819,6 +837,7 @@ void logging_vty_add_cmds() install_element(CFG_LOG_NODE, &logging_prnt_timestamp_cmd); 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_cat_hex_cmd); install_element(CFG_LOG_NODE, &logging_prnt_level_cmd); install_element(CFG_LOG_NODE, &logging_level_cmd); -- cgit v1.2.3