aboutsummaryrefslogtreecommitdiffstats
path: root/src/logging.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/logging.c')
-rw-r--r--src/logging.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/logging.c b/src/logging.c
index 7db7101e..c8a16f80 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -345,13 +345,13 @@ static inline int check_log_to_target(struct log_target *tar, int subsys, int le
/*! \brief vararg version of logging function */
void osmo_vlogp(int subsys, int level, const char *file, int line,
- int cont, const char *format, va_list ap)
+ int cont, struct log_target *ini_tar, const char *format, va_list ap)
{
- struct log_target *tar;
+ struct log_target *tar = ini_tar;
subsys = map_subsys(subsys);
- llist_for_each_entry(tar, &osmo_log_target_list, entry) {
+ do {
int output = 0;
va_list bp;
@@ -375,27 +375,28 @@ void osmo_vlogp(int subsys, int level, const char *file, int line,
va_copy(bp, ap);
_output(tar, subsys, level, file, line, cont, format, bp);
va_end(bp);
- }
+ } while (tar->entry.next != &osmo_log_target_list && (tar = llist_entry(tar->entry.next, typeof(*tar), entry)));
}
/*! \brief logging function used by DEBUGP() macro */
void logp(int subsys, const char *file, int line, int cont,
- const char *format, ...)
+ struct log_target *ini_tar, const char *format, ...)
{
va_list ap;
va_start(ap, format);
- osmo_vlogp(subsys, LOGL_DEBUG, file, line, cont, format, ap);
+ osmo_vlogp(subsys, LOGL_DEBUG, file, line, cont, ini_tar, format, ap);
va_end(ap);
}
/*! \brief logging function used by LOGP() macro */
-void logp2(int subsys, unsigned int level, const char *file, int line, int cont, const char *format, ...)
+void logp2(int subsys, unsigned int level, const char *file, int line, int cont,
+ struct log_target *ini_tar, const char *format, ...)
{
va_list ap;
va_start(ap, format);
- osmo_vlogp(subsys, level, file, line, cont, format, ap);
+ osmo_vlogp(subsys, level, file, line, cont, ini_tar, format, ap);
va_end(ap);
}
@@ -884,7 +885,7 @@ int log_init(const struct log_info *inf, void *ctx)
/*! \brief Check whether a log entry will be generated.
* \returns != 0 if a log entry might get generated by at least one target */
-int log_check_level(int subsys, unsigned int level)
+int log_check_level(int subsys, unsigned int level, struct log_target **out_tar)
{
struct log_target *tar;
@@ -897,10 +898,12 @@ int log_check_level(int subsys, unsigned int level)
continue;
/* This might get logged (ignoring filters) */
+ *out_tar = tar;
return 1;
}
/* We are sure, that this will not be logged. */
+ *out_tar = NULL;
return 0;
}