@eventuras/logger 0.7.1 → 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/README.md +70 -12
- package/dist/Logger-n-HsscG5.js +314 -0
- package/dist/Logger-n-HsscG5.js.map +1 -0
- package/dist/Logger.d.ts +3 -3
- package/dist/Logger.d.ts.map +1 -1
- package/dist/index.js +34 -219
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +21 -7
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +196 -2
- package/dist/node.js.map +1 -0
- package/dist/opentelemetry.d.ts.map +1 -1
- package/dist/opentelemetry.js +140 -26
- package/dist/opentelemetry.js.map +1 -0
- package/dist/transports/pino.d.ts +14 -2
- package/dist/transports/pino.d.ts.map +1 -1
- package/dist/types.d.ts +7 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-NnHqS4_Y.js +0 -20
- package/dist/esm-CIhYjsQQ.js +0 -528
- package/dist/esm-Dido2CZe.js +0 -1580
- package/dist/pretty-sMlW_evX.js +0 -114
- package/dist/src-15l0SmY8.js +0 -407
package/dist/pretty-sMlW_evX.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { Writable as e } from "node:stream";
|
|
2
|
-
//#region src/transports/pretty.ts
|
|
3
|
-
var t = {
|
|
4
|
-
reset: "\x1B[0m",
|
|
5
|
-
dim: "\x1B[2m",
|
|
6
|
-
bold: "\x1B[1m",
|
|
7
|
-
red: "\x1B[31m",
|
|
8
|
-
yellow: "\x1B[33m",
|
|
9
|
-
green: "\x1B[32m",
|
|
10
|
-
cyan: "\x1B[36m",
|
|
11
|
-
magenta: "\x1B[35m",
|
|
12
|
-
gray: "\x1B[90m"
|
|
13
|
-
}, n = {
|
|
14
|
-
10: {
|
|
15
|
-
label: "TRACE",
|
|
16
|
-
color: t.gray
|
|
17
|
-
},
|
|
18
|
-
20: {
|
|
19
|
-
label: "DEBUG",
|
|
20
|
-
color: t.cyan
|
|
21
|
-
},
|
|
22
|
-
30: {
|
|
23
|
-
label: "INFO ",
|
|
24
|
-
color: t.green
|
|
25
|
-
},
|
|
26
|
-
40: {
|
|
27
|
-
label: "WARN ",
|
|
28
|
-
color: t.yellow
|
|
29
|
-
},
|
|
30
|
-
50: {
|
|
31
|
-
label: "ERROR",
|
|
32
|
-
color: t.red
|
|
33
|
-
},
|
|
34
|
-
60: {
|
|
35
|
-
label: "FATAL",
|
|
36
|
-
color: `${t.bold}${t.red}`
|
|
37
|
-
}
|
|
38
|
-
}, r = {
|
|
39
|
-
trace: {
|
|
40
|
-
label: "TRACE",
|
|
41
|
-
color: t.gray
|
|
42
|
-
},
|
|
43
|
-
debug: {
|
|
44
|
-
label: "DEBUG",
|
|
45
|
-
color: t.cyan
|
|
46
|
-
},
|
|
47
|
-
info: {
|
|
48
|
-
label: "INFO ",
|
|
49
|
-
color: t.green
|
|
50
|
-
},
|
|
51
|
-
warn: {
|
|
52
|
-
label: "WARN ",
|
|
53
|
-
color: t.yellow
|
|
54
|
-
},
|
|
55
|
-
error: {
|
|
56
|
-
label: "ERROR",
|
|
57
|
-
color: t.red
|
|
58
|
-
},
|
|
59
|
-
fatal: {
|
|
60
|
-
label: "FATAL",
|
|
61
|
-
color: `${t.bold}${t.red}`
|
|
62
|
-
}
|
|
63
|
-
}, i = new Set([
|
|
64
|
-
"level",
|
|
65
|
-
"time",
|
|
66
|
-
"pid",
|
|
67
|
-
"hostname",
|
|
68
|
-
"msg",
|
|
69
|
-
"name",
|
|
70
|
-
"ns",
|
|
71
|
-
"namespace"
|
|
72
|
-
]);
|
|
73
|
-
function a(e) {
|
|
74
|
-
if (typeof e == "string") {
|
|
75
|
-
let t = new Date(e);
|
|
76
|
-
return Number.isNaN(t.getTime()) ? "" : t.toLocaleTimeString("en-GB", { hour12: !1 });
|
|
77
|
-
}
|
|
78
|
-
return typeof e == "number" ? new Date(e).toLocaleTimeString("en-GB", { hour12: !1 }) : (/* @__PURE__ */ new Date()).toLocaleTimeString("en-GB", { hour12: !1 });
|
|
79
|
-
}
|
|
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
|
-
}
|
|
85
|
-
function s(e) {
|
|
86
|
-
let i = e.trim();
|
|
87
|
-
if (!i) return "";
|
|
88
|
-
let s;
|
|
89
|
-
try {
|
|
90
|
-
s = JSON.parse(i);
|
|
91
|
-
} catch {
|
|
92
|
-
return i;
|
|
93
|
-
}
|
|
94
|
-
let c = s.level, l = typeof c == "string" ? r[c] ?? {
|
|
95
|
-
label: c.toUpperCase().padEnd(5),
|
|
96
|
-
color: t.gray
|
|
97
|
-
} : n[c] ?? {
|
|
98
|
-
label: `L${c}`,
|
|
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
|
-
}
|
|
103
|
-
function c() {
|
|
104
|
-
return new e({ write(e, t, n) {
|
|
105
|
-
let r = e.toString().split("\n");
|
|
106
|
-
for (let e of r) {
|
|
107
|
-
let t = s(e);
|
|
108
|
-
t && process.stdout.write(t + "\n");
|
|
109
|
-
}
|
|
110
|
-
n();
|
|
111
|
-
} });
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
|
-
export { s as n, c as t };
|
package/dist/src-15l0SmY8.js
DELETED
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "./chunk-NnHqS4_Y.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";
|
|
3
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/autoLoaderUtils.js
|
|
4
|
-
function m(e, t, n, r) {
|
|
5
|
-
for (let i = 0, a = e.length; i < a; i++) {
|
|
6
|
-
let a = e[i];
|
|
7
|
-
t && a.setTracerProvider(t), n && a.setMeterProvider(n), r && a.setLoggerProvider && a.setLoggerProvider(r), a.getConfig().enabled || a.enable();
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
function h(e) {
|
|
11
|
-
e.forEach((e) => e.disable());
|
|
12
|
-
}
|
|
13
|
-
var g = t((() => {}));
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/autoLoader.js
|
|
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);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
var v = t((() => {
|
|
23
|
-
s(), c(), g();
|
|
24
|
-
}));
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/shimmer.js
|
|
27
|
-
function y(e, t, n) {
|
|
28
|
-
let r = !!e[t] && Object.prototype.propertyIsEnumerable.call(e, t);
|
|
29
|
-
Object.defineProperty(e, t, {
|
|
30
|
-
configurable: !0,
|
|
31
|
-
enumerable: r,
|
|
32
|
-
writable: !0,
|
|
33
|
-
value: n
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function b(e) {
|
|
37
|
-
e && e.logger && (typeof e.logger == "function" ? x = e.logger : x("new logger isn't a function, not replacing"));
|
|
38
|
-
}
|
|
39
|
-
var x, S, C, w, T, E = t((() => {
|
|
40
|
-
x = console.error.bind(console), S = (e, t, n) => {
|
|
41
|
-
if (!e || !e[t]) {
|
|
42
|
-
x("no original function " + String(t) + " to wrap");
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (!n) {
|
|
46
|
-
x("no wrapper function"), x((/* @__PURE__ */ Error()).stack);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
let r = e[t];
|
|
50
|
-
if (typeof r != "function" || typeof n != "function") {
|
|
51
|
-
x("original object and wrapper must be functions");
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
let i = n(r, t);
|
|
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) => {
|
|
59
|
-
if (e) Array.isArray(e) || (e = [e]);
|
|
60
|
-
else {
|
|
61
|
-
x("must provide one or more modules to patch"), x((/* @__PURE__ */ Error()).stack);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (!(t && Array.isArray(t))) {
|
|
65
|
-
x("must provide one or more functions to wrap on modules");
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
e.forEach((e) => {
|
|
69
|
-
t.forEach((t) => {
|
|
70
|
-
S(e, t, n);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}, w = (e, t) => {
|
|
74
|
-
if (!e || !e[t]) {
|
|
75
|
-
x("no function to unwrap."), x((/* @__PURE__ */ Error()).stack);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
let n = e[t];
|
|
79
|
-
if (!n.__unwrap) x("no original to unwrap to -- has " + String(t) + " already been unwrapped?");
|
|
80
|
-
else {
|
|
81
|
-
n.__unwrap();
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
}, T = (e, t) => {
|
|
85
|
-
if (e) Array.isArray(e) || (e = [e]);
|
|
86
|
-
else {
|
|
87
|
-
x("must provide one or more modules to patch"), x((/* @__PURE__ */ Error()).stack);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (!(t && Array.isArray(t))) {
|
|
91
|
-
x("must provide one or more functions to unwrap on modules");
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
e.forEach((e) => {
|
|
95
|
-
t.forEach((t) => {
|
|
96
|
-
w(e, t);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
}, b.wrap = S, b.massWrap = C, b.unwrap = w, b.massUnwrap = T;
|
|
100
|
-
})), D, O = t((() => {
|
|
101
|
-
s(), c(), E(), D = class {
|
|
102
|
-
_config = {};
|
|
103
|
-
_tracer;
|
|
104
|
-
_meter;
|
|
105
|
-
_logger;
|
|
106
|
-
_diag;
|
|
107
|
-
instrumentationName;
|
|
108
|
-
instrumentationVersion;
|
|
109
|
-
constructor(e, t, n) {
|
|
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();
|
|
111
|
-
}
|
|
112
|
-
_wrap = S;
|
|
113
|
-
_unwrap = w;
|
|
114
|
-
_massWrap = C;
|
|
115
|
-
_massUnwrap = T;
|
|
116
|
-
get meter() {
|
|
117
|
-
return this._meter;
|
|
118
|
-
}
|
|
119
|
-
setMeterProvider(e) {
|
|
120
|
-
this._meter = e.getMeter(this.instrumentationName, this.instrumentationVersion), this._updateMetricInstruments();
|
|
121
|
-
}
|
|
122
|
-
get logger() {
|
|
123
|
-
return this._logger;
|
|
124
|
-
}
|
|
125
|
-
setLoggerProvider(e) {
|
|
126
|
-
this._logger = e.getLogger(this.instrumentationName, this.instrumentationVersion);
|
|
127
|
-
}
|
|
128
|
-
getModuleDefinitions() {
|
|
129
|
-
let e = this.init() ?? [];
|
|
130
|
-
return Array.isArray(e) ? e : [e];
|
|
131
|
-
}
|
|
132
|
-
_updateMetricInstruments() {}
|
|
133
|
-
getConfig() {
|
|
134
|
-
return this._config;
|
|
135
|
-
}
|
|
136
|
-
setConfig(e) {
|
|
137
|
-
this._config = {
|
|
138
|
-
enabled: !0,
|
|
139
|
-
...e
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
setTracerProvider(e) {
|
|
143
|
-
this._tracer = e.getTracer(this.instrumentationName, this.instrumentationVersion);
|
|
144
|
-
}
|
|
145
|
-
get tracer() {
|
|
146
|
-
return this._tracer;
|
|
147
|
-
}
|
|
148
|
-
_runSpanCustomizationHook(e, t, n, r) {
|
|
149
|
-
if (e) try {
|
|
150
|
-
e(n, r);
|
|
151
|
-
} catch (e) {
|
|
152
|
-
this._diag.error("Error running span customization hook due to exception in handler", { triggerName: t }, e);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
})), k, A = t((() => {
|
|
157
|
-
O(), k = class extends D {
|
|
158
|
-
constructor(e, t, n) {
|
|
159
|
-
super(e, t, n), this._config.enabled && this.enable();
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
}));
|
|
163
|
-
//#endregion
|
|
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
|
|
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;
|
|
167
|
-
}
|
|
168
|
-
var M = t((() => {
|
|
169
|
-
s();
|
|
170
|
-
})), N = t((() => {
|
|
171
|
-
A(), M();
|
|
172
|
-
})), P, F = t((() => {
|
|
173
|
-
P = class {
|
|
174
|
-
files;
|
|
175
|
-
name;
|
|
176
|
-
supportedVersions;
|
|
177
|
-
patch;
|
|
178
|
-
unpatch;
|
|
179
|
-
constructor(e, t, n, r, i) {
|
|
180
|
-
this.files = i || [], this.name = e, this.supportedVersions = t, this.patch = n, this.unpatch = r;
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
})), I, L = t((() => {
|
|
184
|
-
N(), I = class {
|
|
185
|
-
name;
|
|
186
|
-
supportedVersions;
|
|
187
|
-
patch;
|
|
188
|
-
unpatch;
|
|
189
|
-
constructor(e, t, n, r) {
|
|
190
|
-
this.name = j(e), this.supportedVersions = t, this.patch = n, this.unpatch = r;
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
}));
|
|
194
|
-
//#endregion
|
|
195
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/utils.js
|
|
196
|
-
function R(e, t, n) {
|
|
197
|
-
let r, i;
|
|
198
|
-
try {
|
|
199
|
-
i = e();
|
|
200
|
-
} catch (e) {
|
|
201
|
-
r = e;
|
|
202
|
-
} finally {
|
|
203
|
-
if (t(r, i), r && !n) throw r;
|
|
204
|
-
return i;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
async function z(e, t, n) {
|
|
208
|
-
let r, i;
|
|
209
|
-
try {
|
|
210
|
-
i = await e();
|
|
211
|
-
} catch (e) {
|
|
212
|
-
r = e;
|
|
213
|
-
} finally {
|
|
214
|
-
if (await t(r, i), r && !n) throw r;
|
|
215
|
-
return i;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
function B(e) {
|
|
219
|
-
return typeof e == "function" && typeof e.__original == "function" && typeof e.__unwrap == "function" && e.__wrapped === !0;
|
|
220
|
-
}
|
|
221
|
-
var V = t((() => {}));
|
|
222
|
-
//#endregion
|
|
223
|
-
//#region ../../node_modules/.pnpm/@opentelemetry+instrumentation@0.214.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/instrumentation/build/esm/semconvStability.js
|
|
224
|
-
function H(e, t) {
|
|
225
|
-
let n = U.OLD, r = t?.split(",").map((e) => e.trim()).filter((e) => e !== "");
|
|
226
|
-
for (let t of r ?? []) if (t.toLowerCase() === e + "/dup") {
|
|
227
|
-
n = U.DUPLICATE;
|
|
228
|
-
break;
|
|
229
|
-
} else t.toLowerCase() === e && (n = U.STABLE);
|
|
230
|
-
return n;
|
|
231
|
-
}
|
|
232
|
-
var U, W = t((() => {
|
|
233
|
-
(function(e) {
|
|
234
|
-
e[e.STABLE = 1] = "STABLE", e[e.OLD = 2] = "OLD", e[e.DUPLICATE = 3] = "DUPLICATE";
|
|
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) => {
|
|
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 = {};
|
|
252
|
-
})), Y = /* @__PURE__ */ r(((t) => {
|
|
253
|
-
Object.defineProperty(t, "__esModule", { value: !0 }), t.OTelPinoStream = t.getTimeConverter = void 0;
|
|
254
|
-
var n = J(), r = (c(), e(p)), i = q(), a = (l(), e(u)), o = {
|
|
255
|
-
trace: 10,
|
|
256
|
-
debug: 20,
|
|
257
|
-
info: 30,
|
|
258
|
-
warn: 40,
|
|
259
|
-
error: 50,
|
|
260
|
-
fatal: 60
|
|
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 = [
|
|
269
|
-
r.SeverityNumber.TRACE2,
|
|
270
|
-
r.SeverityNumber.TRACE3,
|
|
271
|
-
r.SeverityNumber.TRACE4,
|
|
272
|
-
r.SeverityNumber.DEBUG2,
|
|
273
|
-
r.SeverityNumber.DEBUG3,
|
|
274
|
-
r.SeverityNumber.DEBUG4,
|
|
275
|
-
r.SeverityNumber.INFO2,
|
|
276
|
-
r.SeverityNumber.INFO3,
|
|
277
|
-
r.SeverityNumber.INFO4,
|
|
278
|
-
r.SeverityNumber.WARN2,
|
|
279
|
-
r.SeverityNumber.WARN3,
|
|
280
|
-
r.SeverityNumber.WARN4,
|
|
281
|
-
r.SeverityNumber.ERROR2,
|
|
282
|
-
r.SeverityNumber.ERROR3,
|
|
283
|
-
r.SeverityNumber.ERROR4,
|
|
284
|
-
r.SeverityNumber.FATAL2,
|
|
285
|
-
r.SeverityNumber.FATAL3,
|
|
286
|
-
r.SeverityNumber.FATAL4
|
|
287
|
-
];
|
|
288
|
-
function f(e) {
|
|
289
|
-
let t = s[e];
|
|
290
|
-
if (t !== void 0) return t;
|
|
291
|
-
let n = (e - 10) / 60, r = Math.floor(n * d.length);
|
|
292
|
-
return d[Math.min(d.length - 1, Math.max(0, r))];
|
|
293
|
-
}
|
|
294
|
-
function m(e, t) {
|
|
295
|
-
let n = t.stdTimeFunctions, r = e[t.symbols.timeSym];
|
|
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;
|
|
297
|
-
}
|
|
298
|
-
t.getTimeConverter = m, t.OTelPinoStream = class extends n.Writable {
|
|
299
|
-
constructor(e) {
|
|
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);
|
|
301
|
-
}
|
|
302
|
-
_write(e, t, n) {
|
|
303
|
-
/* istanbul ignore if */
|
|
304
|
-
if (!e) return;
|
|
305
|
-
let r;
|
|
306
|
-
try {
|
|
307
|
-
r = JSON.parse(e);
|
|
308
|
-
} catch (t) {
|
|
309
|
-
this.emit("unknown", e.toString(), t), n();
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
/* istanbul ignore if */
|
|
313
|
-
if (r === null) {
|
|
314
|
-
this.emit("unknown", e.toString(), "Null value ignored"), n();
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
/* istanbul ignore if */
|
|
318
|
-
typeof r != "object" && (r = { data: r });
|
|
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);
|
|
320
|
-
isNaN(h) && (m.time = i, h = Date.now());
|
|
321
|
-
let g = (0, a.millisToHrTime)(h), _ = this.lastLevel, v = {
|
|
322
|
-
timestamp: g,
|
|
323
|
-
observedTimestamp: g,
|
|
324
|
-
severityNumber: f(_),
|
|
325
|
-
severityText: this._levels.labels[_],
|
|
326
|
-
body: o,
|
|
327
|
-
attributes: m
|
|
328
|
-
};
|
|
329
|
-
this._otelLogger.emit(v), n();
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
})), X = /* @__PURE__ */ r(((t) => {
|
|
333
|
-
Object.defineProperty(t, "__esModule", { value: !0 }), t.PinoInstrumentation = void 0;
|
|
334
|
-
var n = (s(), e(d)), r = (K(), e(G)), i = q(), a = Y(), o = [">=5.14.0 <11"], c = {
|
|
335
|
-
traceId: "trace_id",
|
|
336
|
-
spanId: "span_id",
|
|
337
|
-
traceFlags: "trace_flags"
|
|
338
|
-
};
|
|
339
|
-
t.PinoInstrumentation = class extends r.InstrumentationBase {
|
|
340
|
-
constructor(e = {}) {
|
|
341
|
-
super(i.PACKAGE_NAME, i.PACKAGE_VERSION, e);
|
|
342
|
-
}
|
|
343
|
-
init() {
|
|
344
|
-
return [new r.InstrumentationNodeModuleDefinition("pino", o, (e) => {
|
|
345
|
-
let t = e[Symbol.toStringTag] === "Module", n = t ? e.default : e, r = this, i = Object.assign((...e) => {
|
|
346
|
-
let t = r.getConfig(), i = r.isEnabled(), o = n(...e), s = r._getMixinFunction(), c = n.symbols.mixinSym, l = o[c];
|
|
347
|
-
if (l === void 0 ? o[c] = s : o[c] = (e, t, ...n) => Object.assign(s(e, t), l(e, t, ...n)), i && !t.disableLogSending && typeof n.multistream == "function") {
|
|
348
|
-
let e = (0, a.getTimeConverter)(o, n), t = new a.OTelPinoStream({
|
|
349
|
-
messageKey: o[n.symbols.messageKeySym],
|
|
350
|
-
levels: o.levels,
|
|
351
|
-
otelTimestampFromTime: e
|
|
352
|
-
});
|
|
353
|
-
t[Symbol.for("pino.metadata")] = !0, t.once("unknown", (e, t) => {
|
|
354
|
-
r._diag.warn("could not send pino log line (will only log first occurrence)", {
|
|
355
|
-
line: e,
|
|
356
|
-
err: t
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
let i = o[n.symbols.streamSym];
|
|
360
|
-
o[n.symbols.streamSym] = n.multistream([{
|
|
361
|
-
level: 0,
|
|
362
|
-
stream: i
|
|
363
|
-
}, {
|
|
364
|
-
level: 0,
|
|
365
|
-
stream: t
|
|
366
|
-
}], { levels: o.levels.values });
|
|
367
|
-
}
|
|
368
|
-
return o;
|
|
369
|
-
}, n);
|
|
370
|
-
return typeof i.pino == "function" && (i.pino = i), typeof i.default == "function" && (i.default = i), t && (e.pino &&= i, e.default = i), i;
|
|
371
|
-
})];
|
|
372
|
-
}
|
|
373
|
-
_callHook(e, t, i) {
|
|
374
|
-
let { logHook: a } = this.getConfig();
|
|
375
|
-
a && (0, r.safeExecuteInTheMiddle)(() => a(e, t, i), (e) => {
|
|
376
|
-
e && n.diag.error("pino instrumentation: error calling logHook", e);
|
|
377
|
-
}, !0);
|
|
378
|
-
}
|
|
379
|
-
_getMixinFunction() {
|
|
380
|
-
let e = this;
|
|
381
|
-
return function(t, r) {
|
|
382
|
-
if (!e.isEnabled() || e.getConfig().disableLogCorrelation) return {};
|
|
383
|
-
let i = n.trace.getSpan(n.context.active());
|
|
384
|
-
if (!i) return {};
|
|
385
|
-
let a = i.spanContext();
|
|
386
|
-
if (!(0, n.isSpanContextValid)(a)) return {};
|
|
387
|
-
let o = e.getConfig().logKeys ?? c, s = {
|
|
388
|
-
[o.traceId]: a.traceId,
|
|
389
|
-
[o.spanId]: a.spanId,
|
|
390
|
-
[o.traceFlags]: `0${a.traceFlags.toString(16)}`
|
|
391
|
-
};
|
|
392
|
-
return e._callHook(i, s, r), s;
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
})), Z = /* @__PURE__ */ r(((e) => {
|
|
397
|
-
Object.defineProperty(e, "__esModule", { value: !0 }), e.PinoInstrumentation = void 0;
|
|
398
|
-
var t = X();
|
|
399
|
-
Object.defineProperty(e, "PinoInstrumentation", {
|
|
400
|
-
enumerable: !0,
|
|
401
|
-
get: function() {
|
|
402
|
-
return t.PinoInstrumentation;
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
}));
|
|
406
|
-
//#endregion
|
|
407
|
-
export default Z();
|