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 removes a logger when pass undefined transport #1785

Merged
merged 1 commit into from
Apr 30, 2020

Conversation

arpit728
Copy link
Contributor

While working with winston, I found a small bug. When you pass undefined transport in logger.remove() method it removes the logger. Ideally it should not do anything.

You can follow below steps to reproduce this:

const logger = winston.createLogger({
    level: 'info',
    format: winston.format.simple(),
    timestamp: true,
    defaultMeta: { service: 'user-service', deploymentId: 'abcd', 'containerId': 'kube-5' },
});
const consoleLogger = new winston.transports.Console({
    format: winston.format.simple(),
    timestamp: true,
    level: 'debug',
    logId:'console'
});

logger.add(consoleLogger);

logger.info('Hello!'); // This statement logs perfectly

logger.remove(undefined);

logger.info('Hi'); //This statement logs nothing as the logger got removed.

@DABH DABH merged commit 75f7edf into winstonjs:master Apr 30, 2020
Mizumaki pushed a commit to Mizumaki/winston that referenced this pull request Jun 11, 2020
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.

2 participants