- va_start(args, fmt);
- vsnprintf(buff, sizeof (buff), fmt, args);
- va_end(args);
-
- if ((n = strlen(buff)) > 0 && buff[n-1] == '\n')
- buff[--n] = '\0';
-
- switch (kind) {
- case L_FATAL:
- syslog(LOG_ERR, "%s", buff);
- break;
- case L_ERROR:
- syslog(LOG_ERR, "%s", buff);
- break;
- case L_WARNING:
- syslog(LOG_WARNING, "%s", buff);
- break;
- case L_NOTICE:
- syslog(LOG_NOTICE, "%s", buff);
- break;
- default:
- logged = 0;
- break;
+ if (log_stderr)
+ va_copy(args2, args);
+
+ if (log_syslog) {
+ switch (kind) {
+ case L_FATAL:
+ vsyslog(LOG_ERR, fmt, args);
+ break;
+ case L_ERROR:
+ vsyslog(LOG_ERR, fmt, args);
+ break;
+ case L_WARNING:
+ vsyslog(LOG_WARNING, fmt, args);
+ break;
+ case L_NOTICE:
+ vsyslog(LOG_NOTICE, fmt, args);
+ break;
+ default:
+ if (!log_stderr)
+ vsyslog(LOG_INFO, fmt, args);
+ break;
+ }