Preserve logLevel for children of logger unless explicitly overridden. #1268
Replies: 2 comments 6 replies
-
Thanks for sharing this ideas to improve the utility! Curious to hear what others think about it. |
Beta Was this translation helpful? Give feedback.
-
Hello @codyfrisch A child logger should have exactly the same parent's attributes, except attributes specified during the creation of a child, they will be overwritten. After that, parents and children live separate lives and can't influence each other. For the first part of your question, this PR merged and fixed that. I think it is going to be available in the next release. But better ask @dreamorosi.
For the second part, I think you should describe it in detail and request a feature in the issues. Thank you for using Lambda PowerTools! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Right now, if I
.createChild({serviceName: "FancyService"})
the logLevel resets to default because it is not specified. I would think that when I create the first parent, if I set the logLevel to "DEBUG" that would persist to children unless explicitly overwritten with a different value.This way when I create an initial child after invocation, and getting the user profile (which includes a log level), this user loglevel will persist to any further children created where the service name may change.
Another concept is the ability to tell injectLambdaContext a key in the clientContext to check for loglevel. such as
context.clientContext.logLevel
as a string (I think?). Or evenevent.requestContext.authorizer.lambda.logLevel
. This way the authorizer (or client invoking the lambda) can set the loglevel.Any other strategies are welcome of course :)
Beta Was this translation helpful? Give feedback.
All reactions