From 91ae7da6cf0def5fecaa53c431582f3da3351017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=92=E9=87=8E=E7=84=A1=E7=87=88?= Date: Tue, 16 May 2017 00:48:09 +0800 Subject: [PATCH] add -s option to enable log to syslog --- commandline.c | 6 ++++++ debug.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/commandline.c b/commandline.c index ac711a9..b5a1bf4 100644 --- a/commandline.c +++ b/commandline.c @@ -49,6 +49,7 @@ usage(const char *appname) fprintf(stdout, " -c [filename] Use this config file\n"); fprintf(stdout, " -f Run in foreground\n"); fprintf(stdout, " -d Debug level\n"); + fprintf(stdout, " -s Log to syslog\n"); fprintf(stdout, " -h Print usage\n"); fprintf(stdout, " -v Print version information\n"); fprintf(stdout, "\n"); @@ -91,6 +92,11 @@ parse_commandline(int argc, char **argv) } break; + case 's': + debugconf.log_syslog = 1; + debugconf.log_stderr = 0; + break; + case 'v': fprintf(stdout, "This is %s version " VERSION "\n", argv[0]); exit(1); diff --git a/debug.c b/debug.c index b6941f6..01a46ba 100644 --- a/debug.c +++ b/debug.c @@ -38,7 +38,7 @@ debugconf_t debugconf = { .debuglevel = LOG_INFO, .log_stderr = 1, .log_syslog = 0, - .syslog_facility = 0 + .syslog_facility = LOG_USER }; /** @internal