Feature #896
Updated by Hammel over 1 year ago
This is pretty straight forward. 1. In the init function: <pre><code class="c"> if ( isCLIFlagSet(CLI_SYSLOG) ) piboxSyslogInit(); </code></pre> 2. In the shutdown function: <pre><code class="c"> if ( isCLIFlagSet(CLI_SYSLOG) ) piboxSyslogShutdown(); </code></pre> 3. In logger local: <pre><code class="c"> /* ---- SYSLOG OUTPUT ---- */ if ( isCLIFlagSet(CLI_SYSLOG) ) { if ( verbose >= type ) piboxSyslog(type, hdr, LogType[type], buf); } </code></pre> 4. Then add the following functions: <pre><code class="c"> /* * These functions are separate from piboxLogger to avoid namespace clashes. */ void piboxSyslogInit() { openlog("<appname>", LOG_PID, (LOG_USER | LOG_NOTICE | LOG_FACMASK)); } void piboxSyslog( int type, const char *hdr, const char *logtype, const char *buf ) { syslog(SLOG[type], "%s %s %s", hdr, logtype, buf); } void piboxSyslogShutdown() { closelog(); } </code></pre> The <appname> may require additional init handling to set the name, or we can get it from the cli args.