-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: make log topics consistent with nim-chronicles style #1334
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1a4ce92
to
46dee2b
Compare
46dee2b
to
9c14d38
Compare
Jenkins BuildsClick to see older builds (4)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to having spaces instead of dots. Its used by nim-libp2p as you mention and also by nimbus
Not sure though if "4 levels" would be too much, i.e. waku node rest debug_api
. Neither nim-libp2p nor nimbus have that many. Perhaps 3 is enough? waku+protocol+extra?
wdyt?
Great PR! +1 for the change to spaces.
Perhaps I'm missing some use cases, but I'd also prefer less (say 3) rather than more levels if feasible. Even in the current coding guide I felt uncomfortable with the number of levels I was suggesting because it becomes a bit artificial. Suggestion would then be what @alrevuelta suggested, but where "protocol" could also mean logical subcomponent (such as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. Feel free to merge! We can document as is in the coding guide. My question above implies whether we want to use waku node
as a prefix for some logical components or just waku
, e.g. waku json_rpc
vs waku node json_rpc
but this is a minor detail IMO.
Nim chronicles' log topics should be understood as "log tags/labels" that you can filter by using one of the following options:
Said that. Setting a rule to limit the number of topics makes no sense to me. It is restricting our selves without any technical reason. When setting the log topics, we should be mindful as we are with using logging. We should not do it willy-nilly. |
Absolutely 👍🏼
If I understood it correctly, you are asking the reason behind the I am just following the modules structure. I mapped the And sincerely, currently, I am thinking of the possibility of moving |
I agree. No need to limit here. I meant more as a general rule of thumb in order for outside developers following the coding guide not to overdesign log scope levels, but rather think of practical log filter use cases. |
I have updated the coding guide to match the new style. Merging the present PR. |
It all started with me looking for a way to reduce the verbosity of the test cases in the CI. I hunch that test execution time is also impacted by the immense amount of logs the code is writing to the stdout.
Diving into
nim-chronicles
code, I noticed that the topics filtering mechanism works with "whole words" separated by spaces. Checking thenim-libp2p
code base, together with some tests passing the-d:"chronicles_disabled_topics=libp2p,pubsubprotobuf"
flag has confirmed it.NOTE: I also noticed that in some cases,
nim-chronicles
is not respecting thelogScope: topics = "<topics>"
statement, logging without thetopics
tags.Some of the rules in the coding guide might need to be updated to be compatible with
nim-chronicles
. These are the rules I have synthesized for better logging:snake_case
style.waku node message_store sqlite_store
)waku
module should havewaku
as the first topic. This will allow any user of waku (as a library) to mute all logs coming by filtering thewaku
topic. Thewhisper
module is the exception.wakunode2 rest
)waku filter client
)