@be-link/cls-logger 1.0.1-beta.6 → 1.0.1-beta.8
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/ClsLoggerCore.d.ts.map +1 -1
- package/dist/errorMonitor.d.ts.map +1 -1
- package/dist/index.esm.js +20 -4
- package/dist/index.js +20 -4
- package/dist/index.umd.js +20 -4
- package/dist/mini.esm.js +20 -4
- package/dist/mini.js +20 -4
- package/dist/web.esm.js +20 -4
- package/dist/web.js +20 -4
- package/package.json +12 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClsLoggerCore.d.ts","sourceRoot":"","sources":["../src/ClsLoggerCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,OAAO,EACP,UAAU,EAEV,UAAU,EACV,SAAS,EACT,SAAS,EAEV,MAAM,SAAS,CAAC;AAgBjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAYlD;;;;;GAKG;AACH,8BAAsB,aAAa;IACjC,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAAQ;IAC1C,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAQ;IAC1D,SAAS,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAAQ;IAC7C,SAAS,CAAC,iBAAiB,EAAE,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAQ;IAC9E,SAAS,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAQ;IAC9F,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,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AmBX,cAAc;IAgC5B,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,qBAAqB;IAc7B,WAAW,IAAI,IAAI;IAkBnB;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI;CAcjG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorMonitor.d.ts","sourceRoot":"","sources":["../src/errorMonitor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG/D,KAAK,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"errorMonitor.d.ts","sourceRoot":"","sources":["../src/errorMonitor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG/D,KAAK,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;AA6RzD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAE,OAAO,GAAG,mBAAmB,GAAG,SAAc,GAAG,IAAI,CAqBhH"}
|
package/dist/index.esm.js
CHANGED
|
@@ -561,7 +561,17 @@ function getPagePath$1() {
|
|
|
561
561
|
function normalizeErrorLike(err, maxTextLength) {
|
|
562
562
|
if (err && typeof err === 'object') {
|
|
563
563
|
const anyErr = err;
|
|
564
|
-
|
|
564
|
+
let rawMsg = anyErr.message;
|
|
565
|
+
if (!rawMsg) {
|
|
566
|
+
const str = anyErr.toString?.();
|
|
567
|
+
if (!str || str === '[object Object]') {
|
|
568
|
+
rawMsg = stringifyLogValue(anyErr);
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
rawMsg = str;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
const message = truncate$2(String(rawMsg ?? ''), maxTextLength);
|
|
565
575
|
const name = truncate$2(String(anyErr.name ?? ''), 200);
|
|
566
576
|
const stack = truncate$2(String(anyErr.stack ?? ''), maxTextLength);
|
|
567
577
|
return { message, name, stack };
|
|
@@ -705,9 +715,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
705
715
|
try {
|
|
706
716
|
if (!sampleHit$1(options.sampleRate))
|
|
707
717
|
return;
|
|
718
|
+
const e = normalizeErrorLike(msg, options.maxTextLength);
|
|
708
719
|
const payload = {
|
|
709
720
|
source: 'wx.onError',
|
|
710
|
-
message:
|
|
721
|
+
message: e.message,
|
|
722
|
+
errorName: e.name,
|
|
723
|
+
stack: e.stack,
|
|
711
724
|
};
|
|
712
725
|
if (!shouldReport(buildErrorKey(options.reportType, payload)))
|
|
713
726
|
return;
|
|
@@ -759,9 +772,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
759
772
|
next.onError = function (...args) {
|
|
760
773
|
try {
|
|
761
774
|
if (sampleHit$1(options.sampleRate)) {
|
|
775
|
+
const e = normalizeErrorLike(args?.[0], options.maxTextLength);
|
|
762
776
|
const payload = {
|
|
763
777
|
source: 'App.onError',
|
|
764
|
-
message:
|
|
778
|
+
message: e.message,
|
|
779
|
+
errorName: e.name,
|
|
780
|
+
stack: e.stack,
|
|
765
781
|
};
|
|
766
782
|
if (shouldReport(buildErrorKey(options.reportType, payload)))
|
|
767
783
|
report(options.reportType, payload);
|
|
@@ -2031,7 +2047,7 @@ class ClsLoggerCore {
|
|
|
2031
2047
|
try {
|
|
2032
2048
|
const userRaw = this.userGenerateBaseFields ? this.userGenerateBaseFields() : undefined;
|
|
2033
2049
|
if (userRaw && isPlainObject(userRaw))
|
|
2034
|
-
user = normalizeFlatFields({ ...userRaw
|
|
2050
|
+
user = normalizeFlatFields({ ...userRaw }, 'generateBaseFields');
|
|
2035
2051
|
}
|
|
2036
2052
|
catch {
|
|
2037
2053
|
user = undefined;
|
package/dist/index.js
CHANGED
|
@@ -565,7 +565,17 @@ function getPagePath$1() {
|
|
|
565
565
|
function normalizeErrorLike(err, maxTextLength) {
|
|
566
566
|
if (err && typeof err === 'object') {
|
|
567
567
|
const anyErr = err;
|
|
568
|
-
|
|
568
|
+
let rawMsg = anyErr.message;
|
|
569
|
+
if (!rawMsg) {
|
|
570
|
+
const str = anyErr.toString?.();
|
|
571
|
+
if (!str || str === '[object Object]') {
|
|
572
|
+
rawMsg = stringifyLogValue(anyErr);
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
rawMsg = str;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
const message = truncate$2(String(rawMsg ?? ''), maxTextLength);
|
|
569
579
|
const name = truncate$2(String(anyErr.name ?? ''), 200);
|
|
570
580
|
const stack = truncate$2(String(anyErr.stack ?? ''), maxTextLength);
|
|
571
581
|
return { message, name, stack };
|
|
@@ -709,9 +719,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
709
719
|
try {
|
|
710
720
|
if (!sampleHit$1(options.sampleRate))
|
|
711
721
|
return;
|
|
722
|
+
const e = normalizeErrorLike(msg, options.maxTextLength);
|
|
712
723
|
const payload = {
|
|
713
724
|
source: 'wx.onError',
|
|
714
|
-
message:
|
|
725
|
+
message: e.message,
|
|
726
|
+
errorName: e.name,
|
|
727
|
+
stack: e.stack,
|
|
715
728
|
};
|
|
716
729
|
if (!shouldReport(buildErrorKey(options.reportType, payload)))
|
|
717
730
|
return;
|
|
@@ -763,9 +776,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
763
776
|
next.onError = function (...args) {
|
|
764
777
|
try {
|
|
765
778
|
if (sampleHit$1(options.sampleRate)) {
|
|
779
|
+
const e = normalizeErrorLike(args?.[0], options.maxTextLength);
|
|
766
780
|
const payload = {
|
|
767
781
|
source: 'App.onError',
|
|
768
|
-
message:
|
|
782
|
+
message: e.message,
|
|
783
|
+
errorName: e.name,
|
|
784
|
+
stack: e.stack,
|
|
769
785
|
};
|
|
770
786
|
if (shouldReport(buildErrorKey(options.reportType, payload)))
|
|
771
787
|
report(options.reportType, payload);
|
|
@@ -2035,7 +2051,7 @@ class ClsLoggerCore {
|
|
|
2035
2051
|
try {
|
|
2036
2052
|
const userRaw = this.userGenerateBaseFields ? this.userGenerateBaseFields() : undefined;
|
|
2037
2053
|
if (userRaw && isPlainObject(userRaw))
|
|
2038
|
-
user = normalizeFlatFields({ ...userRaw
|
|
2054
|
+
user = normalizeFlatFields({ ...userRaw }, 'generateBaseFields');
|
|
2039
2055
|
}
|
|
2040
2056
|
catch {
|
|
2041
2057
|
user = undefined;
|
package/dist/index.umd.js
CHANGED
|
@@ -567,7 +567,17 @@
|
|
|
567
567
|
function normalizeErrorLike(err, maxTextLength) {
|
|
568
568
|
if (err && typeof err === 'object') {
|
|
569
569
|
const anyErr = err;
|
|
570
|
-
|
|
570
|
+
let rawMsg = anyErr.message;
|
|
571
|
+
if (!rawMsg) {
|
|
572
|
+
const str = anyErr.toString?.();
|
|
573
|
+
if (!str || str === '[object Object]') {
|
|
574
|
+
rawMsg = stringifyLogValue(anyErr);
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
rawMsg = str;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
const message = truncate$2(String(rawMsg ?? ''), maxTextLength);
|
|
571
581
|
const name = truncate$2(String(anyErr.name ?? ''), 200);
|
|
572
582
|
const stack = truncate$2(String(anyErr.stack ?? ''), maxTextLength);
|
|
573
583
|
return { message, name, stack };
|
|
@@ -711,9 +721,12 @@
|
|
|
711
721
|
try {
|
|
712
722
|
if (!sampleHit$1(options.sampleRate))
|
|
713
723
|
return;
|
|
724
|
+
const e = normalizeErrorLike(msg, options.maxTextLength);
|
|
714
725
|
const payload = {
|
|
715
726
|
source: 'wx.onError',
|
|
716
|
-
message:
|
|
727
|
+
message: e.message,
|
|
728
|
+
errorName: e.name,
|
|
729
|
+
stack: e.stack,
|
|
717
730
|
};
|
|
718
731
|
if (!shouldReport(buildErrorKey(options.reportType, payload)))
|
|
719
732
|
return;
|
|
@@ -765,9 +778,12 @@
|
|
|
765
778
|
next.onError = function (...args) {
|
|
766
779
|
try {
|
|
767
780
|
if (sampleHit$1(options.sampleRate)) {
|
|
781
|
+
const e = normalizeErrorLike(args?.[0], options.maxTextLength);
|
|
768
782
|
const payload = {
|
|
769
783
|
source: 'App.onError',
|
|
770
|
-
message:
|
|
784
|
+
message: e.message,
|
|
785
|
+
errorName: e.name,
|
|
786
|
+
stack: e.stack,
|
|
771
787
|
};
|
|
772
788
|
if (shouldReport(buildErrorKey(options.reportType, payload)))
|
|
773
789
|
report(options.reportType, payload);
|
|
@@ -2037,7 +2053,7 @@
|
|
|
2037
2053
|
try {
|
|
2038
2054
|
const userRaw = this.userGenerateBaseFields ? this.userGenerateBaseFields() : undefined;
|
|
2039
2055
|
if (userRaw && isPlainObject(userRaw))
|
|
2040
|
-
user = normalizeFlatFields({ ...userRaw
|
|
2056
|
+
user = normalizeFlatFields({ ...userRaw }, 'generateBaseFields');
|
|
2041
2057
|
}
|
|
2042
2058
|
catch {
|
|
2043
2059
|
user = undefined;
|
package/dist/mini.esm.js
CHANGED
|
@@ -563,7 +563,17 @@ function getPagePath$1() {
|
|
|
563
563
|
function normalizeErrorLike(err, maxTextLength) {
|
|
564
564
|
if (err && typeof err === 'object') {
|
|
565
565
|
const anyErr = err;
|
|
566
|
-
|
|
566
|
+
let rawMsg = anyErr.message;
|
|
567
|
+
if (!rawMsg) {
|
|
568
|
+
const str = anyErr.toString?.();
|
|
569
|
+
if (!str || str === '[object Object]') {
|
|
570
|
+
rawMsg = stringifyLogValue(anyErr);
|
|
571
|
+
}
|
|
572
|
+
else {
|
|
573
|
+
rawMsg = str;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
const message = truncate$2(String(rawMsg ?? ''), maxTextLength);
|
|
567
577
|
const name = truncate$2(String(anyErr.name ?? ''), 200);
|
|
568
578
|
const stack = truncate$2(String(anyErr.stack ?? ''), maxTextLength);
|
|
569
579
|
return { message, name, stack };
|
|
@@ -707,9 +717,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
707
717
|
try {
|
|
708
718
|
if (!sampleHit$1(options.sampleRate))
|
|
709
719
|
return;
|
|
720
|
+
const e = normalizeErrorLike(msg, options.maxTextLength);
|
|
710
721
|
const payload = {
|
|
711
722
|
source: 'wx.onError',
|
|
712
|
-
message:
|
|
723
|
+
message: e.message,
|
|
724
|
+
errorName: e.name,
|
|
725
|
+
stack: e.stack,
|
|
713
726
|
};
|
|
714
727
|
if (!shouldReport(buildErrorKey(options.reportType, payload)))
|
|
715
728
|
return;
|
|
@@ -761,9 +774,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
761
774
|
next.onError = function (...args) {
|
|
762
775
|
try {
|
|
763
776
|
if (sampleHit$1(options.sampleRate)) {
|
|
777
|
+
const e = normalizeErrorLike(args?.[0], options.maxTextLength);
|
|
764
778
|
const payload = {
|
|
765
779
|
source: 'App.onError',
|
|
766
|
-
message:
|
|
780
|
+
message: e.message,
|
|
781
|
+
errorName: e.name,
|
|
782
|
+
stack: e.stack,
|
|
767
783
|
};
|
|
768
784
|
if (shouldReport(buildErrorKey(options.reportType, payload)))
|
|
769
785
|
report(options.reportType, payload);
|
|
@@ -2033,7 +2049,7 @@ class ClsLoggerCore {
|
|
|
2033
2049
|
try {
|
|
2034
2050
|
const userRaw = this.userGenerateBaseFields ? this.userGenerateBaseFields() : undefined;
|
|
2035
2051
|
if (userRaw && isPlainObject(userRaw))
|
|
2036
|
-
user = normalizeFlatFields({ ...userRaw
|
|
2052
|
+
user = normalizeFlatFields({ ...userRaw }, 'generateBaseFields');
|
|
2037
2053
|
}
|
|
2038
2054
|
catch {
|
|
2039
2055
|
user = undefined;
|
package/dist/mini.js
CHANGED
|
@@ -586,7 +586,17 @@ function getPagePath$1() {
|
|
|
586
586
|
function normalizeErrorLike(err, maxTextLength) {
|
|
587
587
|
if (err && typeof err === 'object') {
|
|
588
588
|
const anyErr = err;
|
|
589
|
-
|
|
589
|
+
let rawMsg = anyErr.message;
|
|
590
|
+
if (!rawMsg) {
|
|
591
|
+
const str = anyErr.toString?.();
|
|
592
|
+
if (!str || str === '[object Object]') {
|
|
593
|
+
rawMsg = stringifyLogValue(anyErr);
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
rawMsg = str;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
const message = truncate$2(String(rawMsg ?? ''), maxTextLength);
|
|
590
600
|
const name = truncate$2(String(anyErr.name ?? ''), 200);
|
|
591
601
|
const stack = truncate$2(String(anyErr.stack ?? ''), maxTextLength);
|
|
592
602
|
return { message, name, stack };
|
|
@@ -730,9 +740,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
730
740
|
try {
|
|
731
741
|
if (!sampleHit$1(options.sampleRate))
|
|
732
742
|
return;
|
|
743
|
+
const e = normalizeErrorLike(msg, options.maxTextLength);
|
|
733
744
|
const payload = {
|
|
734
745
|
source: 'wx.onError',
|
|
735
|
-
message:
|
|
746
|
+
message: e.message,
|
|
747
|
+
errorName: e.name,
|
|
748
|
+
stack: e.stack,
|
|
736
749
|
};
|
|
737
750
|
if (!shouldReport(buildErrorKey(options.reportType, payload)))
|
|
738
751
|
return;
|
|
@@ -784,9 +797,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
784
797
|
next.onError = function (...args) {
|
|
785
798
|
try {
|
|
786
799
|
if (sampleHit$1(options.sampleRate)) {
|
|
800
|
+
const e = normalizeErrorLike(args?.[0], options.maxTextLength);
|
|
787
801
|
const payload = {
|
|
788
802
|
source: 'App.onError',
|
|
789
|
-
message:
|
|
803
|
+
message: e.message,
|
|
804
|
+
errorName: e.name,
|
|
805
|
+
stack: e.stack,
|
|
790
806
|
};
|
|
791
807
|
if (shouldReport(buildErrorKey(options.reportType, payload)))
|
|
792
808
|
report(options.reportType, payload);
|
|
@@ -2056,7 +2072,7 @@ class ClsLoggerCore {
|
|
|
2056
2072
|
try {
|
|
2057
2073
|
const userRaw = this.userGenerateBaseFields ? this.userGenerateBaseFields() : undefined;
|
|
2058
2074
|
if (userRaw && isPlainObject(userRaw))
|
|
2059
|
-
user = normalizeFlatFields({ ...userRaw
|
|
2075
|
+
user = normalizeFlatFields({ ...userRaw }, 'generateBaseFields');
|
|
2060
2076
|
}
|
|
2061
2077
|
catch {
|
|
2062
2078
|
user = undefined;
|
package/dist/web.esm.js
CHANGED
|
@@ -563,7 +563,17 @@ function getPagePath$1() {
|
|
|
563
563
|
function normalizeErrorLike(err, maxTextLength) {
|
|
564
564
|
if (err && typeof err === 'object') {
|
|
565
565
|
const anyErr = err;
|
|
566
|
-
|
|
566
|
+
let rawMsg = anyErr.message;
|
|
567
|
+
if (!rawMsg) {
|
|
568
|
+
const str = anyErr.toString?.();
|
|
569
|
+
if (!str || str === '[object Object]') {
|
|
570
|
+
rawMsg = stringifyLogValue(anyErr);
|
|
571
|
+
}
|
|
572
|
+
else {
|
|
573
|
+
rawMsg = str;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
const message = truncate$2(String(rawMsg ?? ''), maxTextLength);
|
|
567
577
|
const name = truncate$2(String(anyErr.name ?? ''), 200);
|
|
568
578
|
const stack = truncate$2(String(anyErr.stack ?? ''), maxTextLength);
|
|
569
579
|
return { message, name, stack };
|
|
@@ -707,9 +717,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
707
717
|
try {
|
|
708
718
|
if (!sampleHit$1(options.sampleRate))
|
|
709
719
|
return;
|
|
720
|
+
const e = normalizeErrorLike(msg, options.maxTextLength);
|
|
710
721
|
const payload = {
|
|
711
722
|
source: 'wx.onError',
|
|
712
|
-
message:
|
|
723
|
+
message: e.message,
|
|
724
|
+
errorName: e.name,
|
|
725
|
+
stack: e.stack,
|
|
713
726
|
};
|
|
714
727
|
if (!shouldReport(buildErrorKey(options.reportType, payload)))
|
|
715
728
|
return;
|
|
@@ -761,9 +774,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
761
774
|
next.onError = function (...args) {
|
|
762
775
|
try {
|
|
763
776
|
if (sampleHit$1(options.sampleRate)) {
|
|
777
|
+
const e = normalizeErrorLike(args?.[0], options.maxTextLength);
|
|
764
778
|
const payload = {
|
|
765
779
|
source: 'App.onError',
|
|
766
|
-
message:
|
|
780
|
+
message: e.message,
|
|
781
|
+
errorName: e.name,
|
|
782
|
+
stack: e.stack,
|
|
767
783
|
};
|
|
768
784
|
if (shouldReport(buildErrorKey(options.reportType, payload)))
|
|
769
785
|
report(options.reportType, payload);
|
|
@@ -2033,7 +2049,7 @@ class ClsLoggerCore {
|
|
|
2033
2049
|
try {
|
|
2034
2050
|
const userRaw = this.userGenerateBaseFields ? this.userGenerateBaseFields() : undefined;
|
|
2035
2051
|
if (userRaw && isPlainObject(userRaw))
|
|
2036
|
-
user = normalizeFlatFields({ ...userRaw
|
|
2052
|
+
user = normalizeFlatFields({ ...userRaw }, 'generateBaseFields');
|
|
2037
2053
|
}
|
|
2038
2054
|
catch {
|
|
2039
2055
|
user = undefined;
|
package/dist/web.js
CHANGED
|
@@ -586,7 +586,17 @@ function getPagePath$1() {
|
|
|
586
586
|
function normalizeErrorLike(err, maxTextLength) {
|
|
587
587
|
if (err && typeof err === 'object') {
|
|
588
588
|
const anyErr = err;
|
|
589
|
-
|
|
589
|
+
let rawMsg = anyErr.message;
|
|
590
|
+
if (!rawMsg) {
|
|
591
|
+
const str = anyErr.toString?.();
|
|
592
|
+
if (!str || str === '[object Object]') {
|
|
593
|
+
rawMsg = stringifyLogValue(anyErr);
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
rawMsg = str;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
const message = truncate$2(String(rawMsg ?? ''), maxTextLength);
|
|
590
600
|
const name = truncate$2(String(anyErr.name ?? ''), 200);
|
|
591
601
|
const stack = truncate$2(String(anyErr.stack ?? ''), maxTextLength);
|
|
592
602
|
return { message, name, stack };
|
|
@@ -730,9 +740,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
730
740
|
try {
|
|
731
741
|
if (!sampleHit$1(options.sampleRate))
|
|
732
742
|
return;
|
|
743
|
+
const e = normalizeErrorLike(msg, options.maxTextLength);
|
|
733
744
|
const payload = {
|
|
734
745
|
source: 'wx.onError',
|
|
735
|
-
message:
|
|
746
|
+
message: e.message,
|
|
747
|
+
errorName: e.name,
|
|
748
|
+
stack: e.stack,
|
|
736
749
|
};
|
|
737
750
|
if (!shouldReport(buildErrorKey(options.reportType, payload)))
|
|
738
751
|
return;
|
|
@@ -784,9 +797,12 @@ function installMiniProgramErrorMonitor(report, options) {
|
|
|
784
797
|
next.onError = function (...args) {
|
|
785
798
|
try {
|
|
786
799
|
if (sampleHit$1(options.sampleRate)) {
|
|
800
|
+
const e = normalizeErrorLike(args?.[0], options.maxTextLength);
|
|
787
801
|
const payload = {
|
|
788
802
|
source: 'App.onError',
|
|
789
|
-
message:
|
|
803
|
+
message: e.message,
|
|
804
|
+
errorName: e.name,
|
|
805
|
+
stack: e.stack,
|
|
790
806
|
};
|
|
791
807
|
if (shouldReport(buildErrorKey(options.reportType, payload)))
|
|
792
808
|
report(options.reportType, payload);
|
|
@@ -2056,7 +2072,7 @@ class ClsLoggerCore {
|
|
|
2056
2072
|
try {
|
|
2057
2073
|
const userRaw = this.userGenerateBaseFields ? this.userGenerateBaseFields() : undefined;
|
|
2058
2074
|
if (userRaw && isPlainObject(userRaw))
|
|
2059
|
-
user = normalizeFlatFields({ ...userRaw
|
|
2075
|
+
user = normalizeFlatFields({ ...userRaw }, 'generateBaseFields');
|
|
2060
2076
|
}
|
|
2061
2077
|
catch {
|
|
2062
2078
|
user = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@be-link/cls-logger",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.8",
|
|
4
4
|
"description": "@be-link cls-logger - 腾讯云 CLS 日志上报封装",
|
|
5
5
|
"homepage": "https://github.com/snowmountain-top/be-link",
|
|
6
6
|
"author": "zhuiyi",
|
|
@@ -27,6 +27,17 @@
|
|
|
27
27
|
"import": "./dist/mini.esm.js",
|
|
28
28
|
"require": "./dist/mini.js",
|
|
29
29
|
"default": "./dist/mini.esm.js"
|
|
30
|
+
},
|
|
31
|
+
"./dist/*": "./dist/*"
|
|
32
|
+
},
|
|
33
|
+
"typesVersions": {
|
|
34
|
+
"*": {
|
|
35
|
+
"web": [
|
|
36
|
+
"./dist/web.d.ts"
|
|
37
|
+
],
|
|
38
|
+
"mini": [
|
|
39
|
+
"./dist/mini.d.ts"
|
|
40
|
+
]
|
|
30
41
|
}
|
|
31
42
|
},
|
|
32
43
|
"files": [
|