diff options
author | Konstantin Tokarev <ktokarev@smartlabs.tv> | 2015-12-01 21:55:34 +0300 |
---|---|---|
committer | Konstantin Tokarev <ktokarev@smartlabs.tv> | 2015-12-15 16:52:53 +0300 |
commit | 3cb278c35c8889a2738f4f70775ec7f8036e76a4 (patch) | |
tree | 4b4642bc032e6ea75680a79b4c43e62c16c695eb /cli-main.c | |
parent | c59827334cdd9e2e25ae3b75d73045d1fca3fa69 (diff) |
Support syslog logging in dbclient.
Diffstat (limited to 'cli-main.c')
-rw-r--r-- | cli-main.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -60,6 +60,12 @@ int main(int argc, char ** argv) { cli_getopts(argc, argv); +#ifndef DISABLE_SYSLOG + if (opts.usingsyslog) { + startsyslog("dbclient"); + } +#endif + TRACE(("user='%s' host='%s' port='%s'", cli_opts.username, cli_opts.remotehost, cli_opts.remoteport)) @@ -118,13 +124,19 @@ static void cli_dropbear_exit(int exitcode, const char* format, va_list param) { exit(exitcode); } -static void cli_dropbear_log(int UNUSED(priority), +static void cli_dropbear_log(int priority, const char* format, va_list param) { char printbuf[1024]; vsnprintf(printbuf, sizeof(printbuf), format, param); +#ifndef DISABLE_SYSLOG + if (opts.usingsyslog) { + syslog(priority, "%s", printbuf); + } +#endif + fprintf(stderr, "%s: %s\n", cli_opts.progname, printbuf); fflush(stderr); } |