mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 12:20:12 +00:00
automerge commit
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@42207 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
34
logger.c
34
logger.c
@@ -305,6 +305,7 @@ static void init_logger_chain(void)
|
|||||||
ast_mutex_unlock(&loglock);
|
ast_mutex_unlock(&loglock);
|
||||||
|
|
||||||
global_logmask = 0;
|
global_logmask = 0;
|
||||||
|
errno = 0;
|
||||||
/* close syslog */
|
/* close syslog */
|
||||||
closelog();
|
closelog();
|
||||||
|
|
||||||
@@ -312,7 +313,10 @@ static void init_logger_chain(void)
|
|||||||
|
|
||||||
/* If no config file, we're fine, set default options. */
|
/* If no config file, we're fine, set default options. */
|
||||||
if (!cfg) {
|
if (!cfg) {
|
||||||
fprintf(stderr, "Unable to open logger.conf: %s\n", strerror(errno));
|
if (errno)
|
||||||
|
fprintf(stderr, "Unable to open logger.conf: %s; default settings will be used.\n", strerror(errno));
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Errors detected in logger.conf: see above; default settings will be used.\n");
|
||||||
chan = malloc(sizeof(struct logchannel));
|
chan = malloc(sizeof(struct logchannel));
|
||||||
memset(chan, 0, sizeof(struct logchannel));
|
memset(chan, 0, sizeof(struct logchannel));
|
||||||
chan->type = LOGTYPE_CONSOLE;
|
chan->type = LOGTYPE_CONSOLE;
|
||||||
@@ -696,6 +700,21 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
|||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
if (!logchannels)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* we don't have the logger chain configured yet,
|
||||||
|
* so just log to stdout
|
||||||
|
*/
|
||||||
|
if (level != __LOG_VERBOSE) {
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
fputs(buf, stdout);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* don't display LOG_DEBUG messages unless option_verbose _or_ option_debug
|
/* don't display LOG_DEBUG messages unless option_verbose _or_ option_debug
|
||||||
are non-zero; LOG_DEBUG messages can still be displayed if option_debug
|
are non-zero; LOG_DEBUG messages can still be displayed if option_debug
|
||||||
is zero, if option_verbose is non-zero (this allows for 'level zero'
|
is zero, if option_verbose is non-zero (this allows for 'level zero'
|
||||||
@@ -733,7 +752,6 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logchannels) {
|
|
||||||
chan = logchannels;
|
chan = logchannels;
|
||||||
while(chan && !chan->disabled) {
|
while(chan && !chan->disabled) {
|
||||||
/* Check syslog channels */
|
/* Check syslog channels */
|
||||||
@@ -788,18 +806,6 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
|||||||
}
|
}
|
||||||
chan = chan->next;
|
chan = chan->next;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* we don't have the logger chain configured yet,
|
|
||||||
* so just log to stdout
|
|
||||||
*/
|
|
||||||
if (level != __LOG_VERBOSE) {
|
|
||||||
va_start(ap, fmt);
|
|
||||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
fputs(buf, stdout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ast_mutex_unlock(&loglock);
|
ast_mutex_unlock(&loglock);
|
||||||
/* end critical section */
|
/* end critical section */
|
||||||
|
Reference in New Issue
Block a user