Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] add support for logger.add() function #1

Open
jenskdsgn opened this issue Jun 20, 2016 · 2 comments
Open

[feature request] add support for logger.add() function #1

jenskdsgn opened this issue Jun 20, 2016 · 2 comments

Comments

@jenskdsgn
Copy link

Right now this is the way to init the transports

var logger = new (winston.Logger)({
  transports: [
    /* ... */
  ]
});

It would be nice to use it with the add function of winston logger

logger.add(ddTransport, { /* options */ });

This could be useful if conditionally add logger or adding logger later as required ...
Thanks

@meznaric
Copy link

You can do:

const ddTransport = new DatadogTransport({
  api_key: 'xx',
  app_key: 'yy'
});

winston.add(ddTransport, null, true);

Last parameter indicates that transport has already been instantiated.

@anselanza
Copy link

Yeah I had the same question. Suggestion above worked for me.

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

No branches or pull requests

4 participants