summaryrefslogtreecommitdiffstats
path: root/lib/command.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-06-19 15:02:21 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-06-19 15:02:21 +0200
commite9b4e74a7868cd4f8eff60209c1039cacb3421b4 (patch)
tree6d13ba12bfca429b08a48c544de089274ae01ec3 /lib/command.c
parentlib: Remove special case code to use syslog (diff)
downloadfrr-e9b4e74a7868cd4f8eff60209c1039cacb3421b4.tar.xz
frr-e9b4e74a7868cd4f8eff60209c1039cacb3421b4.zip
lib: Add --log-level to daemons
Add the ability to specify the designated log level at startup. --log-level <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/command.c b/lib/command.c
index 32b052c36..4ab47e5fc 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2446,21 +2446,31 @@ static int set_log_file(struct vty *vty, const char *fname, int loglevel)
return CMD_SUCCESS;
}
-void command_setup_early_logging(const char *option)
+void command_setup_early_logging(const char *dest, const char *level)
{
char *token;
- if (strcmp(option, "stdout") == 0) {
+ if (level) {
+ int nlevel = level_match(level);
+
+ if (nlevel != ZLOG_DISABLED)
+ zlog_default->default_lvl = nlevel;
+ }
+
+ if (!dest)
+ return;
+
+ if (strcmp(dest, "stdout") == 0) {
zlog_set_level(ZLOG_DEST_STDOUT, zlog_default->default_lvl);
return;
}
- if (strcmp(option, "syslog") == 0) {
+ if (strcmp(dest, "syslog") == 0) {
zlog_set_level(ZLOG_DEST_SYSLOG, zlog_default->default_lvl);
return;
}
- token = strstr(option, ":");
+ token = strstr(dest, ":");
token++;
set_log_file(NULL, token, zlog_default->default_lvl);