Rework syslogging
This commit is contained in:
+10
-5
@@ -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);
|
||||
|
||||
|
||||
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(!args->raw) {
|
||||
int rc;
|
||||
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:
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user