Comparing version 1.4.2 to 1.4.3
@@ -29,5 +29,5 @@ "use strict"; | ||
import_shared.default.format("o", (value, target) => { | ||
return (0, import_util.inspect)(value, { colors: !!target.colors }).replace(/\s*\n\s*/g, " "); | ||
return (0, import_util.inspect)(value, { colors: !!target.colors, depth: null }).replace(/\s*\n\s*/g, " "); | ||
}); | ||
module.exports = import_shared.default; | ||
//# sourceMappingURL=node.js.map |
@@ -125,5 +125,29 @@ "use strict"; | ||
} | ||
static render(target, record) { | ||
var _a, _b, _c, _d, _e, _f; | ||
const prefix = `[${record.type[0].toUpperCase()}]`; | ||
const space = " ".repeat((_b = (_a = target.label) == null ? void 0 : _a.margin) != null ? _b : 1); | ||
let indent = 3 + space.length, output = ""; | ||
if (target.showTime) { | ||
indent += target.showTime.length + space.length; | ||
output += _Logger.color(target, 8, import_cosmokit.Time.template(target.showTime)) + space; | ||
} | ||
const code = _Logger.code(record.name, target); | ||
const label = _Logger.color(target, code, record.name, ";1"); | ||
const padLength = ((_d = (_c = target.label) == null ? void 0 : _c.width) != null ? _d : 0) + label.length - record.name.length; | ||
if (((_e = target.label) == null ? void 0 : _e.align) === "right") { | ||
output += label.padStart(padLength) + space + prefix + space; | ||
indent += ((_f = target.label.width) != null ? _f : 0) + space.length; | ||
} else { | ||
output += prefix + space + label.padEnd(padLength) + space; | ||
} | ||
output += record.content.replace(/\n/g, "\n" + " ".repeat(indent)); | ||
if (target.showDiff) { | ||
const diff = _Logger.timestamp && record.timestamp - _Logger.timestamp; | ||
output += _Logger.color(target, code, " +" + import_cosmokit.Time.format(diff)); | ||
} | ||
return output; | ||
} | ||
createMethod(type, level) { | ||
this[type] = (...args) => { | ||
var _a, _b, _c, _d, _e, _f; | ||
if (args.length === 1 && isAggregateError(args[0])) { | ||
@@ -139,37 +163,9 @@ args[0].errors.forEach((error) => this[type](error)); | ||
const content = this.format(target, ...args); | ||
const record = { id, type, level, name: this.name, content, timestamp }; | ||
if (target.record) { | ||
target.record({ | ||
id, | ||
type, | ||
level, | ||
content, | ||
timestamp, | ||
name: this.name | ||
}); | ||
continue; | ||
} | ||
const prefix = `[${type[0].toUpperCase()}]`; | ||
const space = " ".repeat((_b = (_a = target.label) == null ? void 0 : _a.margin) != null ? _b : 1); | ||
let indent = 3 + space.length, output = ""; | ||
if (target.showTime) { | ||
indent += target.showTime.length + space.length; | ||
output += _Logger.color(target, 8, import_cosmokit.Time.template(target.showTime)) + space; | ||
} | ||
const label = this.color(target, this.name, ";1"); | ||
const padLength = ((_d = (_c = target.label) == null ? void 0 : _c.width) != null ? _d : 0) + label.length - this.name.length; | ||
if (((_e = target.label) == null ? void 0 : _e.align) === "right") { | ||
output += label.padStart(padLength) + space + prefix + space; | ||
indent += ((_f = target.label.width) != null ? _f : 0) + space.length; | ||
target.record(record); | ||
} else { | ||
output += prefix + space + label.padEnd(padLength) + space; | ||
const { print = console.log } = target; | ||
print(_Logger.render(target, record)); | ||
} | ||
output += content.replace(/\n/g, "\n" + " ".repeat(indent)); | ||
if (target.showDiff) { | ||
const diff = _Logger.timestamp && timestamp - _Logger.timestamp; | ||
output += this.color(target, " +" + import_cosmokit.Time.format(diff)); | ||
} | ||
const { maxLength = 1024, print = console.log } = target; | ||
print(output.split(/\r?\n/g).map((line) => { | ||
return line.slice(0, maxLength) + (line.length > maxLength ? "..." : ""); | ||
}).join("\n")); | ||
} | ||
@@ -179,6 +175,2 @@ _Logger.timestamp = timestamp; | ||
} | ||
color(target, value, decoration = "") { | ||
const code = _Logger.code(this.name, target); | ||
return _Logger.color(target, code, value, decoration); | ||
} | ||
format(target, ...args) { | ||
@@ -205,3 +197,6 @@ if (args[0] instanceof Error) { | ||
} | ||
return format; | ||
const { maxLength = 1024 } = target; | ||
return format.split(/\r?\n/g).map((line) => { | ||
return line.slice(0, maxLength) + (line.length > maxLength ? "..." : ""); | ||
}).join("\n"); | ||
} | ||
@@ -208,0 +203,0 @@ get level() { |
{ | ||
"name": "reggol", | ||
"description": "Logger for professionals", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"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
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
55268
633