Created
February 28, 2019 20:55
-
-
Save aigoncharov/d41129cbbad03beec1ebbd1b3670b34e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const { createLogger, format, transports } = require('winston') | |
const addTraceId = printf((info) => { | |
let message = info.message | |
const traceID = clsNamespace.get('taceID') | |
if (traceID) { | |
message = `[TraceID: ${traceID}]: ${message}` | |
} | |
return message | |
}) | |
const logger = createLogger({ | |
format: addTraceId, | |
transports: [new transports.Console()], | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Typo -
taceID
should betraceID
on line 5