aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/vty_interface_cmds.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-11 10:21:45 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-11 10:23:45 +0200
commit6fab236cbb5004f9832d3feefc32a481a55c8303 (patch)
tree26566aed80acb486fe2bcae48da14cfcb6c34b30 /openbsc/src/vty_interface_cmds.c
parent7fc9822a74c62f4bf63b7312d2fdc52669eee8e1 (diff)
logging: use 'logging level all' instead of 'logging set log level'
'logging level' can already parse a human-readable level such as 'debug' or 'notice'. By setting the global mask within the same command we can also parse it there.
Diffstat (limited to 'openbsc/src/vty_interface_cmds.c')
-rw-r--r--openbsc/src/vty_interface_cmds.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/openbsc/src/vty_interface_cmds.c b/openbsc/src/vty_interface_cmds.c
index 0c1abfc96..0af8995d0 100644
--- a/openbsc/src/vty_interface_cmds.c
+++ b/openbsc/src/vty_interface_cmds.c
@@ -142,7 +142,7 @@ DEFUN(logging_prnt_timestamp,
}
/* FIXME: those have to be kept in sync with the log levels and categories */
-#define VTY_DEBUG_CATEGORIES "(rll|cc|mm|rr|rsl|nm|sms|pag|mncc|inp|mi|mib|mux|meas|sccp|msc|mgcp|ho|db|ref|gprs|ns|bssgp)"
+#define VTY_DEBUG_CATEGORIES "(rll|cc|mm|rr|rsl|nm|sms|pag|mncc|inp|mi|mib|mux|meas|sccp|msc|mgcp|ho|db|ref|gprs|ns|bssgp|all)"
#define VTY_DEBUG_LEVELS "(everything|debug|info|notice|error|fatal)"
DEFUN(logging_level,
logging_level_cmd,
@@ -159,13 +159,19 @@ DEFUN(logging_level,
return CMD_WARNING;
}
- if (category < 0) {
- vty_out(vty, "Invalid category `%s'%s", argv[0], VTY_NEWLINE);
+ if (level < 0) {
+ vty_out(vty, "Invalid level `%s'%s", argv[1], VTY_NEWLINE);
return CMD_WARNING;
}
- if (level < 0) {
- vty_out(vty, "Invalid level `%s'%s", argv[1], VTY_NEWLINE);
+ /* Check for special case where we want to set global log level */
+ if (!strcmp(argv[0], "all")) {
+ log_set_log_level(conn->dbg, level);
+ return CMD_SUCCESS;
+ }
+
+ if (category < 0) {
+ vty_out(vty, "Invalid category `%s'%s", argv[0], VTY_NEWLINE);
return CMD_WARNING;
}
@@ -192,23 +198,6 @@ DEFUN(logging_set_category_mask,
return CMD_SUCCESS;
}
-DEFUN(logging_set_log_level,
- logging_set_log_level_cmd,
- "logging set log level <0-8>",
- "Set the global log level. The value 0 implies no filtering.\n")
-{
- struct telnet_connection *conn;
-
- conn = (struct telnet_connection *) vty->priv;
- if (!conn->dbg) {
- vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- log_set_log_level(conn->dbg, atoi(argv[0]));
- return CMD_SUCCESS;
-}
-
DEFUN(diable_logging,
disable_logging_cmd,
"logging disable",
@@ -255,6 +244,5 @@ void openbsc_vty_add_cmds()
install_element(VIEW_NODE, &logging_prnt_timestamp_cmd);
install_element(VIEW_NODE, &logging_set_category_mask_cmd);
install_element(VIEW_NODE, &logging_level_cmd);
- install_element(VIEW_NODE, &logging_set_log_level_cmd);
}