Skip to content

feat: Remove mandatory Winston dependency, accept optional logger via… - #60

Open
jeffrson wants to merge 1 commit into
margau:masterfrom
jeffrson:logger-di
Open

feat: Remove mandatory Winston dependency, accept optional logger via…#60
jeffrson wants to merge 1 commit into
margau:masterfrom
jeffrson:logger-di

Conversation

@jeffrson

@jeffrson jeffrson commented May 24, 2026

Copy link
Copy Markdown

… 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 now logger: 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).

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.

lib will not work when used in a deamon/service

1 participant