Change in libosmocore[master]: logging vty: deprecate the 'everything' keyword

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Sep 12 01:50:16 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/10885


Change subject: logging vty: deprecate the 'everything' keyword
......................................................................

logging vty: deprecate the 'everything' keyword

The 'logging level all everything' has not had an effect for some time now. The
plan is to bring back its old functionality, but to keep it deprecated and
rather define a less confusing name.

* Deprecate 'everything'.
* Do not write 'everything' during 'write file' or 'show running-config', which
  we curiously still do until now.

BTW, the reason why we need to compose a complete list of categories for the
deprecated 'everything' command is explained in detail in the commit log for
I3b083f27e3d751ccec258880ae7676e9af959a63

Change-Id: Ib75fedb0572570a61bb34ee729a2af86cf5f16da
---
M src/logging.c
M src/vty/logging_vty.c
M tests/logging/logging_vty_test.vty
3 files changed, 35 insertions(+), 30 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/85/10885/1

diff --git a/src/logging.c b/src/logging.c
index 7c2d61f..67470a5 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -64,7 +64,6 @@
 LLIST_HEAD(osmo_log_target_list);
 
 static const struct value_string loglevel_strs[] = {
-	{ 0,		"EVERYTHING" },
 	{ LOGL_DEBUG,	"DEBUG" },
 	{ LOGL_INFO,	"INFO" },
 	{ LOGL_NOTICE,	"NOTICE" },
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index 2b001bc..6758dd2 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -320,7 +320,7 @@
 	cmd->doc = doc_str;
 }
 
-/* logging level (all|<categories>) (everything|debug|...|fatal) */
+/* logging level (all|<categories>) (debug|...|fatal) */
 DEFUN(logging_level,
       logging_level_cmd,
       NULL, /* cmdstr is dynamically set in logging_vty_add_cmds(). */
@@ -338,11 +338,6 @@
 		return CMD_WARNING;
 	}
 
-	if (strcmp(argv[1], "everything") == 0) { /* FIXME: remove this check once 'everything' is phased out */
-		vty_out(vty, "%% Ignoring deprecated logging level %s%s", argv[1], VTY_NEWLINE);
-		return CMD_SUCCESS;
-	}
-
 	/* Check for special case where we want to set global log level */
 	if (!strcmp(argv[0], "all")) {
 		log_set_log_level(tgt, level);
@@ -360,6 +355,15 @@
 	return CMD_SUCCESS;
 }
 
+/* logging level (all|<categories>) everything */
+DEFUN_DEPRECATED(deprecated_logging_level_everything, deprecated_logging_level_everything_cmd,
+		 NULL, /* cmdstr is dynamically set in logging_vty_add_cmds(). */
+		 NULL) /* same thing for helpstr. */
+{
+	vty_out(vty, "%% Ignoring deprecated logging level 'everything' keyword%s", VTY_NEWLINE);
+	return CMD_SUCCESS;
+}
+
 DEFUN(logging_set_category_mask,
       logging_set_category_mask_cmd,
       "logging set-log-mask MASK",
@@ -858,8 +862,9 @@
 		VTY_NEWLINE);
 
 	/* stupid old osmo logging API uses uppercase strings... */
-	vty_out(vty, "  logging level all %s%s", osmo_str_tolower(log_level_str(tgt->loglevel)),
-		VTY_NEWLINE);
+	if (tgt->loglevel)
+		vty_out(vty, "  logging level all %s%s", osmo_str_tolower(log_level_str(tgt->loglevel)),
+			VTY_NEWLINE);
 
 	for (i = 0; i < osmo_log_info->num_cat; i++) {
 		const struct log_category *cat = &tgt->categories[i];
@@ -896,7 +901,7 @@
 {
 	struct cmd_element *cmd = talloc_zero(ctx, struct cmd_element);
 	OSMO_ASSERT(cmd);
-	cmd->string = talloc_asprintf(cmd, "logging level %s (everything|debug|info|notice|error|fatal)",
+	cmd->string = talloc_asprintf(cmd, "logging level %s (debug|info|notice|error|fatal)",
 				    name);
 	printf("%s\n", cmd->string);
 	cmd->func = log_deprecated_func;
@@ -924,12 +929,16 @@
 	install_element_ve(&logging_set_category_mask_cmd);
 	install_element_ve(&logging_set_category_mask_old_cmd);
 
-	/* logging level (all|<categories>) (everything|debug|...|fatal) */
+	/* logging level (all|<categories>) (debug|...|fatal) */
 	gen_logging_level_cmd_strs(&logging_level_cmd,
-				   "(everything|" LOG_LEVEL_ARGS ")",
-				   EVERYTHING_STR LOG_LEVEL_STRS);
+				   "(" LOG_LEVEL_ARGS ")",
+				   LOG_LEVEL_STRS);
+	/* logging level (all|<categories>) everything */
+	gen_logging_level_cmd_strs(&deprecated_logging_level_everything_cmd,
+				   "everything", EVERYTHING_STR);
 
 	install_element_ve(&logging_level_cmd);
+	install_element_ve(&deprecated_logging_level_everything_cmd);
 	install_element_ve(&show_logging_vty_cmd);
 	install_element_ve(&show_alarms_cmd);
 
@@ -943,6 +952,7 @@
 	install_element(CFG_LOG_NODE, &logging_prnt_level_cmd);
 	install_element(CFG_LOG_NODE, &logging_prnt_file_cmd);
 	install_element(CFG_LOG_NODE, &logging_level_cmd);
+	install_element(CFG_LOG_NODE, &deprecated_logging_level_everything_cmd);
 
 	install_element(CONFIG_NODE, &cfg_log_stderr_cmd);
 	install_element(CONFIG_NODE, &cfg_no_log_stderr_cmd);
diff --git a/tests/logging/logging_vty_test.vty b/tests/logging/logging_vty_test.vty
index c57b70f..a2c1e74 100644
--- a/tests/logging/logging_vty_test.vty
+++ b/tests/logging/logging_vty_test.vty
@@ -1,11 +1,9 @@
 logging_vty_test> enable
 
-logging_vty_test# ! Note that 'logging level all everything' is still printed!
 logging_vty_test# show running-config
 ...
 log stderr
-...
-  logging level all everything
+... !logging level all
   logging level aa debug
   logging level bb info
   logging level ccc notice
@@ -39,7 +37,7 @@
   logging print level (0|1)
   logging print file (0|1|basename) [last]
   logging set-log-mask MASK
-  logging level (all|aa|bb|ccc|dddd|eee|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf) (everything|debug|info|notice|error|fatal)
+  logging level (all|aa|bb|ccc|dddd|eee|lglobal|llapd|linp|lmux|lmi|lmib|lsms|lctrl|lgtp|lstats|lgsup|loap|lss7|lsccp|lsua|lm3ua|lmgcp|ljibuf) (debug|info|notice|error|fatal)
   show logging vty
 ... !logging
 
@@ -64,20 +62,18 @@
 ...
 
 logging_vty_test# logging level aa ?
-  everything  Don't use. It doesn't log anything
-  debug       Log debug messages and higher levels
-  info        Log informational messages and higher levels
-  notice      Log noticeable messages and higher levels
-  error       Log error messages and higher levels
-  fatal       Log only fatal messages
+  debug   Log debug messages and higher levels
+  info    Log informational messages and higher levels
+  notice  Log noticeable messages and higher levels
+  error   Log error messages and higher levels
+  fatal   Log only fatal messages
 
 logging_vty_test# logging level all ?
-  everything  Don't use. It doesn't log anything
-  debug       Log debug messages and higher levels
-  info        Log informational messages and higher levels
-  notice      Log noticeable messages and higher levels
-  error       Log error messages and higher levels
-  fatal       Log only fatal messages
+  debug   Log debug messages and higher levels
+  info    Log informational messages and higher levels
+  notice  Log noticeable messages and higher levels
+  error   Log error messages and higher levels
+  fatal   Log only fatal messages
 
 
 logging_vty_test# log-sweep
@@ -181,7 +177,7 @@
 
 logging_vty_test# ! Old 'logging level all everything' has no effect
 logging_vty_test# logging level all everything
-% Ignoring deprecated logging level everything
+% Ignoring deprecated logging level 'everything' keyword
 logging_vty_test# log-sweep eee
 DEEE NOTICE Log message for DEEE on level LOGL_NOTICE
 DEEE ERROR Log message for DEEE on level LOGL_ERROR

-- 
To view, visit https://gerrit.osmocom.org/10885
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib75fedb0572570a61bb34ee729a2af86cf5f16da
Gerrit-Change-Number: 10885
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180912/c84e194e/attachment.htm>


More information about the gerrit-log mailing list