Skip to content

Conversation

@martinsumner
Copy link

  • 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

  • Updates post review

  • Remove unused get_log

Code uses get_loglevel/1


* 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
Copy link
Author

Reviewed in - martinsumner#483

@martinsumner martinsumner merged commit ac878ac into openriak-3.4 Nov 19, 2025
2 checks passed
@martinsumner martinsumner deleted the nhse-o34-upstream.pr483 branch November 19, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants