UNPKG

541 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const cls = require("cls-hooked");
4const appClsNamespace = cls.createNamespace('InnotsApp');
5class ClsService {
6 static getTrace() {
7 return appClsNamespace.get(ClsService.MDC_KEY);
8 }
9 static setTrace(trace) {
10 appClsNamespace.set(ClsService.MDC_KEY, trace);
11 }
12 static async createCls(fn) {
13 return await appClsNamespace.runPromise(fn);
14 }
15}
16ClsService.MDC_KEY = 'mappedDiagnosticContext';
17exports.ClsService = ClsService;