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

Fix logging when level is set on the logger, but no level is set on tranports #253

Closed
wants to merge 1 commit into from

Conversation

jstamerj
Copy link
Contributor

Example code:

    var winston = require('winston');
    var logger = new winston.Logger({
      level: 'warn',
      transports: [new winston.transports.Console()]
    });
    logger.info('should not see this');
    logger.warn('should see this');

Expected output:

    should see this

Actual output:

    should not see this
    should see this

Reason: transport.js sets a default level of 'Info' when no level option is set on a transport. logger.js always uses the transport level (when set) instead of using the level set on the logger. Since a level is always set on every transport, the logger's level is never used.

I changed transport.js so that it does not set a default value for this.level. This fixes the issue.

@indexzero
Copy link
Member

This is totally correct, but it is breaking and will go into [email protected]

@indexzero
Copy link
Member

Cherry-picked. Thanks! Will go into [email protected] which will come out shortly.

@indexzero indexzero closed this Apr 7, 2015
@FGRibreau
Copy link

Now that's better! Thanks @jstamerj @indexzero!

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

Successfully merging this pull request may close these issues.

3 participants