UNPKG

ern-api-gen

Version:

Electrode Native API generator

72 lines 2.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* tslint:disable:object-literal-sort-keys */ exports.LEVELS = { EMERGENCY: 0, ALERT: 1, CRITICAL: 2, ERROR: 3, WARN: 4, NOTICE: 5, INFO: 6, DEBUG: 7, }; exports.CONFIG = { LEVEL: exports.LEVELS.DEBUG, console, }; function makeLogger(pre = '') { const prefix = pre ? `${pre}:` : ''; return { trace(e) { exports.CONFIG.console.log(prefix, 'tracing'); exports.CONFIG.console.trace(e); }, log(...args) { exports.CONFIG.console.log(prefix, ...args); }, emergency(...args) { if (exports.CONFIG.LEVEL <= exports.LEVELS.ALERT) { exports.CONFIG.console.error(prefix, ...args); } }, alert(...args) { if (exports.CONFIG.LEVEL <= exports.LEVELS.ALERT) { exports.CONFIG.console.error(prefix, ...args); } }, critical(...args) { if (exports.CONFIG.LEVEL <= exports.LEVELS.CRITICAL) { exports.CONFIG.console.error(prefix, ...args); } }, error(...args) { if (exports.CONFIG.LEVEL <= exports.LEVELS.ERROR) { exports.CONFIG.console.error(prefix, ...args); } }, warn(...args) { if (exports.CONFIG.LEVEL <= exports.LEVELS.WARN) { exports.CONFIG.console.error(prefix, ...args); } }, notice(...args) { if (exports.CONFIG.LEVEL <= exports.LEVELS.NOTICE) { exports.CONFIG.console.log(prefix, ...args); } }, info(...args) { if (exports.CONFIG.LEVEL <= exports.LEVELS.INFO) { exports.CONFIG.console.log(prefix, ...args); } }, debug(...args) { if (exports.CONFIG.LEVEL <= exports.LEVELS.DEBUG) { exports.CONFIG.console.log(prefix, ...args); } }, }; } exports.makeLogger = makeLogger; exports.default = makeLogger(); //# sourceMappingURL=Logger.js.map