summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vty/logging_vty.c8
-rw-r--r--tests/logging/logging_vty_test.vty3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index 31edb528..f3e1419c 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -364,6 +364,10 @@ DEFUN(logging_level_set_all, logging_level_set_all_cmd,
struct log_target *tgt = osmo_log_vty2tgt(vty);
int level = log_parse_level(argv[0]);
int i;
+
+ if (!tgt)
+ return CMD_WARNING;
+
for (i = 0; i < osmo_log_info->num_cat; i++) {
struct log_category *cat = &tgt->categories[i];
/* skip empty entries in the array */
@@ -391,6 +395,8 @@ DEFUN(logging_level_force_all, logging_level_force_all_cmd,
{
struct log_target *tgt = osmo_log_vty2tgt(vty);
int level = log_parse_level(argv[0]);
+ if (!tgt)
+ return CMD_WARNING;
log_set_log_level(tgt, level);
return CMD_SUCCESS;
}
@@ -400,6 +406,8 @@ DEFUN(no_logging_level_force_all, no_logging_level_force_all_cmd,
NO_STR LOGGING_STR LEVEL_STR NO_FORCE_ALL_STR)
{
struct log_target *tgt = osmo_log_vty2tgt(vty);
+ if (!tgt)
+ return CMD_WARNING;
log_set_log_level(tgt, 0);
return CMD_SUCCESS;
}
diff --git a/tests/logging/logging_vty_test.vty b/tests/logging/logging_vty_test.vty
index 0eedbe35..b1909271 100644
--- a/tests/logging/logging_vty_test.vty
+++ b/tests/logging/logging_vty_test.vty
@@ -28,6 +28,9 @@ logging_vty_test(config-log)# exit
logging_vty_test(config)# no log stderr
logging_vty_test(config)# exit
+logging_vty_test# logging level force-all notice
+Logging was not enabled.
+
logging_vty_test# logging enable
logging_vty_test# logging filter all 1
logging_vty_test# logging print category-hex 0