aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-02-17 15:52:39 +0100
committerHarald Welte <laforge@gnumonks.org>2011-02-17 15:52:39 +0100
commit76e72abe329e7b36b88a8f939593d84b2ba00152 (patch)
treefe8aba61dadbaf111a22cb5ba48451747c473326
parent76681bafa8013f3dac2a6b66841720e8fc78d76d (diff)
LOGGING: Pass the log level down to the log target output function
This will be required for mapping osmocore log levels to syslog priorities.
-rw-r--r--include/osmocore/logging.h3
-rw-r--r--src/logging.c11
-rw-r--r--src/vty/logging_vty.c3
3 files changed, 10 insertions, 7 deletions
diff --git a/include/osmocore/logging.h b/include/osmocore/logging.h
index 27e77341..5b780a34 100644
--- a/include/osmocore/logging.h
+++ b/include/osmocore/logging.h
@@ -95,7 +95,8 @@ struct log_target {
} tgt_vty;
};
- void (*output) (struct log_target *target, const char *string);
+ void (*output) (struct log_target *target, unsigned int level,
+ const char *string);
};
/* use the above macros */
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);
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index ea58887a..55882a77 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -35,7 +35,8 @@
extern const struct log_info *osmo_log_info;
-static void _vty_output(struct log_target *tgt, const char *line)
+static void _vty_output(struct log_target *tgt,
+ unsigned int level, const char *line)
{
struct vty *vty = tgt->tgt_vty.vty;
vty_out(vty, "%s", line);