-
Notifications
You must be signed in to change notification settings - Fork 211
add support for custom logger configuration #117
add support for custom logger configuration #117
Conversation
build failed on node 6 due to npm bug, see npm/npm#20553 for more info |
npm bug is fixed, i've reran the errored builds. |
I'm trying to do a similar thing with #104 . The advantage to your approach is that it gets around duplication of dependencies between The advantage to the approach in my PR is that it passes full control over the logger instance to the application embedding hypernova. The logger passed in would not even need to be a winston instance as long as it implements a I have a slight preference for injecting the dependency rather than passing through config, but I'm pretty indoctrinated by the Java side of the house. EDIT: Also I know that other logging PR has been languishing, it's actually on my list to address this week. |
const transportKeys = Object.keys(transportConfigs); | ||
|
||
return transportKeys.map(transportKey => | ||
new winston.transports[transportKey](transportConfigs[transportKey])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this work if I have a transport installed via a separate package, e.g. https://github.com/winstonjs/winston-syslog ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this only works for core winston transports (console, file, http). trying to import winston-syslog in the app and using it in the winston instance in hypernova seems a little brittle as well, so going forward with #104 it is
completely agree, giving full control over a logger instance seems better than introducing a new config format to enable the limited core winston functionality. Makes it less dependent on winston as well. |
Awesome! I'm merging #104 now and will cut a new release. Thanks for contributing! |
closing in favor of #104 |
Work in progress...
Warning This PR changes the logger config
example logger config to use in hypernova(config)