aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/logging.h
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 /include/osmocom/core/logging.h
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 'include/osmocom/core/logging.h')
-rw-r--r--include/osmocom/core/logging.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 3da9d33..581ebce 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -207,13 +207,29 @@ struct log_target {
};
/*! \brief call-back function to be called when the logging framework
- * wants to log somethnig.
+ * wants to log a fully formatted string
* \param[in] target logging target
* \param[in] level log level of currnet message
* \param[in] string the string that is to be written to the log
*/
void (*output) (struct log_target *target, unsigned int level,
const char *string);
+
+ /*! \brief alternative call-back function to which the logging
+ * framework passes the unfortmatted input arguments,
+ * i.e. bypassing the internal string formatter
+ * \param[in] target logging target
+ * \param[in] subsys logging sub-system
+ * \param[in] level logging level
+ * \param[in] file soure code file name
+ * \param[in] line source code file line number
+ * \param[in] cont continuation of previous statement?
+ * \param[in] format format string
+ * \param[in] ap vararg list of printf arguments
+ */
+ void (*raw_output)(struct log_target *target, int subsys,
+ unsigned int level, const char *file, int line,
+ int cont, const char *format, va_list ap);
};
/* use the above macros */