bitwiseworks / libc

LIBC Next (kLIBC fork)
9 stars 4 forks source link

logstrict: Add a flag to ignore log groups when writing a log message #113

Closed dmik closed 3 years ago

dmik commented 3 years ago

This is needed for e.g. assertion messages, see https://github.com/bitwiseworks/libcx/issues/97 for more details, in particular:

__libc_LogAssert is hacky in a way that it ignores which log groups are enabled when doing its job. __libc_LogRaw we use now does not do such a thing so if the assertion happens in a module whose log group is disabled via LIBCX_TRACING. So, if the user has LIBCX_TRACING=-all, they will get nothing upon an assertion.

Since assertions are always fatal in LIBCx (and since they are pieces of critical information anyway), this definitely makes no sense. We should write them out regardless of whether the log group is enabled or not.

Ideally, there should be a LIBCn flag, something like __LIBC_LOG_MSGF_FORCE to ignore group checking but I may work around that w/o involving a LIBC release cycle by supplying a NULL group info struct which will have the same effect. We'll see.

dmik commented 3 years ago

__LIBC_LOG_MSGF_ALWAYS sounds like a better name, will use it.