chan->type = LOGTYPE_SYSLOG;
ast_copy_string(chan->filename, channel, sizeof(chan->filename));
- openlog("asterisk", LOG_PID, chan->facility);
} else {
const char *log_dir_prefix = "";
const char *log_dir_separator = "";
.sa_flags = SA_RESTART,
};
-static void ast_log_vsyslog(struct logmsg *msg)
+static void ast_log_vsyslog(struct logmsg *msg, int facility)
{
char buf[BUFSIZ];
int syslog_level = ast_syslog_priority_from_loglevel(msg->level);
return;
}
+ syslog_level = LOG_MAKEPRI(facility, syslog_level);
+
snprintf(buf, sizeof(buf), "%s[%d]%s: %s:%d in %s: %s",
levels[msg->level], msg->lwp, call_identifier_str, msg->file, msg->line, msg->function, msg->message);
/* Check syslog channels */
if (chan->type == LOGTYPE_SYSLOG && (chan->logmask & (1 << logmsg->level))) {
- ast_log_vsyslog(logmsg);
+ ast_log_vsyslog(logmsg, chan->facility);
/* Console channels */
} else if (chan->type == LOGTYPE_CONSOLE && (chan->logmask & (1 << logmsg->level))) {
char linestr[128];