UNPKG

1.35 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.debug = exports.info = exports.warn = exports.configure = exports.level = exports.LEVEL_SILLY = exports.LEVEL_VERBOSE = exports.LEVEL_INFO = exports.Level = void 0;
4var Level;
5(function (Level) {
6 Level[Level["WARN"] = -1] = "WARN";
7 Level[Level["QUIET"] = 0] = "QUIET";
8 Level[Level["INFO"] = 1] = "INFO";
9 Level[Level["VERBOSE"] = 2] = "VERBOSE";
10 Level[Level["SILLY"] = 3] = "SILLY";
11})(Level = exports.Level || (exports.Level = {}));
12exports.LEVEL_INFO = Level.INFO;
13exports.LEVEL_VERBOSE = Level.VERBOSE;
14exports.LEVEL_SILLY = Level.SILLY;
15/** The minimal logging level for messages to be emitted. */
16exports.level = Level.QUIET;
17function configure({ level: newLevel }) {
18 exports.level = newLevel;
19}
20exports.configure = configure;
21function warn(fmt, ...args) {
22 log(Level.WARN, fmt, ...args);
23}
24exports.warn = warn;
25function info(fmt, ...args) {
26 log(Level.INFO, fmt, ...args);
27}
28exports.info = info;
29function debug(fmt, ...args) {
30 log(Level.VERBOSE, fmt, ...args);
31}
32exports.debug = debug;
33function log(messageLevel, fmt, ...args) {
34 if (exports.level >= messageLevel) {
35 const levelName = Level[messageLevel];
36 console.error(`[jsii-pacmak] [${levelName}]`, fmt, ...args);
37 }
38}
39//# sourceMappingURL=logging.js.map
\No newline at end of file