forked from winstonjs/winston
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document the solution to winstonjs#1486. (winstonjs#1554)
* [doc] Document the solution to winstonjs#1486. * [doc] Show both in example. * [doc] Update the examples.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const winston = require('../'); | ||
|
||
const loggers = { | ||
splat: winston.createLogger({ | ||
level: 'info', | ||
format: winston.format.combine( | ||
winston.format.splat(), | ||
winston.format.simple() | ||
), | ||
transports: [new winston.transports.Console()], | ||
}), | ||
simple: winston.createLogger({ | ||
level: 'info', | ||
format: winston.format.simple(), | ||
transports: [new winston.transports.Console()], | ||
}) | ||
}; | ||
|
||
const meta = { | ||
subject: 'Hello, World!', | ||
message: 'This message is a unique property separate from implicit merging.', | ||
}; | ||
|
||
loggers.simple.info('email.message is hidden', meta); | ||
loggers.simple.info('email.message is hidden %j\n', meta); | ||
|
||
loggers.splat.info('This is overridden by meta', meta); | ||
loggers.splat.info('email.message is shown %j', meta); |