-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add namespace-specific levels support to logger #22619
Conversation
f1e4b20
to
c6ae45f
Compare
@sjorge This, in combination with the debug-level regex should provide good customization for the logs. Let me know if you have any suggestions. With a bit of refactoring on the logger, and the fact this only looks up levels by key (namespace), it ends up way faster than the old calls in "filtered" scenario (noop), and about the same performance for "not filtered" scenario, so I think we're good on that end. |
<3
I started using this when that got implemented, it's working well for my needs. (I still have most info I care about and I can easily restart z2m when I need the info I filter out) I'll try the other way when this gets added though, as I do indeed filter out 2 namespaces and nothing else. Also I think your example in the PR comment is wrong? Looking at the diff should it not be: advanced:
log_namespaced_levels:
'z2m:mqtt': warning
'zh:ember:uart:ash': info |
Good catch, forgot a step on the ladder! The MQTT publish stuff is really dividing, between users who seem to use it all the time, and users who had gone to |
looks promising, thank you guys ! |
As many, I miss MQTT messages in logs and it seems this new namespaces filtering can bring best of two world. Anyway I wonder why we do not use "Notice" level because "Info" level should represent normal messages for current operations (like MQTT ones) and "Notice" only relevant ones. I mean that we could put back MQTT messages in "info" level and put actual "info" level in "notice". This way it is easy to choose which log level is needed quickly. Note that advanced namespaces filtering is really a good stuff too and it can be complementary with a notice level especially to debug a particular topic. As it is filtering it should be use as advanced log configuration. So to sum up, I propose this:
|
Adds the ability to alter levels for specific namespaces.
Also:
info
level and addz2m:mqtt
namespace for whole MQTT class, to allow changing the level for that namespace specificallywarn
forwarning
(with automatic remap ifwarn
still used in config) to match syslog levels usedjson
option from File Transport, not supported (stale value?)Example use:
TODO