logger4node
Advanced tools
Comparing version 0.0.10 to 0.0.12
@@ -1,2 +0,3 @@ | ||
import { Logger4Node, LogSeverity } from './src/logger4-node'; | ||
import { LogSeverity } from 'src/logger'; | ||
import { Logger4Node } from './src/logger4-node'; | ||
export { Logger4Node, LogSeverity }; |
{ | ||
"name": "logger4node", | ||
"version": "0.0.10", | ||
"version": "0.0.12", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,24 +0,6 @@ | ||
import { Debugger } from 'debug'; | ||
export declare const enum LogSeverity { | ||
VERBOSE = "verbose", | ||
INFO = "info", | ||
WARN = "warn", | ||
DEBUG = "debug", | ||
ERROR = "error" | ||
} | ||
import { Logger } from './logger'; | ||
export declare class Logger4Node { | ||
private static _ApplicationName; | ||
private static LOG_LEVEL_ENABLED; | ||
private readonly _debugLogger; | ||
static create(name: string): Logger4Node; | ||
static setApplicationName(applicationName: string): void; | ||
private static isLogEnabled; | ||
get debugLogger(): Debugger; | ||
verbose(formatter: unknown, ...args: Array<unknown>): void; | ||
info(formatter: unknown, ...args: Array<unknown>): void; | ||
warn(formatter: unknown, ...args: Array<unknown>): void; | ||
debug(formatter: unknown, ...args: Array<unknown>): void; | ||
error(formatter: unknown, ...args: Array<unknown>): void; | ||
log(logSeverity: LogSeverity, formatter: unknown, ...args: Array<unknown>): void; | ||
private constructor(); | ||
private readonly _applicationName; | ||
constructor(applicationName: string); | ||
instance(name: string): Logger; | ||
} |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Logger4Node = void 0; | ||
const debug_1 = __importDefault(require("debug")); | ||
const LogLevel = { | ||
verbose: 1, | ||
info: 2, | ||
warn: 3, | ||
debug: 4, | ||
error: 5, | ||
}; | ||
const logger_1 = require("./logger"); | ||
class Logger4Node { | ||
constructor(name) { | ||
this._debugLogger = debug_1.default(name); | ||
constructor(applicationName) { | ||
this._applicationName = applicationName; | ||
} | ||
static create(name) { | ||
return new Logger4Node(`${Logger4Node._ApplicationName}:${name}`); | ||
instance(name) { | ||
return new logger_1.Logger(`${this._applicationName}:${name}`); | ||
} | ||
static setApplicationName(applicationName) { | ||
Logger4Node._ApplicationName = applicationName; | ||
} | ||
static isLogEnabled(logSeverity) { | ||
return Logger4Node.LOG_LEVEL_ENABLED.includes(logSeverity); | ||
} | ||
get debugLogger() { | ||
return this._debugLogger; | ||
} | ||
verbose(formatter, ...args) { | ||
this.log("verbose" /* VERBOSE */, formatter, ...args); | ||
} | ||
info(formatter, ...args) { | ||
this.log("info" /* INFO */, formatter, ...args); | ||
} | ||
warn(formatter, ...args) { | ||
this.log("warn" /* WARN */, formatter, ...args); | ||
} | ||
debug(formatter, ...args) { | ||
this.log("debug" /* DEBUG */, formatter, ...args); | ||
} | ||
error(formatter, ...args) { | ||
this.log("error" /* ERROR */, formatter, ...args); | ||
} | ||
log(logSeverity, formatter, ...args) { | ||
if (!Logger4Node.isLogEnabled(logSeverity)) { | ||
return; | ||
} | ||
this._debugLogger(`${logSeverity} ${formatter}`, ...args); | ||
} | ||
} | ||
exports.Logger4Node = Logger4Node; | ||
Logger4Node._ApplicationName = ''; | ||
Logger4Node.LOG_LEVEL_ENABLED = [ | ||
"verbose" /* VERBOSE */, | ||
"info" /* INFO */, | ||
"warn" /* WARN */, | ||
"debug" /* DEBUG */, | ||
"error" /* ERROR */, | ||
].filter((logLevel) => (LogLevel[process.env.DEBUG_LEVEL] || LogLevel["debug" /* DEBUG */]) <= LogLevel[logLevel]); | ||
//# sourceMappingURL=logger4-node.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6474
11
102