log: change comptime log to .debug and add runtime filtering #2539
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, .debug log messages were filtered out at comptime. While nice from a binary size and performance (more on that later) point of view, this meant that a user couldn't specify
--log-debug
or similar and would need a new binary to get debug logging.Make it so that we do runtime log filtering instead. The performance penalty for this was negligible in testing; both microbenchmarks and the actual benchmark.
The one downside is binary bloat: this increases the size of a release build by ~300KiB.
To use, specify
--log-debug --experimental
on the CLI when starting a replica.--log-debug
instead of--log=...
because I feel we don't want to allow levels quieter than.info
in any case.It's currently only supported for
start
. Scaffolding for clients is there too, with filtering of the messages before they cross FFI and requiring an additional flag to be set. Actually setting this flag from any client libraries is still unimplemented - but this makes it no harder than before to change client logging (edit code & recompile).Things like the VOPR and fuzzers use their own way of setting logging, and are unaffected.