Created
February 28, 2019 20:55
-
-
Save aigoncharov/a9345758abbeb3d02680dbc330ff8836 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 pino = require('pino') | |
const logger = pino() | |
const loggerCls = new Proxy(logger, { | |
get(target, property, receiver) { | |
// Fallback to our original logger if there is no child logger in CLS | |
target = clsNamespace.get('loggerCls') || target | |
return Reflect.get(target, property, receiver) | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment