@d-fischer/logger
Advanced tools
Comparing version 2.1.1 to 3.0.0
@@ -1,4 +0,4 @@ | ||
import { LoggerOptions } from './LoggerOptions'; | ||
import type { LoggerOptions } from './LoggerOptions'; | ||
import { LogLevel } from './LogLevel'; | ||
import { Logger } from './Logger'; | ||
import type { Logger } from './Logger'; | ||
export declare abstract class BaseLogger implements Logger { | ||
@@ -13,16 +13,7 @@ protected readonly _name: string; | ||
crit(message: string): void; | ||
critical(message: string): void; | ||
err(message: string): void; | ||
error(message: string): void; | ||
warn(message: string): void; | ||
warning(message: string): void; | ||
info(message: string): void; | ||
debug(message: string): void; | ||
/** @deprecated use debug instead */ | ||
debug1(message: string): void; | ||
/** @deprecated use debug instead */ | ||
debug2(message: string): void; | ||
/** @deprecated use debug instead */ | ||
debug3(message: string): void; | ||
trace(message: string): void; | ||
} |
@@ -19,8 +19,2 @@ "use strict"; | ||
}; | ||
BaseLogger.prototype.critical = function (message) { | ||
this.log(LogLevel_1.LogLevel.CRITICAL, message); | ||
}; | ||
BaseLogger.prototype.err = function (message) { | ||
this.log(LogLevel_1.LogLevel.ERROR, message); | ||
}; | ||
BaseLogger.prototype.error = function (message) { | ||
@@ -32,5 +26,2 @@ this.log(LogLevel_1.LogLevel.ERROR, message); | ||
}; | ||
BaseLogger.prototype.warning = function (message) { | ||
this.log(LogLevel_1.LogLevel.WARNING, message); | ||
}; | ||
BaseLogger.prototype.info = function (message) { | ||
@@ -42,14 +33,2 @@ this.log(LogLevel_1.LogLevel.INFO, message); | ||
}; | ||
/** @deprecated use debug instead */ | ||
BaseLogger.prototype.debug1 = function (message) { | ||
this.log(LogLevel_1.LogLevel.DEBUG, message); | ||
}; | ||
/** @deprecated use debug instead */ | ||
BaseLogger.prototype.debug2 = function (message) { | ||
this.log(LogLevel_1.LogLevel.DEBUG, message); | ||
}; | ||
/** @deprecated use debug instead */ | ||
BaseLogger.prototype.debug3 = function (message) { | ||
this.log(LogLevel_1.LogLevel.DEBUG, message); | ||
}; | ||
BaseLogger.prototype.trace = function (message) { | ||
@@ -56,0 +35,0 @@ this.log(LogLevel_1.LogLevel.TRACE, message); |
@@ -1,2 +0,2 @@ | ||
import { LogLevel } from './LogLevel'; | ||
import type { LogLevel } from './LogLevel'; | ||
import { BaseLogger } from './BaseLogger'; | ||
@@ -3,0 +3,0 @@ export declare class BrowserLogger extends BaseLogger { |
@@ -1,3 +0,3 @@ | ||
import { Logger as ILogger } from './Logger'; | ||
import { LoggerOptions } from './LoggerOptions'; | ||
import type { Logger as ILogger } from './Logger'; | ||
import type { LoggerOptions } from './LoggerOptions'; | ||
declare const Logger: new (options: LoggerOptions) => ILogger; | ||
@@ -7,2 +7,2 @@ declare type Logger = ILogger; | ||
export { LogLevel } from './LogLevel'; | ||
export { LoggerOptions }; | ||
export type { LoggerOptions }; |
@@ -1,19 +0,10 @@ | ||
import { LogLevel } from './LogLevel'; | ||
import type { LogLevel } from './LogLevel'; | ||
export interface Logger { | ||
log(level: LogLevel, message: string): void; | ||
crit(message: string): void; | ||
critical(message: string): void; | ||
err(message: string): void; | ||
error(message: string): void; | ||
warn(message: string): void; | ||
warning(message: string): void; | ||
info(message: string): void; | ||
debug(message: string): void; | ||
/** @deprecated */ | ||
debug1(message: string): void; | ||
/** @deprecated */ | ||
debug2(message: string): void; | ||
/** @deprecated */ | ||
debug3(message: string): void; | ||
trace(message: string): void; | ||
log: (level: LogLevel, message: string) => void; | ||
crit: (message: string) => void; | ||
error: (message: string) => void; | ||
warn: (message: string) => void; | ||
info: (message: string) => void; | ||
debug: (message: string) => void; | ||
trace: (message: string) => void; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { LogLevel } from './LogLevel'; | ||
import type { LogLevel } from './LogLevel'; | ||
export interface LoggerOptions { | ||
@@ -3,0 +3,0 @@ name: string; |
@@ -6,8 +6,2 @@ export declare enum LogLevel { | ||
INFO = 3, | ||
/** @deprecated use DEBUG instead */ | ||
DEBUG1 = 4, | ||
/** @deprecated use DEBUG instead */ | ||
DEBUG2 = 4, | ||
/** @deprecated use DEBUG instead */ | ||
DEBUG3 = 4, | ||
DEBUG = 4, | ||
@@ -14,0 +8,0 @@ TRACE = 7 |
@@ -12,8 +12,2 @@ "use strict"; | ||
LogLevel[LogLevel["INFO"] = 3] = "INFO"; | ||
/** @deprecated use DEBUG instead */ | ||
LogLevel[LogLevel["DEBUG1"] = 4] = "DEBUG1"; | ||
/** @deprecated use DEBUG instead */ | ||
LogLevel[LogLevel["DEBUG2"] = 4] = "DEBUG2"; | ||
/** @deprecated use DEBUG instead */ | ||
LogLevel[LogLevel["DEBUG3"] = 4] = "DEBUG3"; | ||
LogLevel[LogLevel["DEBUG"] = 4] = "DEBUG"; | ||
@@ -31,3 +25,3 @@ LogLevel[LogLevel["TRACE"] = 7] = "TRACE"; | ||
.filter(function (k) { return !isNaN(k) && k < level; }); | ||
if (!eligibleLevels) { | ||
if (!eligibleLevels.length) { | ||
return LogLevel.WARNING; | ||
@@ -37,5 +31,6 @@ } | ||
} | ||
var strLevel = level.toUpperCase(); | ||
// TODO drop the replace for next major, it keeps the old deprecated debug1/2/3 levels running | ||
var strLevel = level.replace(/\d+$/, '').toUpperCase(); | ||
if (!Object.prototype.hasOwnProperty.call(LogLevel, strLevel)) { | ||
throw new Error("Unknown log level string: " + strLevel); | ||
throw new Error("Unknown log level string: " + level); | ||
} | ||
@@ -42,0 +37,0 @@ return LogLevel[strLevel]; |
@@ -1,2 +0,3 @@ | ||
import { LogLevel, LogLevelMap } from './LogLevel'; | ||
import type { LogLevelMap } from './LogLevel'; | ||
import { LogLevel } from './LogLevel'; | ||
import { BaseLogger } from './BaseLogger'; | ||
@@ -3,0 +4,0 @@ export declare const LogLevelToEmoji: LogLevelMap<string>; |
{ | ||
"name": "@d-fischer/logger", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"description": "A simple logger for Node and the browser.", | ||
@@ -22,10 +22,10 @@ "main": "lib", | ||
"devDependencies": { | ||
"@d-fischer/eslint-config": "^2.0.6", | ||
"@types/node": "^14.11.2", | ||
"eslint": "^7.10.0", | ||
"husky": "^4.3.0", | ||
"lint-staged": "^10.4.0", | ||
"prettier": "^2.1.2", | ||
"tsukuru": "^0.6.0", | ||
"typescript": "~4.0.3" | ||
"@d-fischer/eslint-config": "^4.2.0", | ||
"@types/node": "^14.14.19", | ||
"eslint": "^7.17.0", | ||
"husky": "^4.3.6", | ||
"lint-staged": "^10.5.3", | ||
"prettier": "^2.2.1", | ||
"tsukuru": "^0.7.2", | ||
"typescript": "~4.1.3" | ||
}, | ||
@@ -32,0 +32,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
37364
510