logixia 2.0.0 → 2.0.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/README.md +46 -29
- package/dist/async-context-B05ArHgM.mjs +134 -0
- package/dist/async-context-B05ArHgM.mjs.map +1 -0
- package/dist/async-context-DTQgi8f7.js +150 -0
- package/dist/async-context-DTQgi8f7.js.map +1 -0
- package/dist/{azure-monitor.transport-CHnjVRF-.mjs → azure-monitor.transport-BPbgjATu.mjs} +27 -15
- package/dist/azure-monitor.transport-BPbgjATu.mjs.map +1 -0
- package/dist/{azure-monitor.transport-Cn_3Usvu.d.ts → azure-monitor.transport-C7kYyZUW.d.mts} +3 -6
- package/dist/azure-monitor.transport-C7kYyZUW.d.mts.map +1 -0
- package/dist/{azure-monitor.transport-CrvfHd9C.js → azure-monitor.transport-CwbOLZHB.js} +32 -20
- package/dist/azure-monitor.transport-CwbOLZHB.js.map +1 -0
- package/dist/{azure-monitor.transport-D7Da4RAb.d.mts → azure-monitor.transport-DV03Z5P4.d.ts} +3 -6
- package/dist/azure-monitor.transport-DV03Z5P4.d.ts.map +1 -0
- package/dist/azure.d.mts +1 -2
- package/dist/azure.d.ts +1 -2
- package/dist/azure.js +3 -6
- package/dist/azure.mjs +1 -6
- package/dist/{batch-buffer-PGvSgbmd.mjs → batch-buffer-0fgLmIPn.mjs} +21 -7
- package/dist/batch-buffer-0fgLmIPn.mjs.map +1 -0
- package/dist/{batch-buffer-BY-mRWIK.js → batch-buffer-DT4gdXmf.js} +53 -40
- package/dist/batch-buffer-DT4gdXmf.js.map +1 -0
- package/dist/browser.d.mts +45 -25
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.d.ts +45 -25
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +420 -53
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +421 -56
- package/dist/browser.mjs.map +1 -1
- package/dist/{builder-0gEzRopq.mjs → builder-D70z6kjj.mjs} +212 -104
- package/dist/builder-D70z6kjj.mjs.map +1 -0
- package/dist/{builder-D44QktIo.js → builder-M7NoaugM.js} +355 -249
- package/dist/builder-M7NoaugM.js.map +1 -0
- package/dist/cli/index.js +59 -59
- package/dist/cloudwatch.d.mts +1 -2
- package/dist/cloudwatch.d.ts +1 -2
- package/dist/cloudwatch.js +3 -7
- package/dist/cloudwatch.mjs +1 -7
- package/dist/{cloudwatch.transport-BO1ahxw-.js → cloudwatch.transport-B2wKQFF7.js} +61 -36
- package/dist/cloudwatch.transport-B2wKQFF7.js.map +1 -0
- package/dist/{cloudwatch.transport-DZ6ies7g.mjs → cloudwatch.transport-BTvYfLs9.mjs} +54 -28
- package/dist/cloudwatch.transport-BTvYfLs9.mjs.map +1 -0
- package/dist/{cloudwatch.transport-DsEq633o.d.ts → cloudwatch.transport-Bf7L4I59.d.ts} +2 -6
- package/dist/cloudwatch.transport-Bf7L4I59.d.ts.map +1 -0
- package/dist/{cloudwatch.transport-UlyZFWMn.d.mts → cloudwatch.transport-Rj4yTpRn.d.mts} +2 -6
- package/dist/cloudwatch.transport-Rj4yTpRn.d.mts.map +1 -0
- package/dist/{coerce.utils-Cu6IUTgX.mjs → coerce.utils-B_rEudCn.mjs} +3 -4
- package/dist/{coerce.utils-Cu6IUTgX.mjs.map → coerce.utils-B_rEudCn.mjs.map} +1 -1
- package/dist/{coerce.utils-B-LilukN.js → coerce.utils-C1C5sIX0.js} +8 -10
- package/dist/{coerce.utils-B-LilukN.js.map → coerce.utils-C1C5sIX0.js.map} +1 -1
- package/dist/correlation.d.mts +13 -16
- package/dist/correlation.d.mts.map +1 -1
- package/dist/correlation.d.ts +13 -16
- package/dist/correlation.d.ts.map +1 -1
- package/dist/correlation.js +58 -9
- package/dist/correlation.js.map +1 -1
- package/dist/correlation.mjs +56 -6
- package/dist/correlation.mjs.map +1 -1
- package/dist/{entry-fields-BJkuPnIg.mjs → entry-fields-CGuvT2R0.mjs} +5 -6
- package/dist/entry-fields-CGuvT2R0.mjs.map +1 -0
- package/dist/{entry-fields-BvOLFlJ4.js → entry-fields-RLd1jCoR.js} +10 -12
- package/dist/entry-fields-RLd1jCoR.js.map +1 -0
- package/dist/gcp.d.mts +1 -2
- package/dist/gcp.d.ts +1 -2
- package/dist/gcp.js +3 -7
- package/dist/gcp.mjs +1 -7
- package/dist/{gcp.transport-B7oc97sG.d.ts → gcp.transport-C5D72b1g.d.mts} +3 -6
- package/dist/gcp.transport-C5D72b1g.d.mts.map +1 -0
- package/dist/{gcp.transport-GrJurKo8.d.mts → gcp.transport-CFQfdAOK.d.ts} +3 -6
- package/dist/gcp.transport-CFQfdAOK.d.ts.map +1 -0
- package/dist/{gcp.transport-DBX5TPIy.mjs → gcp.transport-CGKopAhQ.mjs} +55 -16
- package/dist/gcp.transport-CGKopAhQ.mjs.map +1 -0
- package/dist/{gcp.transport-CHV8MGgz.js → gcp.transport-KZe9hCAR.js} +60 -22
- package/dist/gcp.transport-KZe9hCAR.js.map +1 -0
- package/dist/{index-DhIoploR.d.ts → index-DwozbmB4.d.ts} +3 -8
- package/dist/index-DwozbmB4.d.ts.map +1 -0
- package/dist/{index-3mw5gaCw.d.mts → index-xqaJtAZn.d.mts} +3 -8
- package/dist/index-xqaJtAZn.d.mts.map +1 -0
- package/dist/index.d.mts +106 -165
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +105 -164
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +164 -261
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +147 -243
- package/dist/index.mjs.map +1 -1
- package/dist/internal-log-b0Vp4qrB.js +183 -0
- package/dist/internal-log-b0Vp4qrB.js.map +1 -0
- package/dist/internal-log-uCSd1PMc.mjs +142 -0
- package/dist/internal-log-uCSd1PMc.mjs.map +1 -0
- package/dist/{logitron-logger-UVeN-mQm.d.ts → logitron-logger-D2B75Oc7.d.ts} +116 -8
- package/dist/logitron-logger-D2B75Oc7.d.ts.map +1 -0
- package/dist/{logitron-logger-BFDSO8Io.d.mts → logitron-logger-oEd6wNhf.d.mts} +116 -8
- package/dist/logitron-logger-oEd6wNhf.d.mts.map +1 -0
- package/dist/middleware.d.mts +10 -12
- package/dist/middleware.d.mts.map +1 -1
- package/dist/middleware.d.ts +10 -12
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +16 -47
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs +13 -45
- package/dist/middleware.mjs.map +1 -1
- package/dist/nest.d.mts +26 -44
- package/dist/nest.d.mts.map +1 -1
- package/dist/nest.d.ts +26 -44
- package/dist/nest.d.ts.map +1 -1
- package/dist/nest.js +116 -132
- package/dist/nest.js.map +1 -1
- package/dist/nest.mjs +59 -73
- package/dist/nest.mjs.map +1 -1
- package/dist/{trace.utils-CvXgaiQT.mjs → request-trace-C_fvIDv4.mjs} +44 -9
- package/dist/request-trace-C_fvIDv4.mjs.map +1 -0
- package/dist/{trace.utils-DpBOLDtq.js → request-trace-wTJdKp6-.js} +121 -77
- package/dist/request-trace-wTJdKp6-.js.map +1 -0
- package/dist/rolldown-runtime-D3PmRqjj.mjs +4 -0
- package/dist/{safe-stringify-DJ66tW5I.mjs → safe-stringify-BMRl3EX3.mjs} +3 -4
- package/dist/safe-stringify-BMRl3EX3.mjs.map +1 -0
- package/dist/{safe-stringify-DWo3aZp_.js → safe-stringify-DLz1Kz3o.js} +23 -25
- package/dist/safe-stringify-DLz1Kz3o.js.map +1 -0
- package/dist/{search-CNh9uVwR.d.ts → search-BH33XhuU.d.mts} +2 -22
- package/dist/search-BH33XhuU.d.mts.map +1 -0
- package/dist/{search-BFbu_oVn.mjs → search-CWMVYC-R.mjs} +22 -39
- package/dist/search-CWMVYC-R.mjs.map +1 -0
- package/dist/{search-DXANsQ2n.d.mts → search-CazwyX5Z.d.ts} +2 -22
- package/dist/search-CazwyX5Z.d.ts.map +1 -0
- package/dist/{search-C4V0OMEn.js → search-DUfWuzFP.js} +52 -69
- package/dist/search-DUfWuzFP.js.map +1 -0
- package/dist/search.d.mts +2 -4
- package/dist/search.d.ts +2 -4
- package/dist/search.js +3 -4
- package/dist/search.mjs +1 -4
- package/dist/secret-config-BegMLkYl.mjs +209 -0
- package/dist/secret-config-BegMLkYl.mjs.map +1 -0
- package/dist/secret-config-CBZBs0p1.js +271 -0
- package/dist/secret-config-CBZBs0p1.js.map +1 -0
- package/dist/{slack.transport-Bzw7sucI.mjs → slack.transport-Ce96JBDk.mjs} +212 -31
- package/dist/slack.transport-Ce96JBDk.mjs.map +1 -0
- package/dist/{slack.transport-BfJRouB2.js → slack.transport-Dlx3xvb7.js} +234 -41
- package/dist/slack.transport-Dlx3xvb7.js.map +1 -0
- package/dist/{slack.transport-BZzoXDPn.d.mts → slack.transport-DrirgDNy.d.ts} +56 -9
- package/dist/slack.transport-DrirgDNy.d.ts.map +1 -0
- package/dist/{slack.transport-CXjQYOes.d.ts → slack.transport-DxHOXlLu.d.mts} +56 -9
- package/dist/slack.transport-DxHOXlLu.d.mts.map +1 -0
- package/dist/testing.d.mts +3 -8
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.d.ts +3 -8
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +3 -4
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +2 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/{transport.manager-CXbKKdVE.js → transport.manager-DkcEOlqV.js} +164 -160
- package/dist/transport.manager-DkcEOlqV.js.map +1 -0
- package/dist/{transport.manager-BiuCAJd2.mjs → transport.manager-eZ_EeC00.mjs} +108 -99
- package/dist/transport.manager-eZ_EeC00.mjs.map +1 -0
- package/dist/{transport.types-CGoHpWQR.d.ts → transport.types-BJVL1QQl.d.mts} +1 -3
- package/dist/transport.types-BJVL1QQl.d.mts.map +1 -0
- package/dist/{transport.types-BMnurPcc.d.mts → transport.types-BJVL1QQl.d.ts} +1 -3
- package/dist/transport.types-BJVL1QQl.d.ts.map +1 -0
- package/dist/transports.d.mts +22 -36
- package/dist/transports.d.mts.map +1 -1
- package/dist/transports.d.ts +22 -36
- package/dist/transports.d.ts.map +1 -1
- package/dist/transports.js +10 -13
- package/dist/transports.mjs +7 -13
- package/dist/worker-entry.js +337 -87
- package/dist/worker.d.mts +1 -2
- package/dist/worker.d.ts +1 -2
- package/dist/worker.js +3 -4
- package/dist/worker.mjs +1 -4
- package/dist/{worker.transport-CdzSZJmw.d.ts → worker.transport-BuPwBi3d.d.ts} +2 -6
- package/dist/worker.transport-BuPwBi3d.d.ts.map +1 -0
- package/dist/{worker.transport-BdPxu3PN.js → worker.transport-C6GNl_r2.js} +44 -14
- package/dist/worker.transport-C6GNl_r2.js.map +1 -0
- package/dist/{worker.transport-lPxO2MVL.mjs → worker.transport-DLVA4y2e.mjs} +39 -9
- package/dist/worker.transport-DLVA4y2e.mjs.map +1 -0
- package/dist/{worker.transport-JvGPog3C.d.mts → worker.transport-hJay1wxA.d.mts} +2 -6
- package/dist/worker.transport-hJay1wxA.d.mts.map +1 -0
- package/package.json +19 -11
- package/dist/async-context-BzJrbfQs.mjs +0 -72
- package/dist/async-context-BzJrbfQs.mjs.map +0 -1
- package/dist/async-context-DyQQYq3I.js +0 -92
- package/dist/async-context-DyQQYq3I.js.map +0 -1
- package/dist/azure-monitor.transport-CHnjVRF-.mjs.map +0 -1
- package/dist/azure-monitor.transport-Cn_3Usvu.d.ts.map +0 -1
- package/dist/azure-monitor.transport-CrvfHd9C.js.map +0 -1
- package/dist/azure-monitor.transport-D7Da4RAb.d.mts.map +0 -1
- package/dist/batch-buffer-BY-mRWIK.js.map +0 -1
- package/dist/batch-buffer-PGvSgbmd.mjs.map +0 -1
- package/dist/builder-0gEzRopq.mjs.map +0 -1
- package/dist/builder-D44QktIo.js.map +0 -1
- package/dist/chunk-DLSkYcPk.mjs +0 -7
- package/dist/chunk-nOFOJqeH.js +0 -30
- package/dist/cloudwatch.transport-BO1ahxw-.js.map +0 -1
- package/dist/cloudwatch.transport-DZ6ies7g.mjs.map +0 -1
- package/dist/cloudwatch.transport-DsEq633o.d.ts.map +0 -1
- package/dist/cloudwatch.transport-UlyZFWMn.d.mts.map +0 -1
- package/dist/entry-fields-BJkuPnIg.mjs.map +0 -1
- package/dist/entry-fields-BvOLFlJ4.js.map +0 -1
- package/dist/gcp.transport-B7oc97sG.d.ts.map +0 -1
- package/dist/gcp.transport-CHV8MGgz.js.map +0 -1
- package/dist/gcp.transport-DBX5TPIy.mjs.map +0 -1
- package/dist/gcp.transport-GrJurKo8.d.mts.map +0 -1
- package/dist/index-3mw5gaCw.d.mts.map +0 -1
- package/dist/index-DhIoploR.d.ts.map +0 -1
- package/dist/internal-log-BUJYMZbE.js +0 -70
- package/dist/internal-log-BUJYMZbE.js.map +0 -1
- package/dist/internal-log-Cm8SOWSV.mjs +0 -52
- package/dist/internal-log-Cm8SOWSV.mjs.map +0 -1
- package/dist/logitron-logger-BFDSO8Io.d.mts.map +0 -1
- package/dist/logitron-logger-UVeN-mQm.d.ts.map +0 -1
- package/dist/safe-stringify-DJ66tW5I.mjs.map +0 -1
- package/dist/safe-stringify-DWo3aZp_.js.map +0 -1
- package/dist/search-BFbu_oVn.mjs.map +0 -1
- package/dist/search-C4V0OMEn.js.map +0 -1
- package/dist/search-CNh9uVwR.d.ts.map +0 -1
- package/dist/search-DXANsQ2n.d.mts.map +0 -1
- package/dist/slack.transport-BZzoXDPn.d.mts.map +0 -1
- package/dist/slack.transport-BfJRouB2.js.map +0 -1
- package/dist/slack.transport-Bzw7sucI.mjs.map +0 -1
- package/dist/slack.transport-CXjQYOes.d.ts.map +0 -1
- package/dist/trace.utils-CvXgaiQT.mjs.map +0 -1
- package/dist/trace.utils-DpBOLDtq.js.map +0 -1
- package/dist/transport.manager-BiuCAJd2.mjs.map +0 -1
- package/dist/transport.manager-CXbKKdVE.js.map +0 -1
- package/dist/transport.types-BMnurPcc.d.mts.map +0 -1
- package/dist/transport.types-CGoHpWQR.d.ts.map +0 -1
- package/dist/worker.transport-BdPxu3PN.js.map +0 -1
- package/dist/worker.transport-CdzSZJmw.d.ts.map +0 -1
- package/dist/worker.transport-JvGPog3C.d.mts.map +0 -1
- package/dist/worker.transport-lPxO2MVL.mjs.map +0 -1
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,258 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
// src/utils/sensitive-names.ts
|
|
3
|
+
/**
|
|
4
|
+
* The one list of sensitive names. Log redaction (redact.utils), the HTTP logger
|
|
5
|
+
* middleware and transport secret handling (transports/secret-config) all read it,
|
|
6
|
+
* so the lists cannot drift. No imports: safe from any module, including browser code.
|
|
7
|
+
*/
|
|
8
|
+
/** Field names redacted by name, wherever they appear in logged data. */
|
|
9
|
+
const SENSITIVE_KEY_NAMES = [
|
|
10
|
+
"password",
|
|
11
|
+
"passwd",
|
|
12
|
+
"secret",
|
|
13
|
+
"token",
|
|
14
|
+
"apiKey",
|
|
15
|
+
"api_key",
|
|
16
|
+
"accessToken",
|
|
17
|
+
"access_token",
|
|
18
|
+
"refreshToken",
|
|
19
|
+
"refresh_token",
|
|
20
|
+
"authorization",
|
|
21
|
+
"credentials",
|
|
22
|
+
"privateKey",
|
|
23
|
+
"private_key",
|
|
24
|
+
"clientSecret",
|
|
25
|
+
"client_secret",
|
|
26
|
+
"cookie",
|
|
27
|
+
"set-cookie",
|
|
28
|
+
"x-api-key",
|
|
29
|
+
"session",
|
|
30
|
+
"proxy-authorization",
|
|
31
|
+
"x-auth-token",
|
|
32
|
+
"x-access-token",
|
|
33
|
+
"aws_secret_access_key",
|
|
34
|
+
"awsSecretAccessKey",
|
|
35
|
+
"secretAccessKey"
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* Extra names that only mean "secret" inside transport configuration, where
|
|
39
|
+
* short words like `key` or `signature` are credentials, not log fields.
|
|
40
|
+
*/
|
|
41
|
+
const TRANSPORT_CONFIG_SECRET_NAMES = [
|
|
42
|
+
"writeKey",
|
|
43
|
+
"apiSecret",
|
|
44
|
+
"connectionString",
|
|
45
|
+
"sessionToken",
|
|
46
|
+
"passphrase",
|
|
47
|
+
"signature",
|
|
48
|
+
"pwd",
|
|
49
|
+
"pfx",
|
|
50
|
+
"cert",
|
|
51
|
+
"key",
|
|
52
|
+
"auth"
|
|
53
|
+
];
|
|
54
|
+
/** Query-string parameters whose values are never logged. */
|
|
55
|
+
const DEFAULT_REDACT_QUERY_PARAMS = [
|
|
56
|
+
"token",
|
|
57
|
+
"access_token",
|
|
58
|
+
"refresh_token",
|
|
59
|
+
"code",
|
|
60
|
+
"password",
|
|
61
|
+
"secret",
|
|
62
|
+
"api_key",
|
|
63
|
+
"apikey",
|
|
64
|
+
"key",
|
|
65
|
+
"signature",
|
|
66
|
+
"sig",
|
|
67
|
+
"auth"
|
|
68
|
+
];
|
|
69
|
+
// src/transports/secret-config.ts
|
|
70
|
+
/**
|
|
71
|
+
* Keeps credentials out of serialized transport output and error text.
|
|
72
|
+
*
|
|
73
|
+
* `protectSecrets()` replaces each listed field with a non-enumerable accessor backed
|
|
74
|
+
* by a WeakMap, whether or not the field is assigned yet, so later assignments (a
|
|
75
|
+
* connection opened on first write, a refreshed token) stay hidden too. It also
|
|
76
|
+
* installs `toJSON()` and a Node inspect hook returning a redacted view: scalar
|
|
77
|
+
* fields stay for debugging, secret-looking keys become '[REDACTED]', URLs lose
|
|
78
|
+
* userinfo, query and fragment. No Node imports, so browser bundles can use it.
|
|
79
|
+
*/
|
|
80
|
+
const REDACTED = "[REDACTED]";
|
|
81
|
+
const INSPECT_CUSTOM = Symbol.for("nodejs.util.inspect.custom");
|
|
82
|
+
const MAX_DEPTH = 4;
|
|
83
|
+
const SCHEME_PREFIX = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
84
|
+
function normalizeName(name) {
|
|
85
|
+
return name.toLowerCase().replaceAll("-", "").replaceAll("_", "");
|
|
86
|
+
}
|
|
87
|
+
const SECRET_NAMES = [...SENSITIVE_KEY_NAMES, ...TRANSPORT_CONFIG_SECRET_NAMES].map(normalizeName);
|
|
88
|
+
new Set(DEFAULT_REDACT_QUERY_PARAMS.map(normalizeName));
|
|
89
|
+
/** Exact match for short names (`key`, `pfx`), suffix match for longer ones (`azureClientSecret`). */
|
|
90
|
+
function isSecretKey(key) {
|
|
91
|
+
const name = normalizeName(key);
|
|
92
|
+
return SECRET_NAMES.some((n) => name === n || n.length >= 5 && name.endsWith(n));
|
|
93
|
+
}
|
|
94
|
+
function isUrlKey(key) {
|
|
95
|
+
return /url|uri|endpoint|href/i.test(key);
|
|
96
|
+
}
|
|
97
|
+
function isPlainObject(value) {
|
|
98
|
+
const proto = Object.getPrototypeOf(value);
|
|
99
|
+
return proto === Object.prototype || proto === null;
|
|
100
|
+
}
|
|
101
|
+
/** Absolute URL: `scheme://host` only. Relative or unparseable: path kept, query and fragment cut. */
|
|
102
|
+
function redactUrl(raw) {
|
|
103
|
+
if (typeof raw !== "string") return `${raw.protocol}//${raw.host}`;
|
|
104
|
+
if (SCHEME_PREFIX.test(raw)) try {
|
|
105
|
+
const url = new URL(raw);
|
|
106
|
+
return `${url.protocol}//${url.host}`;
|
|
107
|
+
} catch {
|
|
108
|
+
return REDACTED;
|
|
109
|
+
}
|
|
110
|
+
return raw.split(/[?#]/, 1)[0] ?? "";
|
|
111
|
+
}
|
|
112
|
+
function redactHeaders(headers) {
|
|
113
|
+
if (!headers || typeof headers !== "object") return headers;
|
|
114
|
+
return Object.fromEntries(Object.keys(headers).map((name) => [name, REDACTED]));
|
|
115
|
+
}
|
|
116
|
+
/** Redacted deep copy of a config-like value. Never throws, never returns a secret. */
|
|
117
|
+
function redactConfig(value, depth = 0, key = "") {
|
|
118
|
+
var _value$constructor;
|
|
119
|
+
if (value === null || value === void 0) return value;
|
|
120
|
+
if (typeof value === "string") return SCHEME_PREFIX.test(value) || isUrlKey(key) ? redactUrl(value) : value;
|
|
121
|
+
if (typeof value === "number" || typeof value === "boolean") return value;
|
|
122
|
+
if (typeof value === "function") return "[Function]";
|
|
123
|
+
if (typeof value !== "object") return "[Unserializable]";
|
|
124
|
+
if (typeof URL !== "undefined" && value instanceof URL) return redactUrl(value);
|
|
125
|
+
if (Array.isArray(value)) return depth >= MAX_DEPTH ? "[Array]" : value.map((v) => redactConfig(v, depth + 1, key));
|
|
126
|
+
if (!isPlainObject(value) || depth >= MAX_DEPTH) return `[${((_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name) ?? "Object"}]`;
|
|
127
|
+
const out = {};
|
|
128
|
+
for (const [name, inner] of Object.entries(value)) if (isSecretKey(name)) out[name] = inner === void 0 ? void 0 : REDACTED;
|
|
129
|
+
else if (name.toLowerCase() === "headers") out[name] = redactHeaders(inner);
|
|
130
|
+
else out[name] = redactConfig(inner, depth + 1, name);
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
const hiddenKeys = /* @__PURE__ */ new WeakMap();
|
|
134
|
+
const hiddenValues = /* @__PURE__ */ new WeakMap();
|
|
135
|
+
function viewOf(target) {
|
|
136
|
+
var _target$constructor;
|
|
137
|
+
const hidden = hiddenKeys.get(target) ?? /* @__PURE__ */ new Set();
|
|
138
|
+
const values = hiddenValues.get(target);
|
|
139
|
+
const view = { class: (_target$constructor = target.constructor) === null || _target$constructor === void 0 ? void 0 : _target$constructor.name };
|
|
140
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(target), ...hidden])) {
|
|
141
|
+
const inner = hidden.has(key) ? values === null || values === void 0 ? void 0 : values.get(key) : target[key];
|
|
142
|
+
if (isSecretKey(key)) view[key] = inner === void 0 ? void 0 : REDACTED;
|
|
143
|
+
else if (key.toLowerCase() === "headers") view[key] = redactHeaders(inner);
|
|
144
|
+
else if (inner !== null && typeof inner === "object" && !hidden.has(key) && !(inner instanceof URL)) view[key] = "[Object]";
|
|
145
|
+
else if (hidden.has(key) && typeof inner === "string" && !isUrlKey(key)) view[key] = REDACTED;
|
|
146
|
+
else view[key] = redactConfig(inner, 0, key);
|
|
147
|
+
}
|
|
148
|
+
return view;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Hides `keys` on `target` (assigned or not yet) and gives it a redacted `toJSON()` /
|
|
152
|
+
* inspect view. Fields stay readable and writable. Safe to call more than once.
|
|
153
|
+
* Throws when the target cannot carry the protection (frozen or sealed), instead of
|
|
154
|
+
* silently leaving the secret enumerable.
|
|
155
|
+
*/
|
|
156
|
+
function protectSecrets(target, keys) {
|
|
157
|
+
if (!Object.isExtensible(target)) {
|
|
158
|
+
var _target$constructor2;
|
|
159
|
+
throw new TypeError(`protectSecrets: ${((_target$constructor2 = target.constructor) === null || _target$constructor2 === void 0 ? void 0 : _target$constructor2.name) ?? "object"} is not extensible`);
|
|
160
|
+
}
|
|
161
|
+
let hidden = hiddenKeys.get(target);
|
|
162
|
+
let values = hiddenValues.get(target);
|
|
163
|
+
if (!hidden || !values) {
|
|
164
|
+
hidden = /* @__PURE__ */ new Set();
|
|
165
|
+
values = /* @__PURE__ */ new Map();
|
|
166
|
+
hiddenKeys.set(target, hidden);
|
|
167
|
+
hiddenValues.set(target, values);
|
|
168
|
+
const view = () => viewOf(target);
|
|
169
|
+
Object.defineProperty(target, "toJSON", {
|
|
170
|
+
value: view,
|
|
171
|
+
enumerable: false,
|
|
172
|
+
configurable: true
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(target, INSPECT_CUSTOM, {
|
|
175
|
+
value: view,
|
|
176
|
+
enumerable: false,
|
|
177
|
+
configurable: true
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
const store = values;
|
|
181
|
+
for (const key of keys) {
|
|
182
|
+
if (hidden.has(key)) continue;
|
|
183
|
+
const desc = Object.getOwnPropertyDescriptor(target, key);
|
|
184
|
+
if (desc && !desc.configurable) throw new TypeError(`protectSecrets: "${key}" is not configurable`);
|
|
185
|
+
if (desc && "value" in desc) store.set(key, desc.value);
|
|
186
|
+
hidden.add(key);
|
|
187
|
+
Object.defineProperty(target, key, {
|
|
188
|
+
enumerable: false,
|
|
189
|
+
configurable: true,
|
|
190
|
+
get: () => store.get(key),
|
|
191
|
+
set: (next) => void store.set(key, next)
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// src/utils/internal-log.ts
|
|
196
|
+
/**
|
|
197
|
+
* Internal logging helpers for use within the logixia library itself.
|
|
198
|
+
*
|
|
199
|
+
* These functions write directly to stderr/stdout without going through
|
|
200
|
+
* LogixiaLogger — this avoids circular dependencies and ensures internal
|
|
201
|
+
* diagnostics still surface even when the logger is misconfigured.
|
|
202
|
+
*
|
|
203
|
+
* Library code must NEVER call console.log/warn/error directly. Use these
|
|
204
|
+
* helpers instead so that internal output can be silenced in tests by setting
|
|
205
|
+
* the LOGIXIA_SILENT_INTERNAL=1 environment variable.
|
|
206
|
+
*/
|
|
207
|
+
/**
|
|
208
|
+
* Read the silence flag on each call rather than caching it at import time, so
|
|
209
|
+
* setting LOGIXIA_SILENT_INTERNAL=1 AFTER the module is first imported (e.g. in
|
|
210
|
+
* a test setup file) still takes effect — the documented test-silencing
|
|
211
|
+
* behavior was previously unreliable because the value was frozen at load.
|
|
212
|
+
*/
|
|
213
|
+
function isSilent() {
|
|
214
|
+
var _process$env;
|
|
215
|
+
if (typeof process !== "undefined" && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.LOGIXIA_SILENT_INTERNAL) === "1") return true;
|
|
216
|
+
const flag = globalThis["LOGIXIA_SILENT_INTERNAL"];
|
|
217
|
+
return flag === "1" || flag === 1 || flag === true;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Write a line to stderr, falling back to the matching console method where
|
|
221
|
+
* `process` is unavailable (browsers, Cloudflare Workers, Deno without Node compat).
|
|
222
|
+
*/
|
|
223
|
+
function writeLine(method, line) {
|
|
224
|
+
var _process$stderr;
|
|
225
|
+
if (typeof process !== "undefined" && typeof ((_process$stderr = process.stderr) === null || _process$stderr === void 0 ? void 0 : _process$stderr.write) === "function") process.stderr.write(`${line}\n`);
|
|
226
|
+
else if (typeof console !== "undefined" && typeof console[method] === "function") console[method](line);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Emit an internal debug/info message to stderr.
|
|
230
|
+
* Use for field-enable/disable notifications that a developer might want to see
|
|
231
|
+
* during development but should not appear in production log streams.
|
|
232
|
+
*/
|
|
233
|
+
function internalLog(message) {
|
|
234
|
+
if (!isSilent()) writeLine("log", `[logixia] ${message}`);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Emit an internal warning to stderr.
|
|
238
|
+
* Use when something is misconfigured but logixia can continue operating.
|
|
239
|
+
*/
|
|
240
|
+
function internalWarn(message) {
|
|
241
|
+
if (!isSilent()) writeLine("warn", `[logixia:warn] ${message}`);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Emit an internal error to stderr.
|
|
245
|
+
* Use when a transport write fails or a serious internal error occurs.
|
|
246
|
+
*/
|
|
247
|
+
function internalError(message, error) {
|
|
248
|
+
if (!isSilent()) {
|
|
249
|
+
let errStr = "";
|
|
250
|
+
if (error instanceof Error) errStr = ` — ${error.message}`;
|
|
251
|
+
else if (error != null) errStr = ` — ${String(error)}`;
|
|
252
|
+
writeLine("error", `[logixia:error] ${message}${errStr}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// src/utils/safe-stringify.ts
|
|
3
256
|
/** Build a JSONPath like `$["a"][0]["b"]` for a decycle pointer. */
|
|
4
257
|
function jsonPath(parts) {
|
|
5
258
|
let path = "$";
|
|
@@ -83,9 +336,7 @@ function stringifyForLog(value) {
|
|
|
83
336
|
}
|
|
84
337
|
}
|
|
85
338
|
}
|
|
86
|
-
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/utils/otel.ts
|
|
339
|
+
// src/utils/otel.ts
|
|
89
340
|
let _otelApi;
|
|
90
341
|
function tryLoadOtelApi() {
|
|
91
342
|
if (_otelApi !== void 0) return _otelApi;
|
|
@@ -149,7 +400,6 @@ function getOtelMetaFields(opts = {}) {
|
|
|
149
400
|
[traceFlagsField]: ctx.traceFlags
|
|
150
401
|
};
|
|
151
402
|
}
|
|
152
|
-
let _bridgeOptions = null;
|
|
153
403
|
/**
|
|
154
404
|
* Initialise the global OTel bridge.
|
|
155
405
|
*
|
|
@@ -163,48 +413,59 @@ let _bridgeOptions = null;
|
|
|
163
413
|
* initOtelBridge();
|
|
164
414
|
* ```
|
|
165
415
|
*/
|
|
166
|
-
function initOtelBridge(opts = {}) {
|
|
167
|
-
_bridgeOptions = opts;
|
|
168
|
-
}
|
|
416
|
+
function initOtelBridge(opts = {}) {}
|
|
169
417
|
/**
|
|
170
418
|
* Disable the OTel bridge (useful for tests).
|
|
171
419
|
*/
|
|
172
|
-
function disableOtelBridge() {
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
//#endregion
|
|
177
|
-
//#region src/utils/internal-log.ts
|
|
420
|
+
function disableOtelBridge() {}
|
|
421
|
+
// src/utils/typed-logger.ts
|
|
178
422
|
/**
|
|
179
|
-
*
|
|
423
|
+
* logixia — TypeScript typed log fields
|
|
180
424
|
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
* diagnostics still surface even when the logger is misconfigured.
|
|
425
|
+
* Solves the type-safety gap: standard `Record<string, unknown>` metadata gives
|
|
426
|
+
* zero IDE autocomplete and lets typos slip silently into production logs.
|
|
184
427
|
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
*
|
|
200
|
-
*
|
|
428
|
+
* Two complementary utilities:
|
|
429
|
+
*
|
|
430
|
+
* 1. `createTypedLogger<TFields>()` — wraps any IBaseLogger so that the second
|
|
431
|
+
* argument of every log method is constrained to `TFields` (a typed object).
|
|
432
|
+
* Compile-time safety, zero runtime overhead.
|
|
433
|
+
*
|
|
434
|
+
* 2. `defineLogSchema<TFields>(schema)` — declares expected fields with optional
|
|
435
|
+
* validators. In development (NODE_ENV !== 'production') every log call is
|
|
436
|
+
* validated against the schema and a warning is emitted for missing required
|
|
437
|
+
* fields or type mismatches.
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```ts
|
|
441
|
+
* import { createTypedLogger, defineLogSchema } from 'logixia';
|
|
442
|
+
*
|
|
443
|
+
* interface OrderFields {
|
|
444
|
+
* orderId: string;
|
|
445
|
+
* userId: string;
|
|
446
|
+
* amount?: number;
|
|
447
|
+
* currency?: string;
|
|
448
|
+
* }
|
|
449
|
+
*
|
|
450
|
+
* const schema = defineLogSchema<OrderFields>({
|
|
451
|
+
* orderId: { type: 'string', required: true },
|
|
452
|
+
* userId: { type: 'string', required: true },
|
|
453
|
+
* amount: { type: 'number' },
|
|
454
|
+
* currency: { type: 'string' },
|
|
455
|
+
* });
|
|
456
|
+
*
|
|
457
|
+
* const orderLogger = createTypedLogger<OrderFields>(baseLogger, schema);
|
|
458
|
+
* await orderLogger.info('Order created', { orderId: 'ord_123', userId: 'usr_456', amount: 99.99 });
|
|
459
|
+
* // ^^^^ fully typed autocomplete ^^^^
|
|
460
|
+
* ```
|
|
201
461
|
*/
|
|
202
|
-
function
|
|
203
|
-
|
|
462
|
+
function isProduction() {
|
|
463
|
+
try {
|
|
464
|
+
return process.env.NODE_ENV === "production";
|
|
465
|
+
} catch {
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
204
468
|
}
|
|
205
|
-
|
|
206
|
-
//#endregion
|
|
207
|
-
//#region src/utils/typed-logger.ts
|
|
208
469
|
/**
|
|
209
470
|
* Define a typed schema for a category of log entries.
|
|
210
471
|
*
|
|
@@ -215,7 +476,7 @@ function defineLogSchema(fields) {
|
|
|
215
476
|
return {
|
|
216
477
|
fields,
|
|
217
478
|
validate(payload) {
|
|
218
|
-
if (
|
|
479
|
+
if (isProduction()) return [];
|
|
219
480
|
const warnings = [];
|
|
220
481
|
for (const [key, def] of Object.entries(fields)) {
|
|
221
482
|
const value = payload[key];
|
|
@@ -267,9 +528,42 @@ function createTypedLogger(logger, schema) {
|
|
|
267
528
|
trace: (m, d) => withValidation("trace", (logger.trace ?? logger.debug).bind(logger), m, d)
|
|
268
529
|
};
|
|
269
530
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
531
|
+
// src/browser.ts
|
|
532
|
+
/**
|
|
533
|
+
* logixia — Browser / Edge Runtime entry point
|
|
534
|
+
*
|
|
535
|
+
* This module is the browser-safe subset of logixia. It contains **no**
|
|
536
|
+
* references to Node.js built-ins (`node:fs`, `node:http`, `node:worker_threads`,
|
|
537
|
+
* `node:crypto`, `node:async_hooks`) so it can be bundled for:
|
|
538
|
+
*
|
|
539
|
+
* - Browser (Webpack / Vite / esbuild)
|
|
540
|
+
* - Cloudflare Workers / Vercel Edge Functions
|
|
541
|
+
* - Deno (via ESM import)
|
|
542
|
+
* - Bun (core subset, no file/DB transports)
|
|
543
|
+
*
|
|
544
|
+
* Excluded from this entry: FileTransport, DatabaseTransport, WorkerTransport,
|
|
545
|
+
* CloudWatchTransport, GCPTransport, AzureMonitorTransport, and anything that
|
|
546
|
+
* requires `AsyncLocalStorage`.
|
|
547
|
+
*
|
|
548
|
+
* @example Basic browser usage
|
|
549
|
+
* ```ts
|
|
550
|
+
* import { createBrowserLogger, BrowserConsoleTransport } from 'logixia/browser';
|
|
551
|
+
*
|
|
552
|
+
* const logger = createBrowserLogger({ appName: 'my-app' });
|
|
553
|
+
* logger.info('Page loaded', { url: location.href });
|
|
554
|
+
* ```
|
|
555
|
+
*
|
|
556
|
+
* @example Custom transport in browser
|
|
557
|
+
* ```ts
|
|
558
|
+
* import { createBrowserLogger, BrowserConsoleTransport } from 'logixia/browser';
|
|
559
|
+
*
|
|
560
|
+
* const logger = createBrowserLogger({
|
|
561
|
+
* appName: 'my-app',
|
|
562
|
+
* json: false, // pretty-print in devtools
|
|
563
|
+
* level: 'debug',
|
|
564
|
+
* });
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
273
567
|
const LEVEL_ORDER = {
|
|
274
568
|
verbose: 0,
|
|
275
569
|
debug: 1,
|
|
@@ -364,7 +658,7 @@ function validateRemoteUrl(raw) {
|
|
|
364
658
|
try {
|
|
365
659
|
parsed = new URL(raw);
|
|
366
660
|
} catch {
|
|
367
|
-
throw new TypeError(`BrowserRemoteTransport: invalid url
|
|
661
|
+
throw new TypeError(`BrowserRemoteTransport: invalid url [redacted]`);
|
|
368
662
|
}
|
|
369
663
|
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new TypeError(`BrowserRemoteTransport: url scheme "${parsed.protocol}" is not allowed; use http: or https:`);
|
|
370
664
|
return raw;
|
|
@@ -377,8 +671,33 @@ function validateRemoteUrl(raw) {
|
|
|
377
671
|
function byteLength(s) {
|
|
378
672
|
return new TextEncoder().encode(s).length;
|
|
379
673
|
}
|
|
674
|
+
const FAILURE_REPORT_INTERVAL_MS = 6e4;
|
|
675
|
+
/**
|
|
676
|
+
* Error name/code, HTTP status and host only. The error message is never
|
|
677
|
+
* included: runtimes embed request URLs (absolute or relative) and header
|
|
678
|
+
* values in it.
|
|
679
|
+
*/
|
|
680
|
+
function describeFailure(error, url) {
|
|
681
|
+
let host = "relative endpoint";
|
|
682
|
+
try {
|
|
683
|
+
host = `host ${new URL(url).host}`;
|
|
684
|
+
} catch {}
|
|
685
|
+
const e = error;
|
|
686
|
+
const parts = [];
|
|
687
|
+
if (e && typeof e.name === "string") parts.push(e.name);
|
|
688
|
+
if (e && typeof e.code === "string") parts.push(e.code);
|
|
689
|
+
if (e && typeof e.status === "number") parts.push(`HTTP ${e.status}`);
|
|
690
|
+
parts.push(host);
|
|
691
|
+
return parts.join(" ");
|
|
692
|
+
}
|
|
693
|
+
/** True only in a real browser page, where console noise reaches end users. */
|
|
694
|
+
function isBrowserPage() {
|
|
695
|
+
const g = globalThis;
|
|
696
|
+
return typeof g["window"] !== "undefined" && typeof g["document"] !== "undefined";
|
|
697
|
+
}
|
|
380
698
|
function isKeepaliveError(error) {
|
|
381
|
-
|
|
699
|
+
const message = error === null || error === void 0 ? void 0 : error.message;
|
|
700
|
+
return typeof message === "string" && /keepalive/i.test(message);
|
|
382
701
|
}
|
|
383
702
|
/**
|
|
384
703
|
* Browser transport that batches log entries and sends them to a remote
|
|
@@ -405,12 +724,17 @@ var BrowserRemoteTransport = class {
|
|
|
405
724
|
this.failedFlushCount = 0;
|
|
406
725
|
this.timer = null;
|
|
407
726
|
this.droppedEntries = 0;
|
|
727
|
+
this.reporting = false;
|
|
728
|
+
this.failureReported = false;
|
|
729
|
+
this.silent = options.silent ?? isBrowserPage();
|
|
730
|
+
this.onError = options.onError;
|
|
408
731
|
this.url = validateRemoteUrl(options.url);
|
|
409
732
|
this.headers = options.headers ?? {};
|
|
410
733
|
this.batchSize = options.batchSize ?? 100;
|
|
411
734
|
this.flushIntervalMs = options.flushIntervalMs ?? 5e3;
|
|
412
735
|
this.maxBufferSize = options.maxBufferSize ?? 1e3;
|
|
413
736
|
if (options.level !== void 0) this.level = options.level;
|
|
737
|
+
protectSecrets(this, ["headers", "url"]);
|
|
414
738
|
this.scheduleFlush();
|
|
415
739
|
}
|
|
416
740
|
/**
|
|
@@ -421,15 +745,23 @@ var BrowserRemoteTransport = class {
|
|
|
421
745
|
get dropped() {
|
|
422
746
|
return this.droppedEntries;
|
|
423
747
|
}
|
|
424
|
-
/** Number of flush attempts that failed
|
|
748
|
+
/** Number of flush attempts that failed (network error or non-OK HTTP status). */
|
|
425
749
|
get failedFlushes() {
|
|
426
750
|
return this.failedFlushCount;
|
|
427
751
|
}
|
|
428
|
-
/**
|
|
752
|
+
/**
|
|
753
|
+
* The most recent failure from a flush, if any: the raw fetch error (which on
|
|
754
|
+
* some runtimes embeds the request URL, so do not log it blindly) or an
|
|
755
|
+
* `Error` carrying only the HTTP status.
|
|
756
|
+
*/
|
|
429
757
|
get lastError() {
|
|
430
758
|
return this.lastFlushError;
|
|
431
759
|
}
|
|
432
760
|
write(entry) {
|
|
761
|
+
if (this.reporting) {
|
|
762
|
+
this.droppedEntries += 1;
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
433
765
|
this.batch.push(entry);
|
|
434
766
|
while (this.batch.length > this.maxBufferSize) {
|
|
435
767
|
this.batch.shift();
|
|
@@ -460,10 +792,15 @@ var BrowserRemoteTransport = class {
|
|
|
460
792
|
}
|
|
461
793
|
}
|
|
462
794
|
if (!res.ok) {
|
|
463
|
-
|
|
464
|
-
|
|
795
|
+
const failure = Object.assign(/* @__PURE__ */ new Error(`HTTP ${res.status}`), { status: res.status });
|
|
796
|
+
if (res.status >= 500 || res.status === 429) this.recordFailure(entries, failure);
|
|
797
|
+
else {
|
|
798
|
+
this.droppedEntries += entries.length;
|
|
799
|
+
this.recordFailure([], failure);
|
|
800
|
+
}
|
|
465
801
|
return;
|
|
466
802
|
}
|
|
803
|
+
this.reportRecovery();
|
|
467
804
|
}
|
|
468
805
|
}
|
|
469
806
|
send(body, keepalive) {
|
|
@@ -481,6 +818,34 @@ var BrowserRemoteTransport = class {
|
|
|
481
818
|
this.batch.unshift(...entries);
|
|
482
819
|
this.failedFlushCount += 1;
|
|
483
820
|
this.lastFlushError = error;
|
|
821
|
+
const now = Date.now();
|
|
822
|
+
const shouldReport = this.lastReportAt === void 0 || now - this.lastReportAt >= FAILURE_REPORT_INTERVAL_MS;
|
|
823
|
+
this.guarded(() => {
|
|
824
|
+
if (this.onError) try {
|
|
825
|
+
this.onError(error);
|
|
826
|
+
} catch {}
|
|
827
|
+
if (shouldReport && !this.silent) {
|
|
828
|
+
this.lastReportAt = now;
|
|
829
|
+
this.failureReported = true;
|
|
830
|
+
internalError(`BrowserRemoteTransport flush failed (${describeFailure(error, this.url)})`);
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
reportRecovery() {
|
|
835
|
+
if (!this.failureReported) return;
|
|
836
|
+
this.failureReported = false;
|
|
837
|
+
const now = Date.now();
|
|
838
|
+
if (this.lastRecoveryAt !== void 0 && now - this.lastRecoveryAt < FAILURE_REPORT_INTERVAL_MS) return;
|
|
839
|
+
this.lastRecoveryAt = now;
|
|
840
|
+
this.guarded(() => internalLog("BrowserRemoteTransport delivery recovered"));
|
|
841
|
+
}
|
|
842
|
+
guarded(fn) {
|
|
843
|
+
this.reporting = true;
|
|
844
|
+
try {
|
|
845
|
+
fn();
|
|
846
|
+
} finally {
|
|
847
|
+
this.reporting = false;
|
|
848
|
+
}
|
|
484
849
|
}
|
|
485
850
|
scheduleFlush() {
|
|
486
851
|
if (this.flushIntervalMs <= 0) return;
|
|
@@ -517,7 +882,10 @@ var BrowserLogger = class BrowserLogger {
|
|
|
517
882
|
context: config.context
|
|
518
883
|
};
|
|
519
884
|
if (config.silent) this.transports = [];
|
|
520
|
-
else
|
|
885
|
+
else {
|
|
886
|
+
const builtIn = new BrowserConsoleTransport({ json: this.config.json });
|
|
887
|
+
this.transports = [builtIn, ...config.transports ?? []];
|
|
888
|
+
}
|
|
521
889
|
}
|
|
522
890
|
verbose(message, payload) {
|
|
523
891
|
this.emit("verbose", message, payload);
|
|
@@ -605,8 +973,6 @@ function createBrowserLogger(config) {
|
|
|
605
973
|
* ```
|
|
606
974
|
*/
|
|
607
975
|
const browserLogger = new BrowserLogger({ appName: "App" });
|
|
608
|
-
|
|
609
|
-
//#endregion
|
|
610
976
|
exports.BrowserConsoleTransport = BrowserConsoleTransport;
|
|
611
977
|
exports.BrowserLogger = BrowserLogger;
|
|
612
978
|
exports.BrowserRemoteTransport = BrowserRemoteTransport;
|
|
@@ -618,4 +984,5 @@ exports.disableOtelBridge = disableOtelBridge;
|
|
|
618
984
|
exports.getActiveOtelContext = getActiveOtelContext;
|
|
619
985
|
exports.getOtelMetaFields = getOtelMetaFields;
|
|
620
986
|
exports.initOtelBridge = initOtelBridge;
|
|
987
|
+
|
|
621
988
|
//# sourceMappingURL=browser.js.map
|