feat: Remove mandatory Winston dependency, accept optional logger via… - #60
Open
jeffrson wants to merge 1 commit into
Open
feat: Remove mandatory Winston dependency, accept optional logger via…#60jeffrson wants to merge 1 commit into
jeffrson wants to merge 1 commit into
Conversation
… dependency injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… dependency injection
PR #31 replaced one fixed dependency with another - now every user of dmxnet is forced to use winston with the integrated configuration (yes, the configuration may be overridden, but this would often involve duplicated code for logger configuration).
For libs like this it's better to be independent of the actual logger used in applications. The PR tries to address this issue. It provides a best-practice interface that's compatible with the most widely used loggers like pino, winston, console and others.
By default it uses a no-op-logger so remains silent without configuration (which is good).
For migration one has to provide a logger instance. When you previously had
log: { level: 'debug' }(or nothing explicitely), it's nowlogger: myLogger.Note: the PR left out changes to package-log.json (format update, winston removal). Please run
npm install.This would fix: #18 and make #19 obsolete (and obviously #31).