diff --git a/src/ucore_logging.c b/src/ucore_logging.c index c019fb5..8d16dc1 100644 --- a/src/ucore_logging.c +++ b/src/ucore_logging.c @@ -347,19 +347,19 @@ static inline void uc_vlog_syslog(const struct uc_log_args *args, const char *fm int pri = uc_ll_2_syslog(args->log_level); - //go via a buffer as we must do just 1 syslog call - char buf[4096]; - int offset = 0; - buf[0] = 0; if(!args->raw) { + //go via a buffer as we must do just 1 syslog call + char buf[4096]; + int offset = 0; int rc; + + buf[0] = 0; if(dest->log_location) { rc = snprintf(buf, sizeof buf, "%s:%d ", args->file, args->line); if(rc < 0) goto log; offset += rc; - } rc = snprintf(&buf[offset], sizeof buf - (size_t)offset, "[%s] ", @@ -367,11 +367,16 @@ static inline void uc_vlog_syslog(const struct uc_log_args *args, const char *fm if(rc < 0) goto log; offset +=rc; - } - vsnprintf(&buf[offset], sizeof buf - (size_t)offset, fmt, ap); log: - syslog(pri, "%s", buf); + vsnprintf(&buf[offset], sizeof buf - (size_t)offset, fmt, ap); + syslog(pri, "%s", buf); + + } else { //raw logging + + vsyslog(pri, fmt, ap); + + } } void uc_logf(int log_level, int module, int raw,