aboutsummaryrefslogtreecommitdiffstats
path: root/src/logging.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-12-02 13:52:59 +0100
committerHarald Welte <laforge@gnumonks.org>2016-12-02 13:52:59 +0100
commitd7c0a373ff38b28a14fd7ee1cc6be3cfbddbd850 (patch)
tree849dbab3cbbda0168ff0e22974dbea0ba966059d /src/logging.c
parent909cbecbb9d3223b3b372849564600bb9be7fbda (diff)
logging: Extend log_target with call-back for un-formatted log line
Some targets might not want to receive only an opaque, pre-formatted string, but rather the unformatted arguments with metadata like sub-system/level/file/line. We solve this by introducing a log_target->output_raw() function pointer. If a target specifies this function, it takes precedence over the regular log_target->output() function. Change-Id: I9dc9205d70dce9581458e7e9dc2d8a92991897bd
Diffstat (limited to 'src/logging.c')
-rw-r--r--src/logging.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/logging.c b/src/logging.c
index 9e30d5f8..165d8229 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -385,7 +385,10 @@ void osmo_vlogp(int subsys, int level, const char *file, int line,
* in undefined state. Since _output uses vsnprintf and it may
* be called several times, we have to pass a copy of ap. */
va_copy(bp, ap);
- _output(tar, subsys, level, file, line, cont, format, bp);
+ if (tar->raw_output)
+ tar->raw_output(tar, subsys, level, file, line, cont, format, bp);
+ else
+ _output(tar, subsys, level, file, line, cont, format, bp);
va_end(bp);
}
}