Closed nwah closed 8 years ago
Sorry for no reply on this yet! First, thanks for the clean diff and tests!
My initial thought here was that the function-specific options should merge with the default ones rather than overwrite, but I think I've come around. If a user ever wants to combine the two, they can simply do a concat
.
I'll give this a more thorough review in the next day or so, but I think it'll get merged pending some minor work.
Yep, merging was my first instinct too, but then I realized that'd make it impossible to remove some of the defaults without just modifying the shared list.
The way I ended up doing it, if you really want to merge them you can manually do something like this (even if it is a little clunky):
expressWinston.logger({
requestWhitelist: expressWinston.requestWhitelist.concat(['some', 'others'])
});
Looks good to me. Can you just add some documentation to the readme? I think it would be good enough to simply add them to the Options section for each middleware function. After that, I'll be happy to merge this.
@rosston Cool, just updated the README to list the options.
Merged! I'm going to work on and close out #92 and then I'll push a new release.
Published in v1.3.0.
This PR adds support for passing any any of the whitelists/blacklists as options to
expressWinston.logger()
andexpressWinston.errorLogger()
.It leaves the global arrays intact, but I've prefixed the variable names with "global" to make things less ambiguous / avoid variable naming clashes in the code where they're used.
New options are:
At our (fairly large) company we're working on common logger that anyone can/should use in their node apps, and we'd like to base it on express-winston. But, theoretically one of those people may use express-winston as well, and could silently break our common logger by modifying these whitelists globally, which makes it a no-go for us. The changes in the PR would fix this for us.
What do you think? Thanks! —Noah