diff options
author | Harald Welte <laforge@gnumonks.org> | 2018-09-25 20:16:14 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-09-25 20:25:30 +0200 |
commit | 0d67f483e2d240089105a4d241cb8c9085e245af (patch) | |
tree | 726b63b724dba0099b4d8bc6bd535de4f326ae1b | |
parent | 81bfef931a35771bcf1b7164b3370ae851821678 (diff) |
logging_vty: Ensure writing well-formed config files
We want to have well-formed config files that print exactly one space
per VTY/config node level, and not two.
Change-Id: Ia75c7067284ea225cffe13ca71bad05a7747ae66
-rw-r--r-- | src/vty/logging_vty.c | 18 | ||||
-rw-r--r-- | tests/logging/logging_vty_test.vty | 12 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index b2637a5f..31edb528 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -890,24 +890,24 @@ static int config_write_log_single(struct vty *vty, struct log_target *tgt) break; } - vty_out(vty, " logging filter all %u%s", + vty_out(vty, " logging filter all %u%s", tgt->filter_map & (1 << LOG_FLT_ALL) ? 1 : 0, VTY_NEWLINE); /* save filters outside of libosmocore, i.e. in app code */ if (osmo_log_info->save_fn) osmo_log_info->save_fn(vty, osmo_log_info, tgt); - vty_out(vty, " logging color %u%s", tgt->use_color ? 1 : 0, + vty_out(vty, " logging color %u%s", tgt->use_color ? 1 : 0, VTY_NEWLINE); - vty_out(vty, " logging print category %d%s", + vty_out(vty, " logging print category %d%s", tgt->print_category ? 1 : 0, VTY_NEWLINE); if (tgt->print_ext_timestamp) - vty_out(vty, " logging print extended-timestamp 1%s", VTY_NEWLINE); + vty_out(vty, " logging print extended-timestamp 1%s", VTY_NEWLINE); else - vty_out(vty, " logging timestamp %u%s", + vty_out(vty, " logging timestamp %u%s", tgt->print_timestamp ? 1 : 0, VTY_NEWLINE); if (tgt->print_level) - vty_out(vty, " logging print level 1%s", VTY_NEWLINE); - vty_out(vty, " logging print file %s%s", + vty_out(vty, " logging print level 1%s", VTY_NEWLINE); + vty_out(vty, " logging print file %s%s", get_value_string(logging_print_file_args, tgt->print_filename2), VTY_NEWLINE); @@ -918,7 +918,7 @@ static int config_write_log_single(struct vty *vty, struct log_target *tgt) vty_out(vty, "%% Invalid log level %u for 'force-all'%s", tgt->loglevel, VTY_NEWLINE); else - vty_out(vty, " logging level force-all %s%s", level_str, VTY_NEWLINE); + vty_out(vty, " logging level force-all %s%s", level_str, VTY_NEWLINE); } for (i = 0; i < osmo_log_info->num_cat; i++) { @@ -941,7 +941,7 @@ static int config_write_log_single(struct vty *vty, struct log_target *tgt) continue; } - vty_out(vty, " logging level %s", cat_name); + vty_out(vty, " logging level %s", cat_name); vty_out(vty, " %s%s", osmo_str_tolower(level_str), VTY_NEWLINE); } diff --git a/tests/logging/logging_vty_test.vty b/tests/logging/logging_vty_test.vty index 0c552a58..0eedbe35 100644 --- a/tests/logging/logging_vty_test.vty +++ b/tests/logging/logging_vty_test.vty @@ -4,11 +4,11 @@ logging_vty_test# show running-config ... log stderr ... !logging level all - logging level aa debug - logging level bb info - logging level ccc notice - logging level dddd error - logging level eee fatal + logging level aa debug + logging level bb info + logging level ccc notice + logging level dddd error + logging level eee fatal ... logging_vty_test# configure terminal @@ -17,7 +17,7 @@ logging_vty_test(config)# log stderr logging_vty_test(config-log)# logging level force-all notice logging_vty_test(config-log)# show running-config ... !logging level all - logging level force-all notice + logging level force-all notice ... !logging level all logging_vty_test(config-log)# no logging level force-all |