Switch to using domain filtering not log_type#483
Merged
Conversation
This looks like it is a more correct way of doing this. Given we have no agreed hierarchy as part of OpenRiak, will use [backend, leveled] as a start.
This was referenced Nov 8, 2025
The leveled_log code is not aligned well with the expectations of riak kernel logger. In particular log function calls were centralised, and so MFA metadata is irrelevant. This change implements the log function calls as a macro, so that the should_i_log logic cna be maintained, but MFA metadata will be correctly present in the log. It also ends the practice of adding the pid() directly to the log, instead relying on the metadata
Will be filtered by global and ?MODULE log filters. Outstanding code coverage issue caused by detecting `false` branch when macro is substituted over multiple lines.
code coverage is an issue with the switch to macros for logging. Not every log line will have a `false` from the log allow - and that will fail code coverage ... but only if the log covers multiple lines. Most logs covering multiple lines, do do needlessly. So avoid the code coverage issue by making those logs single line.
ThomasArts
reviewed
Nov 18, 2025
ThomasArts
approved these changes
Nov 18, 2025
Co-authored-by: Thomas Arts <thomas.arts@quviq.com>
Code uses get_loglevel/1
martinsumner
added a commit
to OpenRiak/leveled
that referenced
this pull request
Nov 19, 2025
* Switch to using domain filtering not log_type This looks like it is a more correct way of doing this. Given we have no agreed hierarchy as part of OpenRiak, will use [backend, leveled] as a start. * Align log format with Erlang standards The leveled_log code is not aligned well with the expectations of riak kernel logger. In particular log function calls were centralised, and so MFA metadata is irrelevant. This change implements the log function calls as a macro, so that the should_i_log logic cna be maintained, but MFA metadata will be correctly present in the log. It also ends the practice of adding the pid() directly to the log, instead relying on the metadata * Format via erlfmt * ensure logger:allow/2 is called Will be filtered by global and ?MODULE log filters. Outstanding code coverage issue caused by detecting `false` branch when macro is substituted over multiple lines. * Add missing space to logs with no db_id * Coverage code coverage is an issue with the switch to macros for logging. Not every log line will have a `false` from the log allow - and that will fail code coverage ... but only if the log covers multiple lines. Most logs covering multiple lines, do do needlessly. So avoid the code coverage issue by making those logs single line. * Update include/leveled.hrl Co-authored-by: Thomas Arts <thomas.arts@quviq.com> * Updates post review * Remove unused get_log Code uses get_loglevel/1 --------- Co-authored-by: Thomas Arts <thomas.arts@quviq.com>
martinsumner
added a commit
to OpenRiak/leveled
that referenced
this pull request
Nov 19, 2025
Switch to using domain filtering not log_type (martinsumner#483)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This looks like it is a more correct way of doing this.
Given we have no agreed hierarchy as part of OpenRiak, will use [backend, leveled] as a start.