Attention is currently required from: Hoernchen.
Patch set 1:Code-Review -2
2 comments:
File include/osmocom/core/logging.h:
Patch Set #1, Line 64: if (log_check_level(ss, level)) \
it is a hugely important performance decision to do log_check_level() in the macro, *before* passing the varargs to logp2(). That is the entire point why log_check_level() was introduced in this way: if no logging target will print this log message, we can skip all of the string composition for the log message entirely.
For example, in this:
LOGP(DMAIN, LOGL_DEBUG, "data: %s\n", osmo_hexdump(data, len));
we skip calling osmo_hexdump() when DMAIN's DEBUG is not enabled anywhere.
With your code changes, we would first call osmo_hexdump(), pass the result to logp2_with_check(), and only then discard the log message. That would be a massive performance dip for loaded sites where DEBUG logging is switched off.
Now, because log_check_level() is called first, we need to check whether logging was initialized and redirect to logp_stub() even before that -- log_check_level() just aborts the program, with assert(osmo_log_info)
File src/logging.c:
Patch Set #1, Line 87: struct log_info *osmo_log_info;
(undoing part of earlier patch)
To view, visit change 30610. To unsubscribe, or for help writing mail filters, visit settings.