provide convenience function get_log_level()

pull/101/head
Richard Fuchs 11 years ago
parent 9a2da87f13
commit a81588e313

@ -96,7 +96,7 @@ void ilog(int prio, const char *fmt, ...) {
#ifndef __DEBUG
int level; /* thank you C99 */
level = g_atomic_int_get(&log_level);
level = get_log_level();
if (xprio > LOG_LEVEL_MASK(level))
return;
if ((level & LOG_FLAG_RESTORE) && !(prio & LOG_FLAG_RESTORE))

@ -79,6 +79,9 @@ INLINE void log_info_stream_fd(struct stream_fd *sfd) {
log_info.e = LOG_INFO_STREAM_FD;
log_info.u.stream_fd = __obj_get((void *) sfd);
}
INLINE int get_log_level(void) {
return g_atomic_int_get(&log_level);
}

@ -135,19 +135,19 @@ static void sighandler(gpointer x) {
if (ret == SIGINT || ret == SIGTERM)
global_shutdown = 1;
else if (ret == SIGUSR1) {
if (g_atomic_int_get(&log_level) > 0) {
if (get_log_level() > 0) {
g_atomic_int_add(&log_level, -1);
setlogmask(LOG_UPTO(g_atomic_int_get(&log_level)));
ilog(g_atomic_int_get(&log_level), "Set log level to %d\n",
g_atomic_int_get(&log_level));
setlogmask(LOG_UPTO(get_log_level()));
ilog(get_log_level(), "Set log level to %d\n",
get_log_level());
}
}
else if (ret == SIGUSR2) {
if (g_atomic_int_get(&log_level) < 7) {
if (get_log_level() < 7) {
g_atomic_int_add(&log_level, 1);
setlogmask(LOG_UPTO(g_atomic_int_get(&log_level)));
ilog(g_atomic_int_get(&log_level), "Set log level to %d\n",
g_atomic_int_get(&log_level));
setlogmask(LOG_UPTO(get_log_level()));
ilog(get_log_level(), "Set log level to %d\n",
get_log_level());
}
}
else

Loading…
Cancel
Save