Restrict/Filter logs by namespace and level #174
-
Hi. Great work on this library. I have one question. Is there a way to define the least severe level that will be rendered for a specific namespace? Let's say I have:
What would be the best way to accomplish this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @tiagobnobrega, great question. If you take a look at the documentation for the So, instead of setting global configuration with the export const logA = adze.namespace('nsA').seal({ activeLevel: 'debug' });
export const logB = adze.namespace('nsB').seal({ activeLevel: 'warn' }); Keep in mind that the I hope this helps! |
Beta Was this translation helpful? Give feedback.
Hey @tiagobnobrega, great question.
If you take a look at the documentation for the
seal()
modifier, you should see that it accepts a UserConfiguration value as a parameter (https://adzejs.com/reference/terminators.html#seal). Also, if you take a look at the UserConfiguration documentation, you should see that it accepts anactiveLevel
property (https://adzejs.com/reference/configuration.html#user-configuration).So, instead of setting global configuration with the
setup()
function, rather provide specific configurations to each child logger in theseal()
terminator.