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