We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to use an env variable to filter log by level. For example, when I use LOG_LEVEL=error, I dont want to see log in level debug.
Provide a setup function like enable, so it does not read env var initially, but user can pass env var to it
enable
No response
The text was updated successfully, but these errors were encountered:
Hi, thanks for the issue! 👋
Wondering, would something like this work for you?
// file: logger.ts import { defaultReporter, _diary } from 'diary'; import { compare } from 'diary/utils'; export const diary = (name: string) => _diary(name, event => { if (compare(event.level, process.env.LOG_LEVEL) return defaultReporter(event); });
alternatively, leave it with me! Ill have to have a think about a possible api.
Sorry, something went wrong.
Hey thanks for coming back, and I think that would work. But I notice that defaultReporter is not exported from diary, only default_reporter?
defaultReporter
diary
default_reporter
And yes it would be better if there is a dedicate API that only requires user to change a property to affect which log level to use
No branches or pull requests
Is this feature in relation to a problem?
I want to use an env variable to filter log by level. For example, when I use LOG_LEVEL=error, I dont want to see log in level debug.
Describe the solution you'd like
Provide a setup function like
enable
, so it does not read env var initially, but user can pass env var to itAlternative
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: