Mercurial > dropbear
diff cli-main.c @ 1214:61d3f56808a4
Merge pull request #18 from annulen/dbclient_syslog
Support syslog logging in dbclient.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 15 Dec 2015 21:55:51 +0800 |
parents | bf626d259eb1 |
children | d058e15ea213 |
line wrap: on
line diff
--- a/cli-main.c Tue Dec 15 21:40:32 2015 +0800 +++ b/cli-main.c Tue Dec 15 21:55:51 2015 +0800 @@ -60,6 +60,12 @@ 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 @@ 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); }