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.
diff --git a/openbsc/src/vty_interface_cmds.c b/openbsc/src/vty_interface_cmds.c
index 0c1abfc..0af8995 100644
--- a/openbsc/src/vty_interface_cmds.c
+++ b/openbsc/src/vty_interface_cmds.c
@@ -142,7 +142,7 @@
}
/* 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 @@
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 @@
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 @@
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);
}