Closed ghost closed 5 years ago
@flosch-hb That would be the correct way to handle it, yes. Since this package is not built using the same ideas of other logging packages, such as winston, there is currently no option to only log to a certain level. I do like the idea of adding it as a feature sometime in the near future, it will, of course, require some major underlying changes similar to your example in which I'm not sure is fully beneficial as a whole.
Long story short, what you wrote is the way I'd handle the same thing in one of my applications if I needed the same. I'll continue to look into a type of feature that could handle something like this for a future version.
I am completely fine with that approach, I tested it and it works, that is all I need :)
Having the ability to easily set minimum log level for a given environment seems key. Otherwise this logger looks nice.
Hello, nice package, thanks for it :)
I have a small question regarding log level management in AWS, and what would be the best approach to manage those.
I work in a 3-stages project ("dev", "staging" and "production") with AWS Lambda. I would like the "dev" stage to be the most verbose, and increase the level for the other ones. (e.g. perhaps "info" for "staging" and "warn" for "production", to be defined)
The deployment of node.js handlers is done via serverless framework where I can use environment parameters.
I was thinking to set-up a custom parameter called for instance
log-level
that would become the minimal level you wish to log (default to "debug")...But how to reflect that with this package, should I write my own instance of
LambdaLog
programatically disabling some levels based on it:Or is there another way to do so?