UNPKG

@villedemontreal/correlation-id

Version:

Express middleware to set a correlation in Express. The correlation id will be consistent across async calls within the handling of a request.

33 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.init = init; exports.isInited = isInited; const configs_1 = require("./configs"); let libIsInited = false; /** * Inits the library. */ function init(loggerCreator) { if (!loggerCreator) { throw new Error(`The Logger Creator is required.`); } configs_1.configs.setLoggerCreator(loggerCreator); // ========================================== // Set as being "properly initialized". // At the very end of the "init()" function! // ========================================== libIsInited = true; } /** * Is the library properly initialized? * * This function MUST be named "isInited()"! * Code using this library may loop over all its "@villemontreal" * dependencies and, if one of those exports a "isInited" fonction, * it will enforce that the lib has been properly initialized before * starting... */ function isInited() { return libIsInited; } //# sourceMappingURL=init.js.map