summaryrefslogtreecommitdiffstats
path: root/src/vty/logging_vty.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-01-16 01:52:29 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2018-01-19 15:46:49 +0000
commitbd7bd3947d4882bd7939e34d4565027c64524742 (patch)
tree71465644916d3f3675787f8aaac9e31fcb2e9374 /src/vty/logging_vty.c
parent1ac277dcef694a2f849a6b5259cf5aa4488bebb9 (diff)
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
Diffstat (limited to 'src/vty/logging_vty.c')
-rw-r--r--src/vty/logging_vty.c19
1 files changed, 19 insertions, 0 deletions
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);