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

Add default metadata when calling log with string level and message #1712

Merged
merged 1 commit into from
Jul 11, 2020
Merged

Add default metadata when calling log with string level and message #1712

merged 1 commit into from
Jul 11, 2020

Conversation

txgruppi
Copy link
Contributor

@txgruppi txgruppi commented Oct 2, 2019

The problem

When calling logger.log with two string values it does not add the values from defaultMeta.

Before

const logger = winston.createLogger({
  defaultMeta: {testing: 'it works!'},
  transports: [new Console()],
});
logger.log('info', 'did it work?'); // {"level":"info","message":"did it work?"}

After

const logger = winston.createLogger({
  defaultMeta: {testing: 'it works!'},
  transports: [new Console()],
});
logger.log('info', 'did it work?'); // {"level":"info","message":"did it work?","testing":"it works!"}

@Dinuz
Copy link

Dinuz commented Nov 6, 2019

This should be push, it solves indeed the issue.

@alvinalexander
Copy link

alvinalexander commented Apr 10, 2020

Please merge this!

@DABH DABH merged commit 68ea786 into winstonjs:master Jul 11, 2020
@txgruppi txgruppi deleted the add-default-meta-to-string-msg branch July 15, 2020 11:04
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.

4 participants