Comparing version 1.4.0 to 1.4.1
@@ -18,2 +18,10 @@ declare namespace Logger { | ||
export interface Record { | ||
name: string | ||
type: Logger.Type | ||
level: number | ||
content: string | ||
timestamp: number | ||
} | ||
export interface Target { | ||
@@ -30,3 +38,4 @@ /** | ||
label?: LabelStyle | ||
print(text: string): void | ||
record?(record: Record): void | ||
print?(text: string): void | ||
} | ||
@@ -33,0 +42,0 @@ } |
@@ -125,3 +125,3 @@ "use strict"; | ||
} | ||
createMethod(type, minLevel) { | ||
createMethod(type, level) { | ||
this[type] = (...args) => { | ||
@@ -133,9 +133,15 @@ var _a, _b, _c, _d, _e, _f; | ||
} | ||
if (this.level < minLevel) | ||
if (this.level < level) | ||
return; | ||
const now = Date.now(); | ||
const timestamp = Date.now(); | ||
for (const target of _Logger.targets) { | ||
const content = this.format(target, ...args); | ||
if (target.write) { | ||
target.write(content, this.name, type, minLevel); | ||
if (target.record) { | ||
target.record({ | ||
type, | ||
level, | ||
content, | ||
timestamp, | ||
name: this.name | ||
}); | ||
continue; | ||
@@ -160,3 +166,3 @@ } | ||
if (target.showDiff) { | ||
const diff = _Logger.timestamp && now - _Logger.timestamp; | ||
const diff = _Logger.timestamp && timestamp - _Logger.timestamp; | ||
output += this.color(target, " +" + import_cosmokit.Time.format(diff)); | ||
@@ -169,3 +175,3 @@ } | ||
} | ||
_Logger.timestamp = now; | ||
_Logger.timestamp = timestamp; | ||
}; | ||
@@ -172,0 +178,0 @@ } |
{ | ||
"name": "reggol", | ||
"description": "Logger for professionals", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"sideEffects": false, | ||
@@ -6,0 +6,0 @@ "main": "lib/node.js", |
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
55140
636