logmessage-cls-hooked
Version:
A LogRoot Method Decorator that uses cls-hooked to handle and propagate log message details between different methods deeper in the callstack, removing the need to propagate a paremeter just for logging purposes
15 lines (14 loc) • 579 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.initLogMessageCls = void 0;
var cls_hooked_1 = require("cls-hooked");
var constants_1 = require("./constants");
/**
* You must call this function only ONCE. It's used to create
* a namespace in the Node CLS. That's mandatory to your log
* contexts to work properly
*/
var initLogMessageCls = function () {
return (0, cls_hooked_1.getNamespace)(constants_1.NAMESPACE_KEY) || (0, cls_hooked_1.createNamespace)(constants_1.NAMESPACE_KEY);
};
exports.initLogMessageCls = initLogMessageCls;
;