vty: Add logging_vty_add_deprecated_subsys

This function permits the user to register deprecated log categories,
which will ensure that if log categories are removed from a program,
old config files will still load.

We simply dynamically allocate a cmd_element and install it at
CFG_LOG_NODE.  Not registering it at VIEW_NODE or ENABLE_NODE
ensures that it's not accessible from the interactive VTY, but only
from the config file / configure node.

Change-Id: I171f62ea2dc565b3a6c3eecd27fb7853e2529598
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index 09d207a..8151fda 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -836,6 +836,27 @@
 	return 1;
 }
 
+static int log_deprecated_func(struct cmd_element *cmd, struct vty *vty, int argc, const char *argv[])
+{
+	vty_out(vty, "%% Ignoring deprecated '%s'%s", cmd->string, VTY_NEWLINE);
+	return CMD_WARNING;
+}
+
+void logging_vty_add_deprecated_subsys(void *ctx, const char *name)
+{
+	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)",
+				    name);
+	printf("%s\n", cmd->string);
+	cmd->func = log_deprecated_func;
+	cmd->doc = "Set the log level for a specified category\n"
+		   "Deprecated Category\n";
+	cmd->attr = CMD_ATTR_DEPRECATED;
+
+	install_element(CFG_LOG_NODE, cmd);
+}
+
 /*! Register logging related commands to the VTY. Call this once from
  *  your application if you want to support those commands. */
 void logging_vty_add_cmds()