@eventuras/logger 0.7.0 → 0.7.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/LICENSE +674 -0
- package/dist/{esm-wJpbN37y.js → esm-CIhYjsQQ.js} +1 -1
- package/dist/index.js +39 -418
- package/dist/node.js +1 -1
- package/dist/opentelemetry.js +1 -1
- package/dist/{pretty-BTJ0fKhV.js → pretty-sMlW_evX.js} +38 -38
- package/dist/{src-V4zpQbfq.js → src-15l0SmY8.js} +101 -100
- package/package.json +11 -11
- package/dist/__vite-browser-external-pQ4XsTOI.js +0 -7
- /package/dist/{esm-B1-Y8LUx.js → esm-Dido2CZe.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Writable as e } from "node:stream";
|
|
2
2
|
//#region src/transports/pretty.ts
|
|
3
|
-
var t =
|
|
3
|
+
var t = {
|
|
4
4
|
reset: "\x1B[0m",
|
|
5
5
|
dim: "\x1B[2m",
|
|
6
6
|
bold: "\x1B[1m",
|
|
@@ -10,57 +10,57 @@ var t = e(), n = {
|
|
|
10
10
|
cyan: "\x1B[36m",
|
|
11
11
|
magenta: "\x1B[35m",
|
|
12
12
|
gray: "\x1B[90m"
|
|
13
|
-
},
|
|
13
|
+
}, n = {
|
|
14
14
|
10: {
|
|
15
15
|
label: "TRACE",
|
|
16
|
-
color:
|
|
16
|
+
color: t.gray
|
|
17
17
|
},
|
|
18
18
|
20: {
|
|
19
19
|
label: "DEBUG",
|
|
20
|
-
color:
|
|
20
|
+
color: t.cyan
|
|
21
21
|
},
|
|
22
22
|
30: {
|
|
23
23
|
label: "INFO ",
|
|
24
|
-
color:
|
|
24
|
+
color: t.green
|
|
25
25
|
},
|
|
26
26
|
40: {
|
|
27
27
|
label: "WARN ",
|
|
28
|
-
color:
|
|
28
|
+
color: t.yellow
|
|
29
29
|
},
|
|
30
30
|
50: {
|
|
31
31
|
label: "ERROR",
|
|
32
|
-
color:
|
|
32
|
+
color: t.red
|
|
33
33
|
},
|
|
34
34
|
60: {
|
|
35
35
|
label: "FATAL",
|
|
36
|
-
color: `${
|
|
36
|
+
color: `${t.bold}${t.red}`
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, r = {
|
|
39
39
|
trace: {
|
|
40
40
|
label: "TRACE",
|
|
41
|
-
color:
|
|
41
|
+
color: t.gray
|
|
42
42
|
},
|
|
43
43
|
debug: {
|
|
44
44
|
label: "DEBUG",
|
|
45
|
-
color:
|
|
45
|
+
color: t.cyan
|
|
46
46
|
},
|
|
47
47
|
info: {
|
|
48
48
|
label: "INFO ",
|
|
49
|
-
color:
|
|
49
|
+
color: t.green
|
|
50
50
|
},
|
|
51
51
|
warn: {
|
|
52
52
|
label: "WARN ",
|
|
53
|
-
color:
|
|
53
|
+
color: t.yellow
|
|
54
54
|
},
|
|
55
55
|
error: {
|
|
56
56
|
label: "ERROR",
|
|
57
|
-
color:
|
|
57
|
+
color: t.red
|
|
58
58
|
},
|
|
59
59
|
fatal: {
|
|
60
60
|
label: "FATAL",
|
|
61
|
-
color: `${
|
|
61
|
+
color: `${t.bold}${t.red}`
|
|
62
62
|
}
|
|
63
|
-
},
|
|
63
|
+
}, i = new Set([
|
|
64
64
|
"level",
|
|
65
65
|
"time",
|
|
66
66
|
"pid",
|
|
@@ -70,45 +70,45 @@ var t = e(), n = {
|
|
|
70
70
|
"ns",
|
|
71
71
|
"namespace"
|
|
72
72
|
]);
|
|
73
|
-
function
|
|
73
|
+
function a(e) {
|
|
74
74
|
if (typeof e == "string") {
|
|
75
75
|
let t = new Date(e);
|
|
76
76
|
return Number.isNaN(t.getTime()) ? "" : t.toLocaleTimeString("en-GB", { hour12: !1 });
|
|
77
77
|
}
|
|
78
78
|
return typeof e == "number" ? new Date(e).toLocaleTimeString("en-GB", { hour12: !1 }) : (/* @__PURE__ */ new Date()).toLocaleTimeString("en-GB", { hour12: !1 });
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
let
|
|
82
|
-
for (let [
|
|
83
|
-
return r ? ` ${
|
|
80
|
+
function o(e) {
|
|
81
|
+
let n = {}, r = !1;
|
|
82
|
+
for (let [t, a] of Object.entries(e)) i.has(t) || (n[t] = a, r = !0);
|
|
83
|
+
return r ? ` ${t.dim}${JSON.stringify(n)}${t.reset}` : "";
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
let
|
|
87
|
-
if (!
|
|
88
|
-
let
|
|
85
|
+
function s(e) {
|
|
86
|
+
let i = e.trim();
|
|
87
|
+
if (!i) return "";
|
|
88
|
+
let s;
|
|
89
89
|
try {
|
|
90
|
-
|
|
90
|
+
s = JSON.parse(i);
|
|
91
91
|
} catch {
|
|
92
|
-
return
|
|
92
|
+
return i;
|
|
93
93
|
}
|
|
94
|
-
let c =
|
|
94
|
+
let c = s.level, l = typeof c == "string" ? r[c] ?? {
|
|
95
95
|
label: c.toUpperCase().padEnd(5),
|
|
96
|
-
color:
|
|
97
|
-
} :
|
|
96
|
+
color: t.gray
|
|
97
|
+
} : n[c] ?? {
|
|
98
98
|
label: `L${c}`,
|
|
99
|
-
color:
|
|
100
|
-
}, u =
|
|
101
|
-
return `${
|
|
99
|
+
color: t.gray
|
|
100
|
+
}, u = a(s.time), d = s.msg ?? "", f = s.namespace || s.ns || s.name || "", p = f ? ` ${t.magenta}(${f})${t.reset}` : "", m = `${t.dim}→${t.reset}`, h = o(s);
|
|
101
|
+
return `${t.dim}${u}${t.reset} ${l.color}${l.label}${t.reset}${p} ${m} ${d}${h}`;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
return new
|
|
103
|
+
function c() {
|
|
104
|
+
return new e({ write(e, t, n) {
|
|
105
105
|
let r = e.toString().split("\n");
|
|
106
106
|
for (let e of r) {
|
|
107
|
-
let t =
|
|
107
|
+
let t = s(e);
|
|
108
108
|
t && process.stdout.write(t + "\n");
|
|
109
109
|
}
|
|
110
110
|
n();
|
|
111
111
|
} });
|
|
112
112
|
}
|
|
113
113
|
//#endregion
|
|
114
|
-
export {
|
|
114
|
+
export { s as n, c as t };
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import { i as e, n as t, r as n, t as r } from "./chunk-NnHqS4_Y.js";
|
|
2
|
-
import {
|
|
3
|
-
import { D as a, E as o, O as s, T as c, b as l, n as u, t as d, w as f, x as p, y as m } from "./esm-B1-Y8LUx.js";
|
|
2
|
+
import { D as i, E as a, O as o, T as s, b as c, n as l, t as u, w as d, x as f, y as p } from "./esm-Dido2CZe.js";
|
|
4
3
|
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/autoLoaderUtils.js
|
|
5
|
-
function
|
|
4
|
+
function m(e, t, n, r) {
|
|
6
5
|
for (let i = 0, a = e.length; i < a; i++) {
|
|
7
6
|
let a = e[i];
|
|
8
7
|
t && a.setTracerProvider(t), n && a.setMeterProvider(n), r && a.setLoggerProvider && a.setLoggerProvider(r), a.getConfig().enabled || a.enable();
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
|
-
function
|
|
10
|
+
function h(e) {
|
|
12
11
|
e.forEach((e) => e.disable());
|
|
13
12
|
}
|
|
14
|
-
var
|
|
13
|
+
var g = t((() => {}));
|
|
15
14
|
//#endregion
|
|
16
15
|
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/autoLoader.js
|
|
17
|
-
function
|
|
18
|
-
let t = e.tracerProvider ||
|
|
19
|
-
return
|
|
20
|
-
|
|
16
|
+
function _(e) {
|
|
17
|
+
let t = e.tracerProvider || a.getTracerProvider(), n = e.meterProvider || i.getMeterProvider(), r = e.loggerProvider || f.getLoggerProvider(), o = e.instrumentations?.flat() ?? [];
|
|
18
|
+
return m(o, t, n, r), () => {
|
|
19
|
+
h(o);
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
|
-
var
|
|
24
|
-
|
|
22
|
+
var v = t((() => {
|
|
23
|
+
s(), c(), g();
|
|
25
24
|
}));
|
|
26
25
|
//#endregion
|
|
27
26
|
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/shimmer.js
|
|
28
|
-
function
|
|
27
|
+
function y(e, t, n) {
|
|
29
28
|
let r = !!e[t] && Object.prototype.propertyIsEnumerable.call(e, t);
|
|
30
29
|
Object.defineProperty(e, t, {
|
|
31
30
|
configurable: !0,
|
|
@@ -34,72 +33,72 @@ function b(e, t, n) {
|
|
|
34
33
|
value: n
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
|
-
function
|
|
38
|
-
e && e.logger && (typeof e.logger == "function" ?
|
|
36
|
+
function b(e) {
|
|
37
|
+
e && e.logger && (typeof e.logger == "function" ? x = e.logger : x("new logger isn't a function, not replacing"));
|
|
39
38
|
}
|
|
40
|
-
var S, C, w, T, E
|
|
41
|
-
|
|
39
|
+
var x, S, C, w, T, E = t((() => {
|
|
40
|
+
x = console.error.bind(console), S = (e, t, n) => {
|
|
42
41
|
if (!e || !e[t]) {
|
|
43
|
-
|
|
42
|
+
x("no original function " + String(t) + " to wrap");
|
|
44
43
|
return;
|
|
45
44
|
}
|
|
46
45
|
if (!n) {
|
|
47
|
-
|
|
46
|
+
x("no wrapper function"), x((/* @__PURE__ */ Error()).stack);
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
49
|
let r = e[t];
|
|
51
50
|
if (typeof r != "function" || typeof n != "function") {
|
|
52
|
-
|
|
51
|
+
x("original object and wrapper must be functions");
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
55
54
|
let i = n(r, t);
|
|
56
|
-
return
|
|
57
|
-
e[t] === i &&
|
|
58
|
-
}),
|
|
59
|
-
},
|
|
55
|
+
return y(i, "__original", r), y(i, "__unwrap", () => {
|
|
56
|
+
e[t] === i && y(e, t, r);
|
|
57
|
+
}), y(i, "__wrapped", !0), y(e, t, i), i;
|
|
58
|
+
}, C = (e, t, n) => {
|
|
60
59
|
if (e) Array.isArray(e) || (e = [e]);
|
|
61
60
|
else {
|
|
62
|
-
|
|
61
|
+
x("must provide one or more modules to patch"), x((/* @__PURE__ */ Error()).stack);
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
65
64
|
if (!(t && Array.isArray(t))) {
|
|
66
|
-
|
|
65
|
+
x("must provide one or more functions to wrap on modules");
|
|
67
66
|
return;
|
|
68
67
|
}
|
|
69
68
|
e.forEach((e) => {
|
|
70
69
|
t.forEach((t) => {
|
|
71
|
-
|
|
70
|
+
S(e, t, n);
|
|
72
71
|
});
|
|
73
72
|
});
|
|
74
|
-
},
|
|
73
|
+
}, w = (e, t) => {
|
|
75
74
|
if (!e || !e[t]) {
|
|
76
|
-
|
|
75
|
+
x("no function to unwrap."), x((/* @__PURE__ */ Error()).stack);
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
78
|
let n = e[t];
|
|
80
|
-
if (!n.__unwrap)
|
|
79
|
+
if (!n.__unwrap) x("no original to unwrap to -- has " + String(t) + " already been unwrapped?");
|
|
81
80
|
else {
|
|
82
81
|
n.__unwrap();
|
|
83
82
|
return;
|
|
84
83
|
}
|
|
85
|
-
},
|
|
84
|
+
}, T = (e, t) => {
|
|
86
85
|
if (e) Array.isArray(e) || (e = [e]);
|
|
87
86
|
else {
|
|
88
|
-
|
|
87
|
+
x("must provide one or more modules to patch"), x((/* @__PURE__ */ Error()).stack);
|
|
89
88
|
return;
|
|
90
89
|
}
|
|
91
90
|
if (!(t && Array.isArray(t))) {
|
|
92
|
-
|
|
91
|
+
x("must provide one or more functions to unwrap on modules");
|
|
93
92
|
return;
|
|
94
93
|
}
|
|
95
94
|
e.forEach((e) => {
|
|
96
95
|
t.forEach((t) => {
|
|
97
|
-
|
|
96
|
+
w(e, t);
|
|
98
97
|
});
|
|
99
98
|
});
|
|
100
|
-
},
|
|
101
|
-
})),
|
|
102
|
-
|
|
99
|
+
}, b.wrap = S, b.massWrap = C, b.unwrap = w, b.massUnwrap = T;
|
|
100
|
+
})), D, O = t((() => {
|
|
101
|
+
s(), c(), E(), D = class {
|
|
103
102
|
_config = {};
|
|
104
103
|
_tracer;
|
|
105
104
|
_meter;
|
|
@@ -108,12 +107,12 @@ var S, C, w, T, E, D = t((() => {
|
|
|
108
107
|
instrumentationName;
|
|
109
108
|
instrumentationVersion;
|
|
110
109
|
constructor(e, t, n) {
|
|
111
|
-
this.instrumentationName = e, this.instrumentationVersion = t, this.setConfig(n), this._diag =
|
|
110
|
+
this.instrumentationName = e, this.instrumentationVersion = t, this.setConfig(n), this._diag = o.createComponentLogger({ namespace: e }), this._tracer = a.getTracer(e, t), this._meter = i.getMeter(e, t), this._logger = f.getLogger(e, t), this._updateMetricInstruments();
|
|
112
111
|
}
|
|
113
|
-
_wrap =
|
|
114
|
-
_unwrap =
|
|
115
|
-
_massWrap =
|
|
116
|
-
_massUnwrap =
|
|
112
|
+
_wrap = S;
|
|
113
|
+
_unwrap = w;
|
|
114
|
+
_massWrap = C;
|
|
115
|
+
_massUnwrap = T;
|
|
117
116
|
get meter() {
|
|
118
117
|
return this._meter;
|
|
119
118
|
}
|
|
@@ -154,8 +153,8 @@ var S, C, w, T, E, D = t((() => {
|
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
155
|
};
|
|
157
|
-
})),
|
|
158
|
-
|
|
156
|
+
})), k, A = t((() => {
|
|
157
|
+
O(), k = class extends D {
|
|
159
158
|
constructor(e, t, n) {
|
|
160
159
|
super(e, t, n), this._config.enabled && this.enable();
|
|
161
160
|
}
|
|
@@ -163,15 +162,15 @@ var S, C, w, T, E, D = t((() => {
|
|
|
163
162
|
}));
|
|
164
163
|
//#endregion
|
|
165
164
|
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/platform/browser/noop-normalize.js
|
|
166
|
-
function
|
|
167
|
-
return
|
|
165
|
+
function j(e) {
|
|
166
|
+
return o.warn("Path normalization is not implemented for this platform. To silence this warning, ensure no node-specific instrumentations are loaded, and node-specific types (e.g. InstrumentationNodeModuleFile), are not used in a browser context)"), e;
|
|
168
167
|
}
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
})),
|
|
172
|
-
|
|
173
|
-
})),
|
|
174
|
-
|
|
168
|
+
var M = t((() => {
|
|
169
|
+
s();
|
|
170
|
+
})), N = t((() => {
|
|
171
|
+
A(), M();
|
|
172
|
+
})), P, F = t((() => {
|
|
173
|
+
P = class {
|
|
175
174
|
files;
|
|
176
175
|
name;
|
|
177
176
|
supportedVersions;
|
|
@@ -181,20 +180,20 @@ var N = t((() => {
|
|
|
181
180
|
this.files = i || [], this.name = e, this.supportedVersions = t, this.patch = n, this.unpatch = r;
|
|
182
181
|
}
|
|
183
182
|
};
|
|
184
|
-
})),
|
|
185
|
-
|
|
183
|
+
})), I, L = t((() => {
|
|
184
|
+
N(), I = class {
|
|
186
185
|
name;
|
|
187
186
|
supportedVersions;
|
|
188
187
|
patch;
|
|
189
188
|
unpatch;
|
|
190
189
|
constructor(e, t, n, r) {
|
|
191
|
-
this.name =
|
|
190
|
+
this.name = j(e), this.supportedVersions = t, this.patch = n, this.unpatch = r;
|
|
192
191
|
}
|
|
193
192
|
};
|
|
194
193
|
}));
|
|
195
194
|
//#endregion
|
|
196
195
|
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/utils.js
|
|
197
|
-
function
|
|
196
|
+
function R(e, t, n) {
|
|
198
197
|
let r, i;
|
|
199
198
|
try {
|
|
200
199
|
i = e();
|
|
@@ -205,7 +204,7 @@ function z(e, t, n) {
|
|
|
205
204
|
return i;
|
|
206
205
|
}
|
|
207
206
|
}
|
|
208
|
-
async function
|
|
207
|
+
async function z(e, t, n) {
|
|
209
208
|
let r, i;
|
|
210
209
|
try {
|
|
211
210
|
i = await e();
|
|
@@ -216,55 +215,57 @@ async function B(e, t, n) {
|
|
|
216
215
|
return i;
|
|
217
216
|
}
|
|
218
217
|
}
|
|
219
|
-
function
|
|
218
|
+
function B(e) {
|
|
220
219
|
return typeof e == "function" && typeof e.__original == "function" && typeof e.__unwrap == "function" && e.__wrapped === !0;
|
|
221
220
|
}
|
|
222
|
-
var
|
|
221
|
+
var V = t((() => {}));
|
|
223
222
|
//#endregion
|
|
224
223
|
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/semconvStability.js
|
|
225
|
-
function
|
|
226
|
-
let n =
|
|
224
|
+
function H(e, t) {
|
|
225
|
+
let n = U.OLD, r = t?.split(",").map((e) => e.trim()).filter((e) => e !== "");
|
|
227
226
|
for (let t of r ?? []) if (t.toLowerCase() === e + "/dup") {
|
|
228
|
-
n =
|
|
227
|
+
n = U.DUPLICATE;
|
|
229
228
|
break;
|
|
230
|
-
} else t.toLowerCase() === e && (n =
|
|
229
|
+
} else t.toLowerCase() === e && (n = U.STABLE);
|
|
231
230
|
return n;
|
|
232
231
|
}
|
|
233
|
-
var
|
|
232
|
+
var U, W = t((() => {
|
|
234
233
|
(function(e) {
|
|
235
234
|
e[e.STABLE = 1] = "STABLE", e[e.OLD = 2] = "OLD", e[e.DUPLICATE = 3] = "DUPLICATE";
|
|
236
|
-
})(
|
|
237
|
-
})),
|
|
238
|
-
InstrumentationBase: () =>
|
|
239
|
-
InstrumentationNodeModuleDefinition: () =>
|
|
240
|
-
InstrumentationNodeModuleFile: () =>
|
|
241
|
-
SemconvStability: () =>
|
|
242
|
-
isWrapped: () =>
|
|
243
|
-
registerInstrumentations: () =>
|
|
244
|
-
safeExecuteInTheMiddle: () =>
|
|
245
|
-
safeExecuteInTheMiddleAsync: () =>
|
|
246
|
-
semconvStabilityFromStr: () =>
|
|
247
|
-
}),
|
|
248
|
-
|
|
249
|
-
})),
|
|
235
|
+
})(U ||= {});
|
|
236
|
+
})), G = /* @__PURE__ */ n({
|
|
237
|
+
InstrumentationBase: () => k,
|
|
238
|
+
InstrumentationNodeModuleDefinition: () => P,
|
|
239
|
+
InstrumentationNodeModuleFile: () => I,
|
|
240
|
+
SemconvStability: () => U,
|
|
241
|
+
isWrapped: () => B,
|
|
242
|
+
registerInstrumentations: () => _,
|
|
243
|
+
safeExecuteInTheMiddle: () => R,
|
|
244
|
+
safeExecuteInTheMiddleAsync: () => z,
|
|
245
|
+
semconvStabilityFromStr: () => H
|
|
246
|
+
}), K = t((() => {
|
|
247
|
+
v(), N(), F(), L(), V(), W();
|
|
248
|
+
})), q = /* @__PURE__ */ r(((e) => {
|
|
250
249
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.PACKAGE_NAME = e.PACKAGE_VERSION = void 0, e.PACKAGE_VERSION = "0.60.0", e.PACKAGE_NAME = "@opentelemetry/instrumentation-pino";
|
|
250
|
+
})), J = /* @__PURE__ */ r(((e, t) => {
|
|
251
|
+
t.exports = {};
|
|
251
252
|
})), Y = /* @__PURE__ */ r(((t) => {
|
|
252
253
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.OTelPinoStream = t.getTimeConverter = void 0;
|
|
253
|
-
var n =
|
|
254
|
+
var n = J(), r = (c(), e(p)), i = q(), a = (l(), e(u)), o = {
|
|
254
255
|
trace: 10,
|
|
255
256
|
debug: 20,
|
|
256
257
|
info: 30,
|
|
257
258
|
warn: 40,
|
|
258
259
|
error: 50,
|
|
259
260
|
fatal: 60
|
|
260
|
-
},
|
|
261
|
-
[
|
|
262
|
-
[
|
|
263
|
-
[
|
|
264
|
-
[
|
|
265
|
-
[
|
|
266
|
-
[
|
|
267
|
-
},
|
|
261
|
+
}, s = {
|
|
262
|
+
[o.trace]: r.SeverityNumber.TRACE,
|
|
263
|
+
[o.debug]: r.SeverityNumber.DEBUG,
|
|
264
|
+
[o.info]: r.SeverityNumber.INFO,
|
|
265
|
+
[o.warn]: r.SeverityNumber.WARN,
|
|
266
|
+
[o.error]: r.SeverityNumber.ERROR,
|
|
267
|
+
[o.fatal]: r.SeverityNumber.FATAL
|
|
268
|
+
}, d = [
|
|
268
269
|
r.SeverityNumber.TRACE2,
|
|
269
270
|
r.SeverityNumber.TRACE3,
|
|
270
271
|
r.SeverityNumber.TRACE4,
|
|
@@ -284,19 +285,19 @@ var W, G = t((() => {
|
|
|
284
285
|
r.SeverityNumber.FATAL3,
|
|
285
286
|
r.SeverityNumber.FATAL4
|
|
286
287
|
];
|
|
287
|
-
function
|
|
288
|
-
let t =
|
|
288
|
+
function f(e) {
|
|
289
|
+
let t = s[e];
|
|
289
290
|
if (t !== void 0) return t;
|
|
290
|
-
let n = (e - 10) / 60, r = Math.floor(n *
|
|
291
|
-
return
|
|
291
|
+
let n = (e - 10) / 60, r = Math.floor(n * d.length);
|
|
292
|
+
return d[Math.min(d.length - 1, Math.max(0, r))];
|
|
292
293
|
}
|
|
293
|
-
function
|
|
294
|
+
function m(e, t) {
|
|
294
295
|
let n = t.stdTimeFunctions, r = e[t.symbols.timeSym];
|
|
295
296
|
return r === n.epochTime ? (e) => e : r === n.unixTime ? (e) => e * 1e3 : r === n.isoTime ? (e) => new Date(e).getTime() : r === n.nullTime ? () => Date.now() : () => NaN;
|
|
296
297
|
}
|
|
297
|
-
t.getTimeConverter =
|
|
298
|
+
t.getTimeConverter = m, t.OTelPinoStream = class extends n.Writable {
|
|
298
299
|
constructor(e) {
|
|
299
|
-
super(), this._messageKey = e.messageKey, this._levels = e.levels, this._otelTimestampFromTime = e.otelTimestampFromTime, this._otelLogger = r.logs.getLogger(
|
|
300
|
+
super(), this._messageKey = e.messageKey, this._levels = e.levels, this._otelTimestampFromTime = e.otelTimestampFromTime, this._otelLogger = r.logs.getLogger(i.PACKAGE_NAME, i.PACKAGE_VERSION);
|
|
300
301
|
}
|
|
301
302
|
_write(e, t, n) {
|
|
302
303
|
/* istanbul ignore if */
|
|
@@ -315,14 +316,14 @@ var W, G = t((() => {
|
|
|
315
316
|
}
|
|
316
317
|
/* istanbul ignore if */
|
|
317
318
|
typeof r != "object" && (r = { data: r });
|
|
318
|
-
let { time: i, [this._messageKey]:
|
|
319
|
+
let { time: i, [this._messageKey]: o, level: s, hostname: c, pid: l, trace_id: u, span_id: d, trace_flags: p, ...m } = r, h = this._otelTimestampFromTime(i);
|
|
319
320
|
isNaN(h) && (m.time = i, h = Date.now());
|
|
320
|
-
let g = (0,
|
|
321
|
+
let g = (0, a.millisToHrTime)(h), _ = this.lastLevel, v = {
|
|
321
322
|
timestamp: g,
|
|
322
323
|
observedTimestamp: g,
|
|
323
|
-
severityNumber:
|
|
324
|
+
severityNumber: f(_),
|
|
324
325
|
severityText: this._levels.labels[_],
|
|
325
|
-
body:
|
|
326
|
+
body: o,
|
|
326
327
|
attributes: m
|
|
327
328
|
};
|
|
328
329
|
this._otelLogger.emit(v), n();
|
|
@@ -330,7 +331,7 @@ var W, G = t((() => {
|
|
|
330
331
|
};
|
|
331
332
|
})), X = /* @__PURE__ */ r(((t) => {
|
|
332
333
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.PinoInstrumentation = void 0;
|
|
333
|
-
var n = (
|
|
334
|
+
var n = (s(), e(d)), r = (K(), e(G)), i = q(), a = Y(), o = [">=5.14.0 <11"], c = {
|
|
334
335
|
traceId: "trace_id",
|
|
335
336
|
spanId: "span_id",
|
|
336
337
|
traceFlags: "trace_flags"
|
|
@@ -383,12 +384,12 @@ var W, G = t((() => {
|
|
|
383
384
|
if (!i) return {};
|
|
384
385
|
let a = i.spanContext();
|
|
385
386
|
if (!(0, n.isSpanContextValid)(a)) return {};
|
|
386
|
-
let o = e.getConfig().logKeys ??
|
|
387
|
+
let o = e.getConfig().logKeys ?? c, s = {
|
|
387
388
|
[o.traceId]: a.traceId,
|
|
388
389
|
[o.spanId]: a.spanId,
|
|
389
390
|
[o.traceFlags]: `0${a.traceFlags.toString(16)}`
|
|
390
391
|
};
|
|
391
|
-
return e._callHook(i,
|
|
392
|
+
return e._callHook(i, s, r), s;
|
|
392
393
|
};
|
|
393
394
|
}
|
|
394
395
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventuras/logger",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Structured logging with Pino and optional OpenTelemetry integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logger",
|
|
@@ -40,23 +40,17 @@
|
|
|
40
40
|
"files": [
|
|
41
41
|
"dist"
|
|
42
42
|
],
|
|
43
|
-
"scripts": {
|
|
44
|
-
"build": "vite build",
|
|
45
|
-
"dev": "vite build --watch",
|
|
46
|
-
"test": "vitest run",
|
|
47
|
-
"test:watch": "vitest"
|
|
48
|
-
},
|
|
49
43
|
"dependencies": {
|
|
50
44
|
"pino": "^10.3.1"
|
|
51
45
|
},
|
|
52
46
|
"devDependencies": {
|
|
53
|
-
"@eventuras/vite-config": "workspace:*",
|
|
54
47
|
"@opentelemetry/api": "^1.9.1",
|
|
55
48
|
"@opentelemetry/api-logs": "^0.214.0",
|
|
56
49
|
"@opentelemetry/instrumentation-pino": "^0.60.0",
|
|
57
50
|
"@opentelemetry/sdk-logs": "^0.214.0",
|
|
58
|
-
"vite": "^8.0.
|
|
59
|
-
"vitest": "^4.1.4"
|
|
51
|
+
"vite": "^8.0.8",
|
|
52
|
+
"vitest": "^4.1.4",
|
|
53
|
+
"@eventuras/vite-config": "0.2.1"
|
|
60
54
|
},
|
|
61
55
|
"peerDependencies": {
|
|
62
56
|
"@opentelemetry/api": "^1.9.0",
|
|
@@ -80,5 +74,11 @@
|
|
|
80
74
|
},
|
|
81
75
|
"engines": {
|
|
82
76
|
"node": ">=20"
|
|
77
|
+
},
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "vite build",
|
|
80
|
+
"dev": "vite build --watch",
|
|
81
|
+
"test": "vitest run",
|
|
82
|
+
"test:watch": "vitest"
|
|
83
83
|
}
|
|
84
|
-
}
|
|
84
|
+
}
|
|
File without changes
|