X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=ulog.c;h=66aad90298909b215a530c534ee0da02276a84dc;hp=f7c92d80fddd03880c51311164e70da5b4627111;hb=2b89f2169b83be17441835758a53782a41aef976;hpb=ca6d5472056ceee4b8ab320167e0ae8155a95985 diff --git a/ulog.c b/ulog.c index f7c92d8..66aad90 100644 --- a/ulog.c +++ b/ulog.c @@ -105,9 +105,6 @@ static void ulog_stdio(int priority, const char *fmt, va_list ap) { FILE *out = stderr; - if (priority == LOG_INFO || priority == LOG_NOTICE) - out = stdout; - if (_ulog_ident) fprintf(out, "%s: ", _ulog_ident); @@ -121,11 +118,24 @@ static void ulog_syslog(int priority, const char *fmt, va_list ap) void ulog_open(int channels, int facility, const char *ident) { + ulog_close(); + _ulog_channels = channels; _ulog_facility = facility; _ulog_ident = ident; } +void ulog_close(void) +{ + if (!_ulog_initialized) + return; + + if (_ulog_channels & ULOG_SYSLOG) + closelog(); + + _ulog_initialized = 0; +} + void ulog_threshold(int threshold) { _ulog_threshold = threshold;