UNPKG

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

16 lines (15 loc) 486 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setOnLog = void 0; var common_1 = require("./common"); /** * Adds a key-value pair to the current active log context * @param {string} key * @param {string | number | boolean | Date} value */ var setOnLog = function (key, value) { var session = (0, common_1._getSessionOrFail)(); session.set(key, value); (0, common_1._setPropKeyHistory)(session, key); }; exports.setOnLog = setOnLog;