Convert logging to use UC_SRC_LOCATION
This commit is contained in:
+7
-9
@@ -42,8 +42,7 @@ struct uc_log_args {
|
||||
struct uc_log_destination *dest;
|
||||
const struct uc_log_module *module;
|
||||
int log_level;
|
||||
const char *file;
|
||||
int line;
|
||||
const char *location;
|
||||
int raw;
|
||||
};
|
||||
|
||||
@@ -415,9 +414,9 @@ static inline void uc_vlog_file(const struct uc_log_args *args, const char *fmt,
|
||||
time_buf[sizeof time_buf -1] = 0;
|
||||
|
||||
if (dest->log_location) {
|
||||
fprintf(dest->type.file.file, "[%-7s] %s %s:%d [%s] : ",
|
||||
uc_ll_2_str(args->log_level), time_buf, args->file,
|
||||
args->line, args->module->short_name);
|
||||
fprintf(dest->type.file.file, "[%-7s] %s %s [%s] : ",
|
||||
uc_ll_2_str(args->log_level), time_buf,
|
||||
args->location, args->module->short_name);
|
||||
} else {
|
||||
fprintf(dest->type.file.file, "[%-7s] %s [%s]: ",
|
||||
uc_ll_2_str(args->log_level), time_buf, args->module->short_name);
|
||||
@@ -446,7 +445,7 @@ static inline void uc_vlog_syslog(const struct uc_log_args *args, const char *fm
|
||||
|
||||
buf[0] = 0;
|
||||
if (dest->log_location) {
|
||||
rc = snprintf(buf, sizeof buf, "%s:%d ", args->file, args->line);
|
||||
rc = snprintf(buf, sizeof buf, "%s ", args->location);
|
||||
if (rc < 0)
|
||||
goto log;
|
||||
offset += rc;
|
||||
@@ -543,7 +542,7 @@ void uc_log_destination_set_mask(
|
||||
}
|
||||
|
||||
void uc_logf(int log_level, int module, int raw,
|
||||
const char *file, int line, const char *fmt, ...)
|
||||
const char *location, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
struct uc_log_destination *dest;
|
||||
@@ -581,8 +580,7 @@ void uc_logf(int log_level, int module, int raw,
|
||||
.dest = dest,
|
||||
.module = log_module,
|
||||
.log_level = log_level,
|
||||
.file = file,
|
||||
.line = line,
|
||||
.location = location,
|
||||
.raw = raw
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user