Skip to content

Dynamic Log Levels#148

Merged
rosston merged 1 commit intobithavoc:masterfrom
CryptArchy:dynamic-level
Apr 27, 2017
Merged

Dynamic Log Levels#148
rosston merged 1 commit intobithavoc:masterfrom
CryptArchy:dynamic-level

Conversation

@CryptArchy
Copy link
Copy Markdown
Contributor

Allow options.level to be a function for dynamic level setting.

A project I am working on requires the ability to dynamically set the log level based on deeper inspection of the request and response. I added unit tests based on the existing ones, and everything is passing. I tried to set sane defaults and checks that should preserve the existing behavior of the middleware with options.level set to a string or object. Only setting it to a function should behave differently, and that wasn't a valid option before.

@rosston
Copy link
Copy Markdown
Collaborator

rosston commented Apr 24, 2017

@CryptArchy Sorry, only just now looking at this. Thanks for contributing (with tests)!

This all looks good to me. If you could just update the docs to mention the function usage of level, I'd be happy to merge it.

@CryptArchy
Copy link
Copy Markdown
Contributor Author

@rosston Thanks for the review! I totally forgot about updating the documentation, but I got you covered now! Let me know if anything else needs to be adjusted.

@rosston rosston merged commit 3a9d78a into bithavoc:master Apr 27, 2017
@rosston
Copy link
Copy Markdown
Collaborator

rosston commented Apr 27, 2017

Perfect. Your clarifying comment on statusLevels is a welcome bonus!

Released in 2.4.0. Thank you @CryptArchy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants