@eventuras/logger 0.8.0 → 0.8.1
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/Logger-n-HsscG5.js +314 -0
- package/dist/Logger-n-HsscG5.js.map +1 -0
- package/dist/index.js +33 -12
- package/dist/index.js.map +1 -0
- package/dist/node.js +125 -59
- package/dist/node.js.map +1 -0
- package/dist/opentelemetry.js +138 -28
- package/dist/opentelemetry.js.map +1 -0
- package/package.json +5 -5
- package/dist/Logger-CcNEmm6u.js +0 -208
- package/dist/chunk-NnHqS4_Y.js +0 -20
- package/dist/esm-CIhYjsQQ.js +0 -528
- package/dist/esm-Dido2CZe.js +0 -1580
- package/dist/src-15l0SmY8.js +0 -407
package/dist/esm-CIhYjsQQ.js
DELETED
|
@@ -1,528 +0,0 @@
|
|
|
1
|
-
import { A as e, C as t, E as n, O as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, j as h, k as g, l as _, m as v, n as y, o as b, p as x, r as S, s as C, u as w, v as T } from "./esm-Dido2CZe.js";
|
|
2
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.6.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/default-service-name.js
|
|
3
|
-
var E;
|
|
4
|
-
function D() {
|
|
5
|
-
if (E === void 0) try {
|
|
6
|
-
let e = globalThis.process.argv0;
|
|
7
|
-
E = e ? `unknown_service:${e}` : "unknown_service";
|
|
8
|
-
} catch {
|
|
9
|
-
E = "unknown_service";
|
|
10
|
-
}
|
|
11
|
-
return E;
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.6.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/utils.js
|
|
15
|
-
var O = (e) => typeof e == "object" && !!e && typeof e.then == "function";
|
|
16
|
-
a(), y(), w();
|
|
17
|
-
var k = class e {
|
|
18
|
-
_rawAttributes;
|
|
19
|
-
_asyncAttributesPending = !1;
|
|
20
|
-
_schemaUrl;
|
|
21
|
-
_memoizedAttributes;
|
|
22
|
-
static FromAttributeList(t, n) {
|
|
23
|
-
let r = new e({}, n);
|
|
24
|
-
return r._rawAttributes = M(t), r._asyncAttributesPending = t.filter(([e, t]) => O(t)).length > 0, r;
|
|
25
|
-
}
|
|
26
|
-
constructor(e, t) {
|
|
27
|
-
let n = e.attributes ?? {};
|
|
28
|
-
this._rawAttributes = Object.entries(n).map(([e, t]) => (O(t) && (this._asyncAttributesPending = !0), [e, t])), this._rawAttributes = M(this._rawAttributes), this._schemaUrl = N(t?.schemaUrl);
|
|
29
|
-
}
|
|
30
|
-
get asyncAttributesPending() {
|
|
31
|
-
return this._asyncAttributesPending;
|
|
32
|
-
}
|
|
33
|
-
async waitForAsyncAttributes() {
|
|
34
|
-
if (this.asyncAttributesPending) {
|
|
35
|
-
for (let e = 0; e < this._rawAttributes.length; e++) {
|
|
36
|
-
let [t, n] = this._rawAttributes[e];
|
|
37
|
-
this._rawAttributes[e] = [t, O(n) ? await n : n];
|
|
38
|
-
}
|
|
39
|
-
this._asyncAttributesPending = !1;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
get attributes() {
|
|
43
|
-
if (this.asyncAttributesPending && r.error("Accessing resource attributes before async attributes settled"), this._memoizedAttributes) return this._memoizedAttributes;
|
|
44
|
-
let e = {};
|
|
45
|
-
for (let [t, n] of this._rawAttributes) {
|
|
46
|
-
if (O(n)) {
|
|
47
|
-
r.debug(`Unsettled resource attribute ${t} skipped`);
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
n != null && (e[t] ??= n);
|
|
51
|
-
}
|
|
52
|
-
return this._asyncAttributesPending || (this._memoizedAttributes = e), e;
|
|
53
|
-
}
|
|
54
|
-
getRawAttributes() {
|
|
55
|
-
return this._rawAttributes;
|
|
56
|
-
}
|
|
57
|
-
get schemaUrl() {
|
|
58
|
-
return this._schemaUrl;
|
|
59
|
-
}
|
|
60
|
-
merge(t) {
|
|
61
|
-
if (t == null) return this;
|
|
62
|
-
let n = P(this, t), r = n ? { schemaUrl: n } : void 0;
|
|
63
|
-
return e.FromAttributeList([...t.getRawAttributes(), ...this.getRawAttributes()], r);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
function A(e, t) {
|
|
67
|
-
return k.FromAttributeList(Object.entries(e), t);
|
|
68
|
-
}
|
|
69
|
-
function j() {
|
|
70
|
-
return A({
|
|
71
|
-
[v]: D(),
|
|
72
|
-
[p]: _[p],
|
|
73
|
-
[f]: _[f],
|
|
74
|
-
[o]: _[o]
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function M(e) {
|
|
78
|
-
return e.map(([e, t]) => O(t) ? [e, t.catch((t) => {
|
|
79
|
-
r.debug("promise rejection for resource attribute: %s - %s", e, t);
|
|
80
|
-
})] : [e, t]);
|
|
81
|
-
}
|
|
82
|
-
function N(e) {
|
|
83
|
-
if (typeof e == "string" || e === void 0) return e;
|
|
84
|
-
r.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.", e);
|
|
85
|
-
}
|
|
86
|
-
function P(e, t) {
|
|
87
|
-
let n = e?.schemaUrl, i = t?.schemaUrl, a = n === void 0 || n === "", o = i === void 0 || i === "";
|
|
88
|
-
if (a) return i;
|
|
89
|
-
if (o || n === i) return n;
|
|
90
|
-
r.warn("Schema URL merge conflict: old resource has \"%s\", updating resource has \"%s\". Resulting resource will have undefined Schema URL.", n, i);
|
|
91
|
-
}
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.js
|
|
94
|
-
c();
|
|
95
|
-
function F(e) {
|
|
96
|
-
return I(e, /* @__PURE__ */ new WeakSet());
|
|
97
|
-
}
|
|
98
|
-
function I(e, t) {
|
|
99
|
-
if (e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e instanceof Uint8Array) return !0;
|
|
100
|
-
if (typeof e == "object") {
|
|
101
|
-
if (t.has(e)) return !1;
|
|
102
|
-
if (t.add(e), Array.isArray(e)) return e.every((e) => I(e, t));
|
|
103
|
-
let n = e;
|
|
104
|
-
return n.constructor !== Object && n.constructor !== void 0 ? !1 : Object.values(n).every((e) => I(e, t));
|
|
105
|
-
}
|
|
106
|
-
return !1;
|
|
107
|
-
}
|
|
108
|
-
a(), y(), w();
|
|
109
|
-
var L = class {
|
|
110
|
-
hrTime;
|
|
111
|
-
hrTimeObserved;
|
|
112
|
-
spanContext;
|
|
113
|
-
resource;
|
|
114
|
-
instrumentationScope;
|
|
115
|
-
attributes = {};
|
|
116
|
-
_severityText;
|
|
117
|
-
_severityNumber;
|
|
118
|
-
_body;
|
|
119
|
-
_eventName;
|
|
120
|
-
_attributesCount = 0;
|
|
121
|
-
_droppedAttributesCount = 0;
|
|
122
|
-
_isReadonly = !1;
|
|
123
|
-
_logRecordLimits;
|
|
124
|
-
set severityText(e) {
|
|
125
|
-
this._isLogRecordReadonly() || (this._severityText = e);
|
|
126
|
-
}
|
|
127
|
-
get severityText() {
|
|
128
|
-
return this._severityText;
|
|
129
|
-
}
|
|
130
|
-
set severityNumber(e) {
|
|
131
|
-
this._isLogRecordReadonly() || (this._severityNumber = e);
|
|
132
|
-
}
|
|
133
|
-
get severityNumber() {
|
|
134
|
-
return this._severityNumber;
|
|
135
|
-
}
|
|
136
|
-
set body(e) {
|
|
137
|
-
this._isLogRecordReadonly() || (this._body = e);
|
|
138
|
-
}
|
|
139
|
-
get body() {
|
|
140
|
-
return this._body;
|
|
141
|
-
}
|
|
142
|
-
get eventName() {
|
|
143
|
-
return this._eventName;
|
|
144
|
-
}
|
|
145
|
-
set eventName(e) {
|
|
146
|
-
this._isLogRecordReadonly() || (this._eventName = e);
|
|
147
|
-
}
|
|
148
|
-
get droppedAttributesCount() {
|
|
149
|
-
return this._droppedAttributesCount;
|
|
150
|
-
}
|
|
151
|
-
constructor(t, r, i) {
|
|
152
|
-
let { timestamp: a, observedTimestamp: o, eventName: s, severityNumber: c, severityText: u, body: d, attributes: f = {}, exception: p, context: m } = i, h = Date.now();
|
|
153
|
-
if (this.hrTime = l(a ?? h), this.hrTimeObserved = l(o ?? h), m) {
|
|
154
|
-
let t = n.getSpanContext(m);
|
|
155
|
-
t && e(t) && (this.spanContext = t);
|
|
156
|
-
}
|
|
157
|
-
this.severityNumber = c, this.severityText = u, this.body = d, this.resource = t.resource, this.instrumentationScope = r, this._logRecordLimits = t.logRecordLimits, this._eventName = s, this.setAttributes(f), p != null && this._setException(p);
|
|
158
|
-
}
|
|
159
|
-
setAttribute(e, t) {
|
|
160
|
-
if (this._isLogRecordReadonly()) return this;
|
|
161
|
-
if (e.length === 0) return r.warn(`Invalid attribute key: ${e}`), this;
|
|
162
|
-
if (!F(t)) return r.warn(`Invalid attribute value set for key: ${e}`), this;
|
|
163
|
-
let n = !Object.prototype.hasOwnProperty.call(this.attributes, e);
|
|
164
|
-
return n && this._attributesCount >= this._logRecordLimits.attributeCountLimit ? (this._droppedAttributesCount++, this._droppedAttributesCount === 1 && r.warn("Dropping extra attributes."), this) : (this.attributes[e] = this._truncateToSize(t), n && this._attributesCount++, this);
|
|
165
|
-
}
|
|
166
|
-
setAttributes(e) {
|
|
167
|
-
for (let [t, n] of Object.entries(e)) this.setAttribute(t, n);
|
|
168
|
-
return this;
|
|
169
|
-
}
|
|
170
|
-
setBody(e) {
|
|
171
|
-
return this.body = e, this;
|
|
172
|
-
}
|
|
173
|
-
setEventName(e) {
|
|
174
|
-
return this.eventName = e, this;
|
|
175
|
-
}
|
|
176
|
-
setSeverityNumber(e) {
|
|
177
|
-
return this.severityNumber = e, this;
|
|
178
|
-
}
|
|
179
|
-
setSeverityText(e) {
|
|
180
|
-
return this.severityText = e, this;
|
|
181
|
-
}
|
|
182
|
-
_makeReadonly() {
|
|
183
|
-
this._isReadonly = !0;
|
|
184
|
-
}
|
|
185
|
-
_truncateToSize(e) {
|
|
186
|
-
let t = this._logRecordLimits.attributeValueLengthLimit;
|
|
187
|
-
if (t <= 0) return r.warn(`Attribute value limit must be positive, got ${t}`), e;
|
|
188
|
-
if (e == null) return e;
|
|
189
|
-
if (typeof e == "string") return this._truncateToLimitUtil(e, t);
|
|
190
|
-
if (e instanceof Uint8Array) return e;
|
|
191
|
-
if (Array.isArray(e)) return e.map((e) => this._truncateToSize(e));
|
|
192
|
-
if (typeof e == "object") {
|
|
193
|
-
let t = {};
|
|
194
|
-
for (let [n, r] of Object.entries(e)) t[n] = this._truncateToSize(r);
|
|
195
|
-
return t;
|
|
196
|
-
}
|
|
197
|
-
return e;
|
|
198
|
-
}
|
|
199
|
-
_setException(e) {
|
|
200
|
-
let t = !1;
|
|
201
|
-
if (typeof e == "string" || typeof e == "number") Object.hasOwn(this.attributes, "exception.message") || this.setAttribute(u, String(e)), t = !0;
|
|
202
|
-
else if (e && typeof e == "object") {
|
|
203
|
-
let n = e;
|
|
204
|
-
n.code ? (Object.hasOwn(this.attributes, "exception.type") || this.setAttribute(x, n.code.toString()), t = !0) : n.name && (Object.hasOwn(this.attributes, "exception.type") || this.setAttribute(x, n.name), t = !0), n.message && (Object.hasOwn(this.attributes, "exception.message") || this.setAttribute(u, n.message), t = !0), n.stack && (Object.hasOwn(this.attributes, "exception.stacktrace") || this.setAttribute(d, n.stack), t = !0);
|
|
205
|
-
}
|
|
206
|
-
t || r.warn(`Failed to record an exception ${e}`);
|
|
207
|
-
}
|
|
208
|
-
_truncateToLimitUtil(e, t) {
|
|
209
|
-
return e.length <= t ? e : e.substring(0, t);
|
|
210
|
-
}
|
|
211
|
-
_isLogRecordReadonly() {
|
|
212
|
-
return this._isReadonly && r.warn("Can not execute the operation on emitted log record"), this._isReadonly;
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js
|
|
217
|
-
a();
|
|
218
|
-
var R = class {
|
|
219
|
-
instrumentationScope;
|
|
220
|
-
_sharedState;
|
|
221
|
-
_loggerConfig;
|
|
222
|
-
constructor(e, t) {
|
|
223
|
-
this.instrumentationScope = e, this._sharedState = t, this._loggerConfig = this._sharedState.getLoggerConfig(this.instrumentationScope);
|
|
224
|
-
}
|
|
225
|
-
emit(r) {
|
|
226
|
-
let i = this._loggerConfig, a = r.context || g.active(), o = r.severityNumber ?? t.UNSPECIFIED;
|
|
227
|
-
if (o !== t.UNSPECIFIED && o < i.minimumSeverity) return;
|
|
228
|
-
if (i.traceBased) {
|
|
229
|
-
let t = n.getSpanContext(a);
|
|
230
|
-
if (t && e(t) && (t.traceFlags & h.SAMPLED) !== h.SAMPLED) return;
|
|
231
|
-
}
|
|
232
|
-
let s = new L(this._sharedState, this.instrumentationScope, {
|
|
233
|
-
context: a,
|
|
234
|
-
...r
|
|
235
|
-
});
|
|
236
|
-
this._sharedState.activeProcessor.onEmit(s, a), s._makeReadonly();
|
|
237
|
-
}
|
|
238
|
-
}, z = class {
|
|
239
|
-
forceFlush() {
|
|
240
|
-
return Promise.resolve();
|
|
241
|
-
}
|
|
242
|
-
onEmit(e, t) {}
|
|
243
|
-
shutdown() {
|
|
244
|
-
return Promise.resolve();
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
//#endregion
|
|
248
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/MultiLogRecordProcessor.js
|
|
249
|
-
y();
|
|
250
|
-
var B = class {
|
|
251
|
-
processors;
|
|
252
|
-
forceFlushTimeoutMillis;
|
|
253
|
-
constructor(e, t) {
|
|
254
|
-
this.processors = e, this.forceFlushTimeoutMillis = t;
|
|
255
|
-
}
|
|
256
|
-
async forceFlush() {
|
|
257
|
-
let e = this.forceFlushTimeoutMillis;
|
|
258
|
-
await Promise.all(this.processors.map((t) => s(t.forceFlush(), e)));
|
|
259
|
-
}
|
|
260
|
-
onEmit(e, t) {
|
|
261
|
-
this.processors.forEach((n) => n.onEmit(e, t));
|
|
262
|
-
}
|
|
263
|
-
async shutdown() {
|
|
264
|
-
await Promise.all(this.processors.map((e) => e.shutdown()));
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js
|
|
269
|
-
function V(e) {
|
|
270
|
-
return `${e.name}@${e.version || ""}:${e.schemaUrl || ""}`;
|
|
271
|
-
}
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/LoggerProviderSharedState.js
|
|
274
|
-
c();
|
|
275
|
-
var H = {
|
|
276
|
-
disabled: !1,
|
|
277
|
-
minimumSeverity: t.UNSPECIFIED,
|
|
278
|
-
traceBased: !1
|
|
279
|
-
}, U = () => ({ ...H }), W = class {
|
|
280
|
-
loggers = /* @__PURE__ */ new Map();
|
|
281
|
-
activeProcessor;
|
|
282
|
-
registeredLogRecordProcessors = [];
|
|
283
|
-
resource;
|
|
284
|
-
forceFlushTimeoutMillis;
|
|
285
|
-
logRecordLimits;
|
|
286
|
-
processors;
|
|
287
|
-
_loggerConfigurator;
|
|
288
|
-
_loggerConfigs = /* @__PURE__ */ new Map();
|
|
289
|
-
constructor(e, t, n, r, i) {
|
|
290
|
-
this.resource = e, this.forceFlushTimeoutMillis = t, this.logRecordLimits = n, this.processors = r, r.length > 0 ? (this.registeredLogRecordProcessors = r, this.activeProcessor = new B(this.registeredLogRecordProcessors, this.forceFlushTimeoutMillis)) : this.activeProcessor = new z(), this._loggerConfigurator = i ?? U;
|
|
291
|
-
}
|
|
292
|
-
getLoggerConfig(e) {
|
|
293
|
-
let t = V(e), n = this._loggerConfigs.get(t);
|
|
294
|
-
return n || (n = this._loggerConfigurator(e), this._loggerConfigs.set(t, n), n);
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
a(), c(), y();
|
|
298
|
-
var G = class {
|
|
299
|
-
_shutdownOnce;
|
|
300
|
-
_sharedState;
|
|
301
|
-
constructor(e = {}) {
|
|
302
|
-
let t = {
|
|
303
|
-
resource: e.resource ?? j(),
|
|
304
|
-
forceFlushTimeoutMillis: e.forceFlushTimeoutMillis ?? 3e4,
|
|
305
|
-
logRecordLimits: {
|
|
306
|
-
attributeCountLimit: e.logRecordLimits?.attributeCountLimit ?? 128,
|
|
307
|
-
attributeValueLengthLimit: e.logRecordLimits?.attributeValueLengthLimit ?? Infinity
|
|
308
|
-
},
|
|
309
|
-
loggerConfigurator: e.loggerConfigurator ?? U,
|
|
310
|
-
processors: e.processors ?? []
|
|
311
|
-
};
|
|
312
|
-
this._sharedState = new W(t.resource, t.forceFlushTimeoutMillis, t.logRecordLimits, t.processors, t.loggerConfigurator), this._shutdownOnce = new m(this._shutdown, this);
|
|
313
|
-
}
|
|
314
|
-
getLogger(e, t, n) {
|
|
315
|
-
if (this._shutdownOnce.isCalled) return r.warn("A shutdown LoggerProvider cannot provide a Logger"), i;
|
|
316
|
-
e || r.warn("Logger requested without instrumentation scope name.");
|
|
317
|
-
let a = e || "unknown", o = `${a}@${t || ""}:${n?.schemaUrl || ""}`;
|
|
318
|
-
return this._sharedState.loggers.has(o) || this._sharedState.loggers.set(o, new R({
|
|
319
|
-
name: a,
|
|
320
|
-
version: t,
|
|
321
|
-
schemaUrl: n?.schemaUrl
|
|
322
|
-
}, this._sharedState)), this._sharedState.loggers.get(o);
|
|
323
|
-
}
|
|
324
|
-
forceFlush() {
|
|
325
|
-
return this._shutdownOnce.isCalled ? (r.warn("invalid attempt to force flush after LoggerProvider shutdown"), this._shutdownOnce.promise) : this._sharedState.activeProcessor.forceFlush();
|
|
326
|
-
}
|
|
327
|
-
shutdown() {
|
|
328
|
-
return this._shutdownOnce.isCalled ? (r.warn("shutdown may only be called once per LoggerProvider"), this._shutdownOnce.promise) : this._shutdownOnce.call();
|
|
329
|
-
}
|
|
330
|
-
_shutdown() {
|
|
331
|
-
return this._sharedState.activeProcessor.shutdown();
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
//#endregion
|
|
335
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/ConsoleLogRecordExporter.js
|
|
336
|
-
y();
|
|
337
|
-
var K = class {
|
|
338
|
-
export(e, t) {
|
|
339
|
-
this._sendLogRecords(e, t);
|
|
340
|
-
}
|
|
341
|
-
shutdown() {
|
|
342
|
-
return Promise.resolve();
|
|
343
|
-
}
|
|
344
|
-
_exportInfo(e) {
|
|
345
|
-
return {
|
|
346
|
-
resource: { attributes: e.resource.attributes },
|
|
347
|
-
instrumentationScope: e.instrumentationScope,
|
|
348
|
-
timestamp: C(e.hrTime),
|
|
349
|
-
traceId: e.spanContext?.traceId,
|
|
350
|
-
spanId: e.spanContext?.spanId,
|
|
351
|
-
traceFlags: e.spanContext?.traceFlags,
|
|
352
|
-
severityText: e.severityText,
|
|
353
|
-
severityNumber: e.severityNumber,
|
|
354
|
-
eventName: e.eventName,
|
|
355
|
-
body: e.body,
|
|
356
|
-
attributes: e.attributes
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
_sendLogRecords(e, t) {
|
|
360
|
-
for (let t of e) console.dir(this._exportInfo(t), { depth: 3 });
|
|
361
|
-
t?.({ code: b.SUCCESS });
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
//#endregion
|
|
365
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/SimpleLogRecordProcessor.js
|
|
366
|
-
y();
|
|
367
|
-
var q = class {
|
|
368
|
-
_exporter;
|
|
369
|
-
_shutdownOnce;
|
|
370
|
-
_unresolvedExports;
|
|
371
|
-
constructor(e) {
|
|
372
|
-
this._exporter = e, this._shutdownOnce = new m(this._shutdown, this), this._unresolvedExports = /* @__PURE__ */ new Set();
|
|
373
|
-
}
|
|
374
|
-
onEmit(e) {
|
|
375
|
-
if (this._shutdownOnce.isCalled) return;
|
|
376
|
-
let t = () => S._export(this._exporter, [e]).then((e) => {
|
|
377
|
-
e.code !== b.SUCCESS && T(e.error ?? /* @__PURE__ */ Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`));
|
|
378
|
-
}).catch(T);
|
|
379
|
-
if (e.resource.asyncAttributesPending) {
|
|
380
|
-
let n = e.resource.waitForAsyncAttributes?.().then(() => (this._unresolvedExports.delete(n), t()), T);
|
|
381
|
-
n != null && this._unresolvedExports.add(n);
|
|
382
|
-
} else t();
|
|
383
|
-
}
|
|
384
|
-
async forceFlush() {
|
|
385
|
-
await Promise.all(Array.from(this._unresolvedExports));
|
|
386
|
-
}
|
|
387
|
-
shutdown() {
|
|
388
|
-
return this._shutdownOnce.call();
|
|
389
|
-
}
|
|
390
|
-
_shutdown() {
|
|
391
|
-
return this._exporter.shutdown();
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
//#endregion
|
|
395
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/InMemoryLogRecordExporter.js
|
|
396
|
-
y();
|
|
397
|
-
var J = class {
|
|
398
|
-
_finishedLogRecords = [];
|
|
399
|
-
_stopped = !1;
|
|
400
|
-
export(e, t) {
|
|
401
|
-
if (this._stopped) return t({
|
|
402
|
-
code: b.FAILED,
|
|
403
|
-
error: /* @__PURE__ */ Error("Exporter has been stopped")
|
|
404
|
-
});
|
|
405
|
-
this._finishedLogRecords.push(...e), t({ code: b.SUCCESS });
|
|
406
|
-
}
|
|
407
|
-
shutdown() {
|
|
408
|
-
return this._stopped = !0, this.reset(), Promise.resolve();
|
|
409
|
-
}
|
|
410
|
-
getFinishedLogRecords() {
|
|
411
|
-
return this._finishedLogRecords;
|
|
412
|
-
}
|
|
413
|
-
reset() {
|
|
414
|
-
this._finishedLogRecords = [];
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
a(), y();
|
|
418
|
-
var Y = class {
|
|
419
|
-
_maxExportBatchSize;
|
|
420
|
-
_maxQueueSize;
|
|
421
|
-
_scheduledDelayMillis;
|
|
422
|
-
_exportTimeoutMillis;
|
|
423
|
-
_exporter;
|
|
424
|
-
_isExporting = !1;
|
|
425
|
-
_finishedLogRecords = [];
|
|
426
|
-
_timer;
|
|
427
|
-
_shutdownOnce;
|
|
428
|
-
constructor(e, t) {
|
|
429
|
-
this._exporter = e, this._maxExportBatchSize = t?.maxExportBatchSize ?? 512, this._maxQueueSize = t?.maxQueueSize ?? 2048, this._scheduledDelayMillis = t?.scheduledDelayMillis ?? 5e3, this._exportTimeoutMillis = t?.exportTimeoutMillis ?? 3e4, this._shutdownOnce = new m(this._shutdown, this), this._maxExportBatchSize > this._maxQueueSize && (r.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"), this._maxExportBatchSize = this._maxQueueSize);
|
|
430
|
-
}
|
|
431
|
-
onEmit(e) {
|
|
432
|
-
this._shutdownOnce.isCalled || this._addToBuffer(e);
|
|
433
|
-
}
|
|
434
|
-
forceFlush() {
|
|
435
|
-
return this._shutdownOnce.isCalled ? this._shutdownOnce.promise : this._flushAll();
|
|
436
|
-
}
|
|
437
|
-
shutdown() {
|
|
438
|
-
return this._shutdownOnce.call();
|
|
439
|
-
}
|
|
440
|
-
async _shutdown() {
|
|
441
|
-
this.onShutdown(), await this._flushAll(), await this._exporter.shutdown();
|
|
442
|
-
}
|
|
443
|
-
_addToBuffer(e) {
|
|
444
|
-
this._finishedLogRecords.length >= this._maxQueueSize || (this._finishedLogRecords.push(e), this._maybeStartTimer());
|
|
445
|
-
}
|
|
446
|
-
_flushAll() {
|
|
447
|
-
return new Promise((e, t) => {
|
|
448
|
-
let n = [], r = Math.ceil(this._finishedLogRecords.length / this._maxExportBatchSize);
|
|
449
|
-
for (let e = 0; e < r; e++) n.push(this._flushOneBatch());
|
|
450
|
-
Promise.all(n).then(() => {
|
|
451
|
-
e();
|
|
452
|
-
}).catch(t);
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
_flushOneBatch() {
|
|
456
|
-
return this._clearTimer(), this._finishedLogRecords.length === 0 ? Promise.resolve() : s(this._export(this._finishedLogRecords.splice(0, this._maxExportBatchSize)), this._exportTimeoutMillis);
|
|
457
|
-
}
|
|
458
|
-
_maybeStartTimer() {
|
|
459
|
-
if (this._isExporting) return;
|
|
460
|
-
let e = () => {
|
|
461
|
-
this._isExporting = !0, this._flushOneBatch().then(() => {
|
|
462
|
-
this._isExporting = !1, this._finishedLogRecords.length > 0 && (this._clearTimer(), this._maybeStartTimer());
|
|
463
|
-
}).catch((e) => {
|
|
464
|
-
this._isExporting = !1, T(e);
|
|
465
|
-
});
|
|
466
|
-
};
|
|
467
|
-
if (this._finishedLogRecords.length >= this._maxExportBatchSize) return e();
|
|
468
|
-
this._timer === void 0 && (this._timer = setTimeout(() => e(), this._scheduledDelayMillis), typeof this._timer != "number" && this._timer.unref());
|
|
469
|
-
}
|
|
470
|
-
_clearTimer() {
|
|
471
|
-
this._timer !== void 0 && (clearTimeout(this._timer), this._timer = void 0);
|
|
472
|
-
}
|
|
473
|
-
_export(e) {
|
|
474
|
-
let t = () => S._export(this._exporter, e).then((e) => {
|
|
475
|
-
e.code !== b.SUCCESS && T(e.error ?? /* @__PURE__ */ Error(`BatchLogRecordProcessor: log record export failed (status ${e})`));
|
|
476
|
-
}).catch(T), n = [];
|
|
477
|
-
for (let t = 0; t < e.length; t++) {
|
|
478
|
-
let r = e[t].resource;
|
|
479
|
-
r.asyncAttributesPending && typeof r.waitForAsyncAttributes == "function" && n.push(r.waitForAsyncAttributes());
|
|
480
|
-
}
|
|
481
|
-
return n.length === 0 ? t() : Promise.all(n).then(t, T);
|
|
482
|
-
}
|
|
483
|
-
}, X = class extends Y {
|
|
484
|
-
_visibilityChangeListener;
|
|
485
|
-
_pageHideListener;
|
|
486
|
-
constructor(e, t) {
|
|
487
|
-
super(e, t), this._onInit(t);
|
|
488
|
-
}
|
|
489
|
-
onShutdown() {
|
|
490
|
-
typeof document > "u" || (this._visibilityChangeListener && document.removeEventListener("visibilitychange", this._visibilityChangeListener), this._pageHideListener && document.removeEventListener("pagehide", this._pageHideListener));
|
|
491
|
-
}
|
|
492
|
-
_onInit(e) {
|
|
493
|
-
e?.disableAutoFlushOnDocumentHide === !0 || typeof document > "u" || (this._visibilityChangeListener = () => {
|
|
494
|
-
document.visibilityState === "hidden" && this.forceFlush();
|
|
495
|
-
}, this._pageHideListener = () => {
|
|
496
|
-
this.forceFlush();
|
|
497
|
-
}, document.addEventListener("visibilitychange", this._visibilityChangeListener), document.addEventListener("pagehide", this._pageHideListener));
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
//#endregion
|
|
501
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/config/LoggerConfigurators.js
|
|
502
|
-
c();
|
|
503
|
-
var Z = {
|
|
504
|
-
disabled: !1,
|
|
505
|
-
minimumSeverity: t.UNSPECIFIED,
|
|
506
|
-
traceBased: !1
|
|
507
|
-
};
|
|
508
|
-
function Q(e) {
|
|
509
|
-
return (t) => {
|
|
510
|
-
let n = t.name;
|
|
511
|
-
for (let { pattern: t, config: r } of e) if ($(n, t)) return {
|
|
512
|
-
disabled: r.disabled ?? Z.disabled,
|
|
513
|
-
minimumSeverity: r.minimumSeverity ?? Z.minimumSeverity,
|
|
514
|
-
traceBased: r.traceBased ?? Z.traceBased
|
|
515
|
-
};
|
|
516
|
-
return { ...Z };
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
function $(e, t) {
|
|
520
|
-
if (t === e) return !0;
|
|
521
|
-
if (t.includes("*")) {
|
|
522
|
-
let n = t.split("*").map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join(".*");
|
|
523
|
-
return RegExp(`^${n}$`).test(e);
|
|
524
|
-
}
|
|
525
|
-
return !1;
|
|
526
|
-
}
|
|
527
|
-
//#endregion
|
|
528
|
-
export { X as BatchLogRecordProcessor, K as ConsoleLogRecordExporter, J as InMemoryLogRecordExporter, G as LoggerProvider, q as SimpleLogRecordProcessor, Q as createLoggerConfigurator };
|