From 76e72abe329e7b36b88a8f939593d84b2ba00152 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 17 Feb 2011 15:52:39 +0100 Subject: LOGGING: Pass the log level down to the log target output function This will be required for mapping osmocore log levels to syslog priorities. --- src/logging.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/logging.c') diff --git a/src/logging.c b/src/logging.c index b3b5cb69..44528620 100644 --- a/src/logging.c +++ b/src/logging.c @@ -124,8 +124,8 @@ static const char* color(int subsys) } static void _output(struct log_target *target, unsigned int subsys, - char *file, int line, int cont, const char *format, - va_list ap) + unsigned int level, char *file, int line, int cont, + const char *format, va_list ap) { char col[30]; char sub[30]; @@ -167,7 +167,7 @@ static void _output(struct log_target *target, unsigned int subsys, snprintf(final, sizeof(final), "%s%s%s%s%s", col, tim, sub, buf, target->use_color ? "\033[0;m" : ""); final[sizeof(final)-1] = '\0'; - target->output(target, final); + target->output(target, level, final); } @@ -212,7 +212,7 @@ static void _logp(unsigned int subsys, int level, char *file, int line, * with the same va_list will segfault */ va_list bp; va_copy(bp, ap); - _output(tar, subsys, file, line, cont, format, bp); + _output(tar, subsys, level, file, line, cont, format, bp); va_end(bp); } } @@ -294,7 +294,8 @@ void log_set_category_filter(struct log_target *target, int category, target->categories[category].loglevel = level; } -static void _file_output(struct log_target *target, const char *log) +static void _file_output(struct log_target *target, unsigned int level, + const char *log) { fprintf(target->tgt_file.out, "%s", log); fflush(target->tgt_file.out); -- cgit v1.2.3