@taujs/server 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -614,8 +614,15 @@ var Logger = class _Logger {
|
|
|
614
614
|
const boundSink = rawSink ? rawSink.bind(owner) : void 0;
|
|
615
615
|
const consoleFallback = level === "error" ? console.error : level === "warn" ? console.warn : console.log;
|
|
616
616
|
const hasCustom = !!boundSink;
|
|
617
|
-
|
|
618
|
-
|
|
617
|
+
let baseMeta;
|
|
618
|
+
if (meta && typeof meta === "object" && !Array.isArray(meta)) {
|
|
619
|
+
baseMeta = meta;
|
|
620
|
+
} else if (meta === void 0) {
|
|
621
|
+
baseMeta = {};
|
|
622
|
+
} else {
|
|
623
|
+
baseMeta = { value: meta };
|
|
624
|
+
}
|
|
625
|
+
const withCtx = wantCtx && Object.keys(this.context).length > 0 ? { context: this.context, ...baseMeta } : baseMeta;
|
|
619
626
|
const finalMeta = this.shouldIncludeStack(level) ? withCtx : this.stripStacks(withCtx);
|
|
620
627
|
const hasMeta = finalMeta && typeof finalMeta === "object" ? Object.keys(finalMeta).length > 0 : false;
|
|
621
628
|
const levelText = level.toLowerCase() + (category ? `:${category.toLowerCase()}` : "");
|
|
@@ -644,8 +651,8 @@ var Logger = class _Logger {
|
|
|
644
651
|
if (hasCustom) {
|
|
645
652
|
const obj = hasMeta ? finalMeta : {};
|
|
646
653
|
try {
|
|
647
|
-
|
|
648
|
-
} catch
|
|
654
|
+
boundSink(obj, formatted);
|
|
655
|
+
} catch {
|
|
649
656
|
hasMeta ? consoleFallback(formatted, finalMeta) : consoleFallback(formatted);
|
|
650
657
|
}
|
|
651
658
|
} else {
|