@mcesystems/tool-debug 1.0.62 → 1.0.63
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/README.md +106 -0
- package/dist/index.browser.mjs +126 -53
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.js +282 -167
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +281 -166
- package/dist/index.mjs.map +4 -4
- package/dist/types/debug.d.ts +6 -0
- package/dist/types/debug.d.ts.map +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -10,9 +10,16 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
10
10
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
12
|
});
|
|
13
|
+
var __esm = (fn, res) => function __init() {
|
|
14
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
15
|
+
};
|
|
13
16
|
var __commonJS = (cb, mod) => function __require2() {
|
|
14
17
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
18
|
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
16
23
|
var __copyProps = (to, from, except, desc) => {
|
|
17
24
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
25
|
for (let key of __getOwnPropNames(from))
|
|
@@ -29,6 +36,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
36
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
37
|
mod
|
|
31
38
|
));
|
|
39
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
40
|
|
|
33
41
|
// ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
|
|
34
42
|
var require_ms = __commonJS({
|
|
@@ -146,10 +154,10 @@ var require_ms = __commonJS({
|
|
|
146
154
|
}
|
|
147
155
|
});
|
|
148
156
|
|
|
149
|
-
// ../../node_modules/.pnpm/debug@4.4.
|
|
157
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/common.js
|
|
150
158
|
var require_common = __commonJS({
|
|
151
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
152
|
-
function setup(
|
|
159
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/common.js"(exports, module) {
|
|
160
|
+
function setup(env2) {
|
|
153
161
|
createDebug2.debug = createDebug2;
|
|
154
162
|
createDebug2.default = createDebug2;
|
|
155
163
|
createDebug2.coerce = coerce;
|
|
@@ -158,8 +166,8 @@ var require_common = __commonJS({
|
|
|
158
166
|
createDebug2.enabled = enabled;
|
|
159
167
|
createDebug2.humanize = require_ms();
|
|
160
168
|
createDebug2.destroy = destroy;
|
|
161
|
-
Object.keys(
|
|
162
|
-
createDebug2[key] =
|
|
169
|
+
Object.keys(env2).forEach((key) => {
|
|
170
|
+
createDebug2[key] = env2[key];
|
|
163
171
|
});
|
|
164
172
|
createDebug2.names = [];
|
|
165
173
|
createDebug2.skips = [];
|
|
@@ -323,9 +331,9 @@ var require_common = __commonJS({
|
|
|
323
331
|
}
|
|
324
332
|
});
|
|
325
333
|
|
|
326
|
-
// ../../node_modules/.pnpm/debug@4.4.
|
|
334
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/browser.js
|
|
327
335
|
var require_browser = __commonJS({
|
|
328
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
336
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/browser.js"(exports, module) {
|
|
329
337
|
exports.formatArgs = formatArgs;
|
|
330
338
|
exports.save = save;
|
|
331
339
|
exports.load = load;
|
|
@@ -493,125 +501,159 @@ var require_browser = __commonJS({
|
|
|
493
501
|
}
|
|
494
502
|
});
|
|
495
503
|
|
|
496
|
-
// ../../node_modules/.pnpm/
|
|
497
|
-
var
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
502
|
-
const position = argv.indexOf(prefix + flag);
|
|
503
|
-
const terminatorPosition = argv.indexOf("--");
|
|
504
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
505
|
-
};
|
|
506
|
-
}
|
|
504
|
+
// ../../node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js
|
|
505
|
+
var supports_color_exports = {};
|
|
506
|
+
__export(supports_color_exports, {
|
|
507
|
+
createSupportsColor: () => createSupportsColor,
|
|
508
|
+
default: () => supports_color_default
|
|
507
509
|
});
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
510
|
+
import process2 from "node:process";
|
|
511
|
+
import os from "node:os";
|
|
512
|
+
import tty from "node:tty";
|
|
513
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
514
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
515
|
+
const position = argv.indexOf(prefix + flag);
|
|
516
|
+
const terminatorPosition = argv.indexOf("--");
|
|
517
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
518
|
+
}
|
|
519
|
+
function envForceColor() {
|
|
520
|
+
if (!("FORCE_COLOR" in env)) {
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
if (env.FORCE_COLOR === "true") {
|
|
524
|
+
return 1;
|
|
525
|
+
}
|
|
526
|
+
if (env.FORCE_COLOR === "false") {
|
|
527
|
+
return 0;
|
|
528
|
+
}
|
|
529
|
+
if (env.FORCE_COLOR.length === 0) {
|
|
530
|
+
return 1;
|
|
531
|
+
}
|
|
532
|
+
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
533
|
+
if (![0, 1, 2, 3].includes(level)) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
return level;
|
|
537
|
+
}
|
|
538
|
+
function translateLevel(level) {
|
|
539
|
+
if (level === 0) {
|
|
540
|
+
return false;
|
|
541
|
+
}
|
|
542
|
+
return {
|
|
543
|
+
level,
|
|
544
|
+
hasBasic: true,
|
|
545
|
+
has256: level >= 2,
|
|
546
|
+
has16m: level >= 3
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
550
|
+
const noFlagForceColor = envForceColor();
|
|
551
|
+
if (noFlagForceColor !== void 0) {
|
|
552
|
+
flagForceColor = noFlagForceColor;
|
|
553
|
+
}
|
|
554
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
555
|
+
if (forceColor === 0) {
|
|
556
|
+
return 0;
|
|
557
|
+
}
|
|
558
|
+
if (sniffFlags) {
|
|
559
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
560
|
+
return 3;
|
|
522
561
|
}
|
|
523
|
-
if ("
|
|
524
|
-
|
|
525
|
-
forceColor = 1;
|
|
526
|
-
} else if (env.FORCE_COLOR === "false") {
|
|
527
|
-
forceColor = 0;
|
|
528
|
-
} else {
|
|
529
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
530
|
-
}
|
|
562
|
+
if (hasFlag("color=256")) {
|
|
563
|
+
return 2;
|
|
531
564
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
565
|
+
}
|
|
566
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
567
|
+
return 1;
|
|
568
|
+
}
|
|
569
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
570
|
+
return 0;
|
|
571
|
+
}
|
|
572
|
+
const min = forceColor || 0;
|
|
573
|
+
if (env.TERM === "dumb") {
|
|
574
|
+
return min;
|
|
575
|
+
}
|
|
576
|
+
if (process2.platform === "win32") {
|
|
577
|
+
const osRelease = os.release().split(".");
|
|
578
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
579
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
542
580
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
575
|
-
}
|
|
576
|
-
if (env.COLORTERM === "truecolor") {
|
|
577
|
-
return 3;
|
|
578
|
-
}
|
|
579
|
-
if ("TERM_PROGRAM" in env) {
|
|
580
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
581
|
-
switch (env.TERM_PROGRAM) {
|
|
582
|
-
case "iTerm.app":
|
|
583
|
-
return version >= 3 ? 3 : 2;
|
|
584
|
-
case "Apple_Terminal":
|
|
585
|
-
return 2;
|
|
586
|
-
}
|
|
581
|
+
return 1;
|
|
582
|
+
}
|
|
583
|
+
if ("CI" in env) {
|
|
584
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
|
585
|
+
return 3;
|
|
586
|
+
}
|
|
587
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
588
|
+
return 1;
|
|
589
|
+
}
|
|
590
|
+
return min;
|
|
591
|
+
}
|
|
592
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
593
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
594
|
+
}
|
|
595
|
+
if (env.COLORTERM === "truecolor") {
|
|
596
|
+
return 3;
|
|
597
|
+
}
|
|
598
|
+
if (env.TERM === "xterm-kitty") {
|
|
599
|
+
return 3;
|
|
600
|
+
}
|
|
601
|
+
if (env.TERM === "xterm-ghostty") {
|
|
602
|
+
return 3;
|
|
603
|
+
}
|
|
604
|
+
if (env.TERM === "wezterm") {
|
|
605
|
+
return 3;
|
|
606
|
+
}
|
|
607
|
+
if ("TERM_PROGRAM" in env) {
|
|
608
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
609
|
+
switch (env.TERM_PROGRAM) {
|
|
610
|
+
case "iTerm.app": {
|
|
611
|
+
return version >= 3 ? 3 : 2;
|
|
587
612
|
}
|
|
588
|
-
|
|
613
|
+
case "Apple_Terminal": {
|
|
589
614
|
return 2;
|
|
590
615
|
}
|
|
591
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
592
|
-
return 1;
|
|
593
|
-
}
|
|
594
|
-
if ("COLORTERM" in env) {
|
|
595
|
-
return 1;
|
|
596
|
-
}
|
|
597
|
-
return min;
|
|
598
616
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
617
|
+
}
|
|
618
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
619
|
+
return 2;
|
|
620
|
+
}
|
|
621
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
622
|
+
return 1;
|
|
623
|
+
}
|
|
624
|
+
if ("COLORTERM" in env) {
|
|
625
|
+
return 1;
|
|
626
|
+
}
|
|
627
|
+
return min;
|
|
628
|
+
}
|
|
629
|
+
function createSupportsColor(stream, options = {}) {
|
|
630
|
+
const level = _supportsColor(stream, {
|
|
631
|
+
streamIsTTY: stream && stream.isTTY,
|
|
632
|
+
...options
|
|
633
|
+
});
|
|
634
|
+
return translateLevel(level);
|
|
635
|
+
}
|
|
636
|
+
var env, flagForceColor, supportsColor, supports_color_default;
|
|
637
|
+
var init_supports_color = __esm({
|
|
638
|
+
"../../node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js"() {
|
|
639
|
+
({ env } = process2);
|
|
640
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
641
|
+
flagForceColor = 0;
|
|
642
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
643
|
+
flagForceColor = 1;
|
|
602
644
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
645
|
+
supportsColor = {
|
|
646
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
647
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
607
648
|
};
|
|
649
|
+
supports_color_default = supportsColor;
|
|
608
650
|
}
|
|
609
651
|
});
|
|
610
652
|
|
|
611
|
-
// ../../node_modules/.pnpm/debug@4.4.
|
|
653
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/node.js
|
|
612
654
|
var require_node = __commonJS({
|
|
613
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
614
|
-
var
|
|
655
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/node.js"(exports, module) {
|
|
656
|
+
var tty2 = __require("tty");
|
|
615
657
|
var util = __require("util");
|
|
616
658
|
exports.init = init;
|
|
617
659
|
exports.log = log;
|
|
@@ -626,8 +668,8 @@ var require_node = __commonJS({
|
|
|
626
668
|
);
|
|
627
669
|
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
628
670
|
try {
|
|
629
|
-
const
|
|
630
|
-
if (
|
|
671
|
+
const supportsColor2 = (init_supports_color(), __toCommonJS(supports_color_exports));
|
|
672
|
+
if (supportsColor2 && (supportsColor2.stderr || supportsColor2).level >= 2) {
|
|
631
673
|
exports.colors = [
|
|
632
674
|
20,
|
|
633
675
|
21,
|
|
@@ -729,7 +771,7 @@ var require_node = __commonJS({
|
|
|
729
771
|
return obj;
|
|
730
772
|
}, {});
|
|
731
773
|
function useColors() {
|
|
732
|
-
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) :
|
|
774
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty2.isatty(process.stderr.fd);
|
|
733
775
|
}
|
|
734
776
|
function formatArgs(args) {
|
|
735
777
|
const { namespace: name, useColors: useColors2 } = this;
|
|
@@ -782,9 +824,9 @@ var require_node = __commonJS({
|
|
|
782
824
|
}
|
|
783
825
|
});
|
|
784
826
|
|
|
785
|
-
// ../../node_modules/.pnpm/debug@4.4.
|
|
827
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/index.js
|
|
786
828
|
var require_src = __commonJS({
|
|
787
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
829
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.2.2/node_modules/debug/src/index.js"(exports, module) {
|
|
788
830
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
789
831
|
module.exports = require_browser();
|
|
790
832
|
} else {
|
|
@@ -799,42 +841,121 @@ var logInfo = (0, import_debug.default)("info");
|
|
|
799
841
|
var logTask = (0, import_debug.default)("task");
|
|
800
842
|
var logError = (0, import_debug.default)("error");
|
|
801
843
|
var logDetail = (0, import_debug.default)("detail");
|
|
844
|
+
var logDebug = (0, import_debug.default)("debug");
|
|
845
|
+
var logWarning = (0, import_debug.default)("warning");
|
|
846
|
+
var logColor = (0, import_debug.default)("color");
|
|
847
|
+
logInfo.color = "19";
|
|
848
|
+
logTask.color = "25";
|
|
849
|
+
logError.color = "1";
|
|
850
|
+
logDetail.color = "199";
|
|
851
|
+
logWarning.color = "186";
|
|
852
|
+
logDebug.color = "211";
|
|
853
|
+
logColor.enabled = true;
|
|
802
854
|
function logNamespace(namespace) {
|
|
803
|
-
logInfo.namespace = `${namespace}:
|
|
804
|
-
logTask.namespace = `${namespace}:
|
|
805
|
-
logError.namespace = `${namespace}:
|
|
806
|
-
logDetail.namespace = `${namespace}:
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
855
|
+
logInfo.namespace = `${namespace}:info`;
|
|
856
|
+
logTask.namespace = `${namespace}:task`;
|
|
857
|
+
logError.namespace = `${namespace}:error`;
|
|
858
|
+
logDetail.namespace = `${namespace}:detail`;
|
|
859
|
+
logWarning.namespace = `${namespace}:warning`;
|
|
860
|
+
logDebug.namespace = `${namespace}:debug`;
|
|
861
|
+
}
|
|
862
|
+
function setLogLevel(level) {
|
|
863
|
+
switch (level) {
|
|
864
|
+
case "info":
|
|
865
|
+
logInfo.enabled = true;
|
|
866
|
+
logTask.enabled = true;
|
|
867
|
+
logError.enabled = true;
|
|
868
|
+
logWarning.enabled = true;
|
|
869
|
+
logDetail.enabled = false;
|
|
870
|
+
logDebug.enabled = false;
|
|
871
|
+
break;
|
|
872
|
+
case "debug":
|
|
873
|
+
logInfo.enabled = true;
|
|
874
|
+
logTask.enabled = true;
|
|
875
|
+
logError.enabled = true;
|
|
876
|
+
logWarning.enabled = true;
|
|
877
|
+
logDetail.enabled = true;
|
|
878
|
+
logDebug.enabled = true;
|
|
879
|
+
break;
|
|
880
|
+
case "none":
|
|
881
|
+
logInfo.enabled = false;
|
|
882
|
+
logTask.enabled = false;
|
|
883
|
+
logError.enabled = false;
|
|
884
|
+
logWarning.enabled = false;
|
|
885
|
+
logDetail.enabled = false;
|
|
886
|
+
logDebug.enabled = false;
|
|
887
|
+
break;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
function setColors(type, color) {
|
|
891
|
+
switch (type) {
|
|
892
|
+
case "info":
|
|
893
|
+
logInfo.color = color;
|
|
894
|
+
break;
|
|
895
|
+
case "task":
|
|
896
|
+
logTask.color = color;
|
|
897
|
+
break;
|
|
898
|
+
case "error":
|
|
899
|
+
logError.color = color;
|
|
900
|
+
break;
|
|
901
|
+
case "detail":
|
|
902
|
+
logDetail.color = color;
|
|
903
|
+
break;
|
|
904
|
+
case "warning":
|
|
905
|
+
logWarning.color = color;
|
|
906
|
+
break;
|
|
907
|
+
case "debug":
|
|
908
|
+
logDebug.color = color;
|
|
909
|
+
break;
|
|
910
|
+
default:
|
|
911
|
+
throw new Error(`Invalid log type: ${type}`);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
function printColors() {
|
|
915
|
+
for (let i = 0; i < 256; i++) {
|
|
916
|
+
logColor.color = `${i}`;
|
|
917
|
+
logColor(`${i}: ${i}`);
|
|
918
|
+
}
|
|
811
919
|
}
|
|
812
|
-
function logDataDetail(data, prefix = "") {
|
|
920
|
+
function logDataDetail(data, prefix = "# ") {
|
|
813
921
|
if (data === null || data === void 0) {
|
|
814
|
-
|
|
815
|
-
return;
|
|
922
|
+
return `${prefix}<null or undefined>`;
|
|
816
923
|
}
|
|
817
924
|
if (typeof data !== "object") {
|
|
818
|
-
|
|
819
|
-
return;
|
|
925
|
+
return `${prefix}${String(data)}`;
|
|
820
926
|
}
|
|
821
927
|
const keys = Object.keys(data);
|
|
928
|
+
let result = "";
|
|
822
929
|
for (const key of keys) {
|
|
823
|
-
|
|
824
|
-
if (
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
930
|
+
result += `${prefix}${key}: `;
|
|
931
|
+
if (key in data) {
|
|
932
|
+
let dataKey = key;
|
|
933
|
+
if (key in data) {
|
|
934
|
+
dataKey = key;
|
|
935
|
+
const value = data[dataKey];
|
|
936
|
+
if (value === null || value === void 0) {
|
|
937
|
+
result += `<${value === null ? "null" : "undefined"}>
|
|
938
|
+
`;
|
|
939
|
+
} else if (typeof value === "object") {
|
|
940
|
+
result += `
|
|
941
|
+
${logDataDetail(value, `${prefix} `)}
|
|
942
|
+
`;
|
|
943
|
+
} else {
|
|
944
|
+
result += `${value}
|
|
945
|
+
`;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
831
948
|
}
|
|
832
949
|
}
|
|
950
|
+
return result.trim();
|
|
951
|
+
}
|
|
952
|
+
function header(title, padding = 0) {
|
|
953
|
+
return `${" ".repeat(padding)}${"=".repeat(80)}
|
|
954
|
+
${" ".repeat(40 - title.length / 2)}${title}
|
|
955
|
+
${" ".repeat(padding)}${"=".repeat(80)}`;
|
|
833
956
|
}
|
|
834
957
|
function logHeader(title) {
|
|
835
|
-
logInfo(
|
|
836
|
-
logInfo(title);
|
|
837
|
-
logInfo("=".repeat(80));
|
|
958
|
+
logInfo(`${header(title, 2)}`);
|
|
838
959
|
}
|
|
839
960
|
function logDataObject(title, ...args) {
|
|
840
961
|
const stack = new Error().stack?.split("\n")[2] || "";
|
|
@@ -845,44 +966,38 @@ function logDataObject(title, ...args) {
|
|
|
845
966
|
const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
|
|
846
967
|
callerDetails = `${functionName}`;
|
|
847
968
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
logDetail("");
|
|
854
|
-
logDataDetail(arg);
|
|
855
|
-
logDetail("");
|
|
856
|
-
}
|
|
857
|
-
logInfo("=".repeat(80));
|
|
969
|
+
logDetail(`${header(`*${title}* ${callerDetails}`)}
|
|
970
|
+
${args.reduce((acc, arg) => `${acc}
|
|
971
|
+
${logDataDetail(arg)}`, "")}
|
|
972
|
+
|
|
973
|
+
${"=".repeat(80)}`);
|
|
858
974
|
}
|
|
859
975
|
function logErrorObject(error, extraDetails) {
|
|
860
976
|
if (error instanceof Error) {
|
|
861
|
-
logError(
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
logError("");
|
|
868
|
-
logError("=".repeat(80));
|
|
977
|
+
logError(`${extraDetails ? header(extraDetails, 1) : header(error.message, 1)}
|
|
978
|
+
Error Message:
|
|
979
|
+
${error.message}
|
|
980
|
+
Error Stack:
|
|
981
|
+
${error.stack}
|
|
982
|
+
${"=".repeat(80)}`);
|
|
869
983
|
} else {
|
|
870
|
-
logError(error)
|
|
871
|
-
|
|
872
|
-
logError("Error Message:");
|
|
873
|
-
extraDetails && logError(extraDetails);
|
|
874
|
-
logError(String(error));
|
|
875
|
-
logError("=".repeat(80));
|
|
984
|
+
logError(`${extraDetails ? header(extraDetails, 1) : header(String(error), 1)}
|
|
985
|
+
${"=".repeat(80)}`);
|
|
876
986
|
}
|
|
877
987
|
}
|
|
878
988
|
export {
|
|
879
989
|
logDataObject,
|
|
990
|
+
logDebug,
|
|
880
991
|
logDetail,
|
|
881
992
|
logError,
|
|
882
993
|
logErrorObject,
|
|
883
994
|
logHeader,
|
|
884
995
|
logInfo,
|
|
885
996
|
logNamespace,
|
|
886
|
-
logTask
|
|
997
|
+
logTask,
|
|
998
|
+
logWarning,
|
|
999
|
+
printColors,
|
|
1000
|
+
setColors,
|
|
1001
|
+
setLogLevel
|
|
887
1002
|
};
|
|
888
1003
|
//# sourceMappingURL=index.mjs.map
|