Skip to content

Logging improvements

Simon Ser requested to merge github/fork/ascent12/logging into master

Created by: ascent12

Changes the logging to actually use the logging callback that the library user can set. It defaults to the current log function (what was _wlr_vlog). The output message for the default log function has changed slightly: it uses the ISO 8601 date format instead of a locale dependant one (but the time zone is still locale dependent). The filename is now relative to the wlroots directory instead of just the basename. We have multiple "backend.c"s, so this is to distinguish them.

This implementation uses preprocessor string concatenation, so we can't pass a non-string literal as the format string to the logging functions anymore, but I think that's fine. Passing a non-string literal would be a mistake, anyway.

There is also a static inline function inside the header. This is so that the compiler can optimise the offset calculation out, so it doesn't have to be recalculated every time a logging function is called. I've viewed the assembly output with optimisations enabled, and it does work.

Merge request reports