@visulima/pail 2.1.16 → 2.1.18
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/CHANGELOG.md +24 -0
- package/dist/index.browser.cjs +19 -1
- package/dist/index.browser.mjs +14 -1
- package/dist/index.server.cjs +442 -5
- package/dist/index.server.mjs +437 -5
- package/dist/packem_shared/CallerProcessor-CyJFdYGN.mjs +58 -0
- package/dist/packem_shared/CallerProcessor-DYrXv6Fp.cjs +60 -0
- package/dist/packem_shared/JsonFileReporter-BHaRQMnS.cjs +135 -0
- package/dist/packem_shared/JsonFileReporter-CdHau53i.mjs +133 -0
- package/dist/packem_shared/JsonReporter-C05lFJhj.mjs +20 -0
- package/dist/packem_shared/JsonReporter-DCd8dbfQ.mjs +32 -0
- package/dist/packem_shared/JsonReporter-DDubAhfJ.cjs +22 -0
- package/dist/packem_shared/JsonReporter-HXYHZuWz.cjs +34 -0
- package/dist/packem_shared/MessageFormatterProcessor-CFyi7GWt.mjs +53 -0
- package/dist/packem_shared/MessageFormatterProcessor-D_txQ9nO.cjs +55 -0
- package/dist/packem_shared/PrettyReporter-Bx3QLZrW.mjs +162 -0
- package/dist/packem_shared/PrettyReporter-LWDDriJ1.cjs +200 -0
- package/dist/packem_shared/PrettyReporter-XC0Ix5SW.mjs +192 -0
- package/dist/packem_shared/PrettyReporter-mFCjMb0i.cjs +168 -0
- package/dist/packem_shared/RedactProcessor-CfNkF2lC.mjs +26 -0
- package/dist/packem_shared/RedactProcessor-DWE5iqAQ.cjs +26 -0
- package/dist/packem_shared/SimpleReporter-CuNgsGVB.mjs +178 -0
- package/dist/packem_shared/SimpleReporter-DabZGkIs.cjs +186 -0
- package/dist/packem_shared/abstract-json-reporter-CG0EXqip.mjs +55 -0
- package/dist/packem_shared/abstract-json-reporter-D4MiU6B-.cjs +57 -0
- package/dist/packem_shared/abstract-pretty-reporter-BR_6_JVa.cjs +49 -0
- package/dist/packem_shared/abstract-pretty-reporter-izJgxoMv.mjs +46 -0
- package/dist/packem_shared/constants-BYYZ5WNW.mjs +114 -0
- package/dist/packem_shared/constants-DHfYGxxG.cjs +118 -0
- package/dist/packem_shared/format-label-CQCvMzlF.cjs +622 -0
- package/dist/packem_shared/format-label-DYMZf3Bg.mjs +610 -0
- package/dist/packem_shared/get-longest-label-CM8kLFWH.mjs +11 -0
- package/dist/packem_shared/get-longest-label-CQ7lRhgD.cjs +13 -0
- package/dist/packem_shared/pail.browser-B3Bi2uPA.cjs +387 -0
- package/dist/packem_shared/pail.browser-DZLrCtc5.mjs +384 -0
- package/dist/packem_shared/write-console-log-Cu0-IDN-.cjs +18 -0
- package/dist/packem_shared/write-console-log-Tptfzg9D.mjs +16 -0
- package/dist/packem_shared/write-stream-BBAF33Zm.mjs +8 -0
- package/dist/packem_shared/write-stream-CkNf2Ju8.cjs +10 -0
- package/dist/processor.browser.cjs +11 -1
- package/dist/processor.browser.mjs +2 -1
- package/dist/processor.server.cjs +13 -1
- package/dist/processor.server.mjs +3 -1
- package/dist/reporter.browser.cjs +11 -1
- package/dist/reporter.browser.mjs +2 -1
- package/dist/reporter.server.cjs +15 -1
- package/dist/reporter.server.mjs +4 -1
- package/package.json +14 -14
- package/dist/packem_shared/CallerProcessor-BBHkvRgS.mjs +0 -1
- package/dist/packem_shared/CallerProcessor-CLoY9R76.cjs +0 -1
- package/dist/packem_shared/JsonFileReporter-CLEMnuGI.cjs +0 -2
- package/dist/packem_shared/JsonFileReporter-lr0s7r9B.mjs +0 -4
- package/dist/packem_shared/JsonReporter-CiQkPCv4.cjs +0 -2
- package/dist/packem_shared/JsonReporter-CjvkrXUp.cjs +0 -1
- package/dist/packem_shared/JsonReporter-DInAbLuf.mjs +0 -1
- package/dist/packem_shared/JsonReporter-J50eZjl2.mjs +0 -2
- package/dist/packem_shared/MessageFormatterProcessor-CCRIUIdT.cjs +0 -1
- package/dist/packem_shared/MessageFormatterProcessor-D_XajTuK.mjs +0 -1
- package/dist/packem_shared/PrettyReporter-1SleqVaI.mjs +0 -13
- package/dist/packem_shared/PrettyReporter-C_AJrNOj.mjs +0 -5
- package/dist/packem_shared/PrettyReporter-CldK9UpN.cjs +0 -13
- package/dist/packem_shared/PrettyReporter-CuJWFD0k.cjs +0 -5
- package/dist/packem_shared/RedactProcessor-BVZtatWJ.cjs +0 -1
- package/dist/packem_shared/RedactProcessor-CxKTN42V.mjs +0 -3
- package/dist/packem_shared/SimpleReporter-Cy_0ZeXQ.cjs +0 -11
- package/dist/packem_shared/SimpleReporter-DzUWU5Gu.mjs +0 -11
- package/dist/packem_shared/abstract-json-reporter-29d4dwOH.mjs +0 -1
- package/dist/packem_shared/abstract-json-reporter-Z6bVrpPK.cjs +0 -1
- package/dist/packem_shared/abstract-pretty-reporter-CZb4ET-0.cjs +0 -1
- package/dist/packem_shared/abstract-pretty-reporter-DgXRHEj-.mjs +0 -1
- package/dist/packem_shared/constants-BFrKdBPm.cjs +0 -1
- package/dist/packem_shared/constants-BMS51p6Y.mjs +0 -1
- package/dist/packem_shared/format-label-B0BaeOry.cjs +0 -8
- package/dist/packem_shared/format-label-ECls2QEw.mjs +0 -8
- package/dist/packem_shared/get-longest-label-4ISUsE2q.mjs +0 -1
- package/dist/packem_shared/get-longest-label-DXpzhu5N.cjs +0 -1
- package/dist/packem_shared/pail.browser-D7k9K5zt.mjs +0 -1
- package/dist/packem_shared/pail.browser-tTEE0Aky.cjs +0 -1
- package/dist/packem_shared/write-console-log-3G15muTS.cjs +0 -1
- package/dist/packem_shared/write-console-log-BP95fgQZ.mjs +0 -1
- package/dist/packem_shared/write-stream-Bgxqp0HI.cjs +0 -1
- package/dist/packem_shared/write-stream-C17GXSxA.mjs +0 -1
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { configure } from 'safe-stable-stringify';
|
|
2
|
+
import { L as LOG_TYPES, a as EXTENDED_RFC_5424_LOG_LEVELS, E as EMPTY_SYMBOL } from './constants-BYYZ5WNW.mjs';
|
|
3
|
+
import { w as writeConsoleLogBasedOnLevel } from './write-console-log-Tptfzg9D.mjs';
|
|
4
|
+
import { g as getLongestLabel } from './get-longest-label-CM8kLFWH.mjs';
|
|
5
|
+
|
|
6
|
+
var __defProp$3 = Object.defineProperty;
|
|
7
|
+
var __name$3 = (target, value) => __defProp$3(target, "name", { value, configurable: true });
|
|
8
|
+
class RawReporter {
|
|
9
|
+
static {
|
|
10
|
+
__name$3(this, "RawReporter");
|
|
11
|
+
}
|
|
12
|
+
// eslint-disable-next-line class-methods-use-this
|
|
13
|
+
log(meta) {
|
|
14
|
+
const { context = [], message, type } = meta;
|
|
15
|
+
const consoleLogFunction = writeConsoleLogBasedOnLevel(type.level);
|
|
16
|
+
consoleLogFunction(message, ...context);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var __defProp$2 = Object.defineProperty;
|
|
21
|
+
var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
|
|
22
|
+
const arrayify = /* @__PURE__ */ __name$2((x) => {
|
|
23
|
+
if (x === undefined) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
return Array.isArray(x) ? x : [x];
|
|
27
|
+
}, "arrayify");
|
|
28
|
+
|
|
29
|
+
var __defProp$1 = Object.defineProperty;
|
|
30
|
+
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
31
|
+
const mergeTypes = /* @__PURE__ */ __name$1((standard, custom) => {
|
|
32
|
+
const types = { ...standard };
|
|
33
|
+
Object.keys(custom).forEach((type) => {
|
|
34
|
+
types[type] = { ...types[type], ...custom[type] };
|
|
35
|
+
});
|
|
36
|
+
return types;
|
|
37
|
+
}, "mergeTypes");
|
|
38
|
+
|
|
39
|
+
var __defProp = Object.defineProperty;
|
|
40
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
41
|
+
class PailBrowserImpl {
|
|
42
|
+
static {
|
|
43
|
+
__name(this, "PailBrowserImpl");
|
|
44
|
+
}
|
|
45
|
+
timersMap;
|
|
46
|
+
countMap;
|
|
47
|
+
seqTimers;
|
|
48
|
+
lastLog;
|
|
49
|
+
logLevels;
|
|
50
|
+
disabled;
|
|
51
|
+
scopeName;
|
|
52
|
+
types;
|
|
53
|
+
longestLabel;
|
|
54
|
+
processors;
|
|
55
|
+
generalLogLevel;
|
|
56
|
+
reporters;
|
|
57
|
+
throttle;
|
|
58
|
+
throttleMin;
|
|
59
|
+
stringify;
|
|
60
|
+
groups;
|
|
61
|
+
startTimerMessage;
|
|
62
|
+
endTimerMessage;
|
|
63
|
+
rawReporter;
|
|
64
|
+
constructor(options) {
|
|
65
|
+
this.throttle = options.throttle ?? 1e3;
|
|
66
|
+
this.throttleMin = options.throttleMin ?? 5;
|
|
67
|
+
this.stringify = configure({
|
|
68
|
+
strict: true
|
|
69
|
+
});
|
|
70
|
+
this.startTimerMessage = options.messages?.timerStart ?? "Initialized timer...";
|
|
71
|
+
this.endTimerMessage = options.messages?.timerEnd ?? "Timer run for:";
|
|
72
|
+
this.types = mergeTypes(LOG_TYPES, options.types ?? {});
|
|
73
|
+
this.longestLabel = getLongestLabel(this.types);
|
|
74
|
+
this.logLevels = { ...EXTENDED_RFC_5424_LOG_LEVELS, ...options.logLevels };
|
|
75
|
+
this.generalLogLevel = this._normalizeLogLevel(options.logLevel);
|
|
76
|
+
this.reporters = /* @__PURE__ */ new Set();
|
|
77
|
+
this.processors = /* @__PURE__ */ new Set();
|
|
78
|
+
this.disabled = options.disabled ?? false;
|
|
79
|
+
this.scopeName = arrayify(options.scope).filter(Boolean);
|
|
80
|
+
this.timersMap = /* @__PURE__ */ new Map();
|
|
81
|
+
this.countMap = /* @__PURE__ */ new Map();
|
|
82
|
+
this.groups = [];
|
|
83
|
+
this.seqTimers = /* @__PURE__ */ new Set();
|
|
84
|
+
for (const type in this.types) {
|
|
85
|
+
this[type] = this._logger.bind(this, type, false);
|
|
86
|
+
}
|
|
87
|
+
this.lastLog = {};
|
|
88
|
+
if (Array.isArray(options.reporters)) {
|
|
89
|
+
this.registerReporters(options.reporters);
|
|
90
|
+
}
|
|
91
|
+
this.rawReporter = this.extendReporter(options.rawReporter ?? new RawReporter());
|
|
92
|
+
if (Array.isArray(options.processors)) {
|
|
93
|
+
this.registerProcessors(options.processors);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
wrapConsole() {
|
|
97
|
+
for (const type in this.types) {
|
|
98
|
+
if (!console["__" + type]) {
|
|
99
|
+
console["__" + type] = console[type];
|
|
100
|
+
}
|
|
101
|
+
console[type] = this[type];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
restoreConsole() {
|
|
105
|
+
for (const type in this.types) {
|
|
106
|
+
if (console["__" + type]) {
|
|
107
|
+
console[type] = console["__" + type];
|
|
108
|
+
delete console["__" + type];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
wrapException() {
|
|
113
|
+
{
|
|
114
|
+
process.on("uncaughtException", (error) => {
|
|
115
|
+
this.error(error);
|
|
116
|
+
});
|
|
117
|
+
process.on("unhandledRejection", (error) => {
|
|
118
|
+
this.error(error);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Disables logging
|
|
124
|
+
*/
|
|
125
|
+
disable() {
|
|
126
|
+
this.disabled = true;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Enables logging
|
|
130
|
+
*/
|
|
131
|
+
enable() {
|
|
132
|
+
this.disabled = false;
|
|
133
|
+
}
|
|
134
|
+
isEnabled() {
|
|
135
|
+
return !this.disabled;
|
|
136
|
+
}
|
|
137
|
+
scope(...name) {
|
|
138
|
+
if (name.length === 0) {
|
|
139
|
+
throw new Error("No scope name was defined.");
|
|
140
|
+
}
|
|
141
|
+
this.scopeName = name.flat();
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
unscope() {
|
|
145
|
+
this.scopeName = [];
|
|
146
|
+
}
|
|
147
|
+
time(label = "default") {
|
|
148
|
+
if (this.seqTimers.has(label)) {
|
|
149
|
+
this._logger("warn", false, {
|
|
150
|
+
message: "Timer '" + label + "' already exists",
|
|
151
|
+
prefix: label
|
|
152
|
+
});
|
|
153
|
+
} else {
|
|
154
|
+
this.seqTimers.add(label);
|
|
155
|
+
this.timersMap.set(label, Date.now());
|
|
156
|
+
this._logger("start", false, {
|
|
157
|
+
message: this.startTimerMessage,
|
|
158
|
+
prefix: label
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
timeLog(label, ...data) {
|
|
163
|
+
if (!label && this.seqTimers.size > 0) {
|
|
164
|
+
label = [...this.seqTimers].pop();
|
|
165
|
+
}
|
|
166
|
+
if (label && this.timersMap.has(label)) {
|
|
167
|
+
const span = Date.now() - this.timersMap.get(label);
|
|
168
|
+
this._logger("info", false, {
|
|
169
|
+
context: data,
|
|
170
|
+
message: span < 1e3 ? span + " ms" : (span / 1e3).toFixed(2) + " s",
|
|
171
|
+
prefix: label
|
|
172
|
+
});
|
|
173
|
+
} else {
|
|
174
|
+
this._logger("warn", false, {
|
|
175
|
+
context: data,
|
|
176
|
+
message: "Timer not found",
|
|
177
|
+
prefix: label
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
timeEnd(label) {
|
|
182
|
+
if (!label && this.seqTimers.size > 0) {
|
|
183
|
+
label = [...this.seqTimers].pop();
|
|
184
|
+
}
|
|
185
|
+
if (label && this.timersMap.has(label)) {
|
|
186
|
+
const span = Date.now() - this.timersMap.get(label);
|
|
187
|
+
this.timersMap.delete(label);
|
|
188
|
+
this._logger("stop", false, {
|
|
189
|
+
message: this.endTimerMessage + " " + (span < 1e3 ? span + " ms" : (span / 1e3).toFixed(2) + " s"),
|
|
190
|
+
prefix: label
|
|
191
|
+
});
|
|
192
|
+
} else {
|
|
193
|
+
this._logger("warn", false, {
|
|
194
|
+
message: "Timer not found",
|
|
195
|
+
prefix: label
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
group(label = "console.group") {
|
|
200
|
+
if (typeof window === "undefined") {
|
|
201
|
+
this.groups.push(label);
|
|
202
|
+
} else {
|
|
203
|
+
console.group(label);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
groupEnd() {
|
|
207
|
+
if (typeof window === "undefined") {
|
|
208
|
+
this.groups.pop();
|
|
209
|
+
} else {
|
|
210
|
+
console.groupEnd();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
count(label = "default") {
|
|
214
|
+
const current = this.countMap.get(label) ?? 0;
|
|
215
|
+
this.countMap.set(label, current + 1);
|
|
216
|
+
this._logger("log", false, {
|
|
217
|
+
message: label + ": " + (current + 1),
|
|
218
|
+
prefix: label
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
countReset(label = "default") {
|
|
222
|
+
if (this.countMap.has(label)) {
|
|
223
|
+
this.countMap.delete(label);
|
|
224
|
+
} else {
|
|
225
|
+
this._logger("warn", false, {
|
|
226
|
+
message: "Count for " + label + " does not exist",
|
|
227
|
+
prefix: label
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// eslint-disable-next-line class-methods-use-this
|
|
232
|
+
clear() {
|
|
233
|
+
console.clear();
|
|
234
|
+
}
|
|
235
|
+
raw(message, ...arguments_) {
|
|
236
|
+
if (this.disabled) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
this._logger("log", true, {
|
|
240
|
+
context: arguments_,
|
|
241
|
+
message
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
extendReporter(reporter) {
|
|
245
|
+
if (typeof reporter.setLoggerTypes === "function") {
|
|
246
|
+
reporter.setLoggerTypes(this.types);
|
|
247
|
+
}
|
|
248
|
+
if (typeof reporter.setStringify === "function") {
|
|
249
|
+
reporter.setStringify(this.stringify);
|
|
250
|
+
}
|
|
251
|
+
return reporter;
|
|
252
|
+
}
|
|
253
|
+
registerReporters(reporters) {
|
|
254
|
+
for (const reporter of reporters) {
|
|
255
|
+
this.reporters.add(this.extendReporter(reporter));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
_report(meta, raw) {
|
|
259
|
+
if (raw) {
|
|
260
|
+
this.rawReporter.log(Object.freeze(meta));
|
|
261
|
+
} else {
|
|
262
|
+
for (const reporter of this.reporters) {
|
|
263
|
+
reporter.log(Object.freeze(meta));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
registerProcessors(processors) {
|
|
268
|
+
for (const processor of processors) {
|
|
269
|
+
if (typeof processor.setStringify === "function") {
|
|
270
|
+
processor.setStringify(this.stringify);
|
|
271
|
+
}
|
|
272
|
+
this.processors.add(processor);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
276
|
+
_normalizeLogLevel(level) {
|
|
277
|
+
return level && this.logLevels[level] ? level : "debug";
|
|
278
|
+
}
|
|
279
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity,@typescript-eslint/no-explicit-any
|
|
280
|
+
_buildMeta(typeName, type, ...arguments_) {
|
|
281
|
+
const meta = {
|
|
282
|
+
badge: undefined,
|
|
283
|
+
context: undefined,
|
|
284
|
+
error: undefined,
|
|
285
|
+
label: undefined,
|
|
286
|
+
message: EMPTY_SYMBOL,
|
|
287
|
+
prefix: undefined,
|
|
288
|
+
repeated: undefined,
|
|
289
|
+
scope: undefined,
|
|
290
|
+
suffix: undefined
|
|
291
|
+
};
|
|
292
|
+
meta.type = {
|
|
293
|
+
level: type.logLevel,
|
|
294
|
+
name: typeName
|
|
295
|
+
};
|
|
296
|
+
meta.groups = this.groups;
|
|
297
|
+
meta.scope = this.scopeName;
|
|
298
|
+
meta.date = /* @__PURE__ */ new Date();
|
|
299
|
+
if (arguments_.length === 1 && typeof arguments_[0] === "object" && arguments_[0] !== null) {
|
|
300
|
+
if (arguments_[0] instanceof Error) {
|
|
301
|
+
meta.error = arguments_[0];
|
|
302
|
+
} else if ("message" in arguments_[0]) {
|
|
303
|
+
const { context, message, prefix, suffix } = arguments_[0];
|
|
304
|
+
if (context) {
|
|
305
|
+
meta.context = context;
|
|
306
|
+
}
|
|
307
|
+
if (prefix) {
|
|
308
|
+
meta.prefix = prefix;
|
|
309
|
+
}
|
|
310
|
+
if (suffix) {
|
|
311
|
+
meta.suffix = suffix;
|
|
312
|
+
}
|
|
313
|
+
meta.message = message;
|
|
314
|
+
} else {
|
|
315
|
+
meta.message = arguments_[0];
|
|
316
|
+
}
|
|
317
|
+
} else if (arguments_.length > 1 && typeof arguments_[0] === "string") {
|
|
318
|
+
meta.message = arguments_[0];
|
|
319
|
+
meta.context = arguments_.slice(1);
|
|
320
|
+
} else {
|
|
321
|
+
meta.message = arguments_[0];
|
|
322
|
+
}
|
|
323
|
+
if (type.logLevel === "trace") {
|
|
324
|
+
meta.traceError = new Error("Trace");
|
|
325
|
+
}
|
|
326
|
+
if (type.badge) {
|
|
327
|
+
meta.badge = type.badge;
|
|
328
|
+
}
|
|
329
|
+
if (type.label) {
|
|
330
|
+
meta.label = type.label;
|
|
331
|
+
}
|
|
332
|
+
return meta;
|
|
333
|
+
}
|
|
334
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity,@typescript-eslint/no-explicit-any
|
|
335
|
+
_logger(type, raw, ...messageObject) {
|
|
336
|
+
if (this.disabled) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const logLevel = this._normalizeLogLevel(this.types[type].logLevel);
|
|
340
|
+
if (this.logLevels[logLevel] >= this.logLevels[this.generalLogLevel]) {
|
|
341
|
+
let meta = this._buildMeta(type, this.types[type], ...messageObject);
|
|
342
|
+
const resolveLog = /* @__PURE__ */ __name((newLog = false) => {
|
|
343
|
+
const repeated = (this.lastLog.count || 0) - this.throttleMin;
|
|
344
|
+
if (this.lastLog.object && repeated > 0) {
|
|
345
|
+
const lastMeta = { ...this.lastLog.object };
|
|
346
|
+
if (repeated > 1) {
|
|
347
|
+
lastMeta.repeated = repeated;
|
|
348
|
+
}
|
|
349
|
+
this._report(lastMeta, raw);
|
|
350
|
+
this.lastLog.count = 1;
|
|
351
|
+
}
|
|
352
|
+
if (newLog) {
|
|
353
|
+
for (const processor of this.processors) {
|
|
354
|
+
meta = { ...processor.process(meta) };
|
|
355
|
+
}
|
|
356
|
+
this.lastLog.object = meta;
|
|
357
|
+
this._report(meta, raw);
|
|
358
|
+
}
|
|
359
|
+
}, "resolveLog");
|
|
360
|
+
clearTimeout(this.lastLog.timeout);
|
|
361
|
+
const diffTime = this.lastLog.time && meta.date ? new Date(meta.date).getTime() - this.lastLog.time.getTime() : 0;
|
|
362
|
+
this.lastLog.time = new Date(meta.date);
|
|
363
|
+
if (diffTime < this.throttle) {
|
|
364
|
+
try {
|
|
365
|
+
const serializedLog = JSON.stringify([meta.label, meta.scope, meta.type, meta.message, meta.prefix, meta.suffix, meta.context]);
|
|
366
|
+
const isSameLog = this.lastLog.serialized === serializedLog;
|
|
367
|
+
this.lastLog.serialized = serializedLog;
|
|
368
|
+
if (isSameLog) {
|
|
369
|
+
this.lastLog.count = (this.lastLog.count || 0) + 1;
|
|
370
|
+
if (this.lastLog.count > this.throttleMin) {
|
|
371
|
+
this.lastLog.timeout = setTimeout(resolveLog, this.throttle);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
} catch {
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
resolveLog(true);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
const PailBrowser = PailBrowserImpl;
|
|
383
|
+
|
|
384
|
+
export { PailBrowser as P, PailBrowserImpl as a };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const writeConsoleLogBasedOnLevel = /* @__PURE__ */ __name((level) => {
|
|
6
|
+
if (level === "error") {
|
|
7
|
+
return console.__error ?? console.error;
|
|
8
|
+
}
|
|
9
|
+
if (level === "warn") {
|
|
10
|
+
return console.__warn ?? console.warn;
|
|
11
|
+
}
|
|
12
|
+
if (level === "trace") {
|
|
13
|
+
return console.__trace ?? console.trace;
|
|
14
|
+
}
|
|
15
|
+
return console.__log ?? console.log;
|
|
16
|
+
}, "writeConsoleLogBasedOnLevel");
|
|
17
|
+
|
|
18
|
+
exports.writeConsoleLogBasedOnLevel = writeConsoleLogBasedOnLevel;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
const writeConsoleLogBasedOnLevel = /* @__PURE__ */ __name((level) => {
|
|
4
|
+
if (level === "error") {
|
|
5
|
+
return console.__error ?? console.error;
|
|
6
|
+
}
|
|
7
|
+
if (level === "warn") {
|
|
8
|
+
return console.__warn ?? console.warn;
|
|
9
|
+
}
|
|
10
|
+
if (level === "trace") {
|
|
11
|
+
return console.__trace ?? console.trace;
|
|
12
|
+
}
|
|
13
|
+
return console.__log ?? console.log;
|
|
14
|
+
}, "writeConsoleLogBasedOnLevel");
|
|
15
|
+
|
|
16
|
+
export { writeConsoleLogBasedOnLevel as w };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
const writeStream = /* @__PURE__ */ __name((data, stream) => {
|
|
4
|
+
const write = stream.__write ?? stream.write;
|
|
5
|
+
return write.call(stream, data);
|
|
6
|
+
}, "writeStream");
|
|
7
|
+
|
|
8
|
+
export { writeStream as w };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const writeStream = /* @__PURE__ */ __name((data, stream) => {
|
|
6
|
+
const write = stream.__write ?? stream.write;
|
|
7
|
+
return write.call(stream, data);
|
|
8
|
+
}, "writeStream");
|
|
9
|
+
|
|
10
|
+
exports.writeStream = writeStream;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const MessageFormatterProcessor = require('./packem_shared/MessageFormatterProcessor-D_txQ9nO.cjs');
|
|
6
|
+
const RedactProcessor = require('./packem_shared/RedactProcessor-DWE5iqAQ.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.MessageFormatterProcessor = MessageFormatterProcessor;
|
|
11
|
+
exports.RedactProcessor = RedactProcessor;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as MessageFormatterProcessor } from './packem_shared/MessageFormatterProcessor-CFyi7GWt.mjs';
|
|
2
|
+
export { default as RedactProcessor } from './packem_shared/RedactProcessor-CfNkF2lC.mjs';
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const CallerProcessor = require('./packem_shared/CallerProcessor-DYrXv6Fp.cjs');
|
|
6
|
+
const MessageFormatterProcessor = require('./packem_shared/MessageFormatterProcessor-D_txQ9nO.cjs');
|
|
7
|
+
const RedactProcessor = require('./packem_shared/RedactProcessor-DWE5iqAQ.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.CallerProcessor = CallerProcessor;
|
|
12
|
+
exports.MessageFormatterProcessor = MessageFormatterProcessor;
|
|
13
|
+
exports.RedactProcessor = RedactProcessor;
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as CallerProcessor } from './packem_shared/CallerProcessor-CyJFdYGN.mjs';
|
|
2
|
+
export { default as MessageFormatterProcessor } from './packem_shared/MessageFormatterProcessor-CFyi7GWt.mjs';
|
|
3
|
+
export { default as RedactProcessor } from './packem_shared/RedactProcessor-CfNkF2lC.mjs';
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const JsonReporter = require('./packem_shared/JsonReporter-DDubAhfJ.cjs');
|
|
6
|
+
const PrettyReporter = require('./packem_shared/PrettyReporter-mFCjMb0i.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.JsonReporter = JsonReporter;
|
|
11
|
+
exports.PrettyReporter = PrettyReporter;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as JsonReporter } from './packem_shared/JsonReporter-C05lFJhj.mjs';
|
|
2
|
+
export { default as PrettyReporter } from './packem_shared/PrettyReporter-Bx3QLZrW.mjs';
|
package/dist/reporter.server.cjs
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const JsonFileReporter = require('./packem_shared/JsonFileReporter-BHaRQMnS.cjs');
|
|
6
|
+
const JsonReporter = require('./packem_shared/JsonReporter-HXYHZuWz.cjs');
|
|
7
|
+
const PrettyReporter = require('./packem_shared/PrettyReporter-LWDDriJ1.cjs');
|
|
8
|
+
const SimpleReporter = require('./packem_shared/SimpleReporter-DabZGkIs.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.JsonFileReporter = JsonFileReporter.JsonFileReporter;
|
|
13
|
+
exports.JsonReporter = JsonReporter;
|
|
14
|
+
exports.PrettyReporter = PrettyReporter.PrettyReporter;
|
|
15
|
+
exports.SimpleReporter = SimpleReporter.SimpleReporter;
|
package/dist/reporter.server.mjs
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export { JsonFileReporter } from './packem_shared/JsonFileReporter-CdHau53i.mjs';
|
|
2
|
+
export { default as JsonReporter } from './packem_shared/JsonReporter-DCd8dbfQ.mjs';
|
|
3
|
+
export { PrettyReporter } from './packem_shared/PrettyReporter-XC0Ix5SW.mjs';
|
|
4
|
+
export { SimpleReporter } from './packem_shared/SimpleReporter-CuNgsGVB.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/pail",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.18",
|
|
4
4
|
"description": "Highly configurable Logger for Node.js, Edge and Browser.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ansi",
|
|
@@ -225,10 +225,10 @@
|
|
|
225
225
|
"LICENSE.md"
|
|
226
226
|
],
|
|
227
227
|
"dependencies": {
|
|
228
|
-
"@visulima/colorize": "1.4.
|
|
229
|
-
"@visulima/error": "4.4.
|
|
230
|
-
"@visulima/fmt": "1.1.
|
|
231
|
-
"@visulima/inspector": "1.0.
|
|
228
|
+
"@visulima/colorize": "1.4.18",
|
|
229
|
+
"@visulima/error": "4.4.13",
|
|
230
|
+
"@visulima/fmt": "1.1.13",
|
|
231
|
+
"@visulima/inspector": "1.0.18",
|
|
232
232
|
"safe-stable-stringify": "^2.5.0"
|
|
233
233
|
},
|
|
234
234
|
"devDependencies": {
|
|
@@ -242,13 +242,13 @@
|
|
|
242
242
|
"@secretlint/secretlint-rule-preset-recommend": "^9.0.0",
|
|
243
243
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
244
244
|
"@types/node": "18.19.15",
|
|
245
|
-
"@visulima/packem": "1.
|
|
246
|
-
"@visulima/redact": "1.0.
|
|
245
|
+
"@visulima/packem": "1.10.7",
|
|
246
|
+
"@visulima/redact": "1.0.11",
|
|
247
247
|
"@vitest/coverage-v8": "^2.1.8",
|
|
248
248
|
"@vitest/ui": "^2.1.8",
|
|
249
249
|
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
250
250
|
"cross-env": "^7.0.3",
|
|
251
|
-
"esbuild": "0.24.
|
|
251
|
+
"esbuild": "0.24.2",
|
|
252
252
|
"eslint": "8.57.0",
|
|
253
253
|
"eslint-plugin-deprecation": "^3.0.0",
|
|
254
254
|
"eslint-plugin-etc": "^2.0.3",
|
|
@@ -257,19 +257,19 @@
|
|
|
257
257
|
"eslint-plugin-vitest": "^0.4.1",
|
|
258
258
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
259
259
|
"prettier": "^3.4.2",
|
|
260
|
-
"rimraf": "
|
|
260
|
+
"rimraf": "6.0.1",
|
|
261
261
|
"rotating-file-stream": "^3.2.5",
|
|
262
|
-
"secretlint": "
|
|
263
|
-
"semantic-release": "24.
|
|
262
|
+
"secretlint": "9.0.0",
|
|
263
|
+
"semantic-release": "24.2.1",
|
|
264
264
|
"string-length": "^6.0.0",
|
|
265
265
|
"terminal-size": "^4.0.0",
|
|
266
|
-
"type-fest": "^4.
|
|
267
|
-
"typescript": "5.
|
|
266
|
+
"type-fest": "^4.32.0",
|
|
267
|
+
"typescript": "5.7.3",
|
|
268
268
|
"vitest": "^2.1.8",
|
|
269
269
|
"wrap-ansi": "^9.0.0"
|
|
270
270
|
},
|
|
271
271
|
"peerDependencies": {
|
|
272
|
-
"@visulima/redact": "1.0.
|
|
272
|
+
"@visulima/redact": "1.0.11",
|
|
273
273
|
"rotating-file-stream": "^3.1.1"
|
|
274
274
|
},
|
|
275
275
|
"peerDependenciesMeta": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=Object.defineProperty;var n=(a,e)=>t(a,"name",{value:e,configurable:!0});var u=Object.defineProperty,c=n((a,e)=>u(a,"name",{value:e,configurable:!0}),"u");const o=c(()=>{const a=Error.prepareStackTrace;try{let e=[];Error.prepareStackTrace=(i,r)=>{const m=r.slice(1);return e=m,m};const l=e.reduce((i,r)=>(r.isNative()||r.getFileName()?.includes("pail/dist")||i.push({columnNumber:r.getColumnNumber(),fileName:r.getFileName(),lineNumber:r.getLineNumber()}),i),[])[0];return l?{columnNumber:l.columnNumber??void 0,fileName:l.fileName,lineNumber:l.lineNumber??void 0}:{fileName:"anonymous",lineNumber:void 0}}finally{Error.prepareStackTrace=a}},"getCallerFilename");var s=Object.defineProperty,N=n((a,e)=>s(a,"name",{value:e,configurable:!0}),"r");class f{static{n(this,"a")}static{N(this,"CallerProcessor")}process(e){const{columnNumber:l,fileName:i,lineNumber:r}=o();return e.file={column:l,line:r,name:i},e}}export{f as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty;var n=(a,e)=>t(a,"name",{value:e,configurable:!0});var u=Object.defineProperty,c=n((a,e)=>u(a,"name",{value:e,configurable:!0}),"u");const o=c(()=>{const a=Error.prepareStackTrace;try{let e=[];Error.prepareStackTrace=(i,r)=>{const m=r.slice(1);return e=m,m};const l=e.reduce((i,r)=>(r.isNative()||r.getFileName()?.includes("pail/dist")||i.push({columnNumber:r.getColumnNumber(),fileName:r.getFileName(),lineNumber:r.getLineNumber()}),i),[])[0];return l?{columnNumber:l.columnNumber??void 0,fileName:l.fileName,lineNumber:l.lineNumber??void 0}:{fileName:"anonymous",lineNumber:void 0}}finally{Error.prepareStackTrace=a}},"getCallerFilename");var s=Object.defineProperty,N=n((a,e)=>s(a,"name",{value:e,configurable:!0}),"r");class b{static{n(this,"a")}static{N(this,"CallerProcessor")}process(e){const{columnNumber:l,fileName:i,lineNumber:r}=o();return e.file={column:l,line:r,name:i},e}}module.exports=b;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var s=(e,t)=>n(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./abstract-json-reporter-Z6bVrpPK.cjs");var h=Object.defineProperty,c=s((e,t)=>h(e,"name",{value:t,configurable:!0}),"e");class l{static{s(this,"n")}static{c(this,"SafeStreamHandler")}#t=!0;#e;#i;constructor(t,i){this.#e=t,this.#i=i}write(t){this.writeStream(t)}end(...t){this.#e.end(...t)}get isReady(){return this.#t}writeStream(t){if(!this.#t){console.warn("Stream busy: "+this.#i+'. Write will be dropped: "'+t+'"');return}this.#t=!1,this.#e.on("error",i=>{throw i}),this.#e.on("drain",()=>{this.#t=!0}),this.#e.on("finish",()=>{this.#t=!0}),this.#t=this.#e.write(t,()=>{})}}var d=Object.defineProperty,m=s((e,t)=>d(e,"name",{value:t,configurable:!0}),"r$1");class u{static{s(this,"o")}static{m(this,"RotatingFileStream")}#t;#e;#i;#s;#r;constructor(t,i=!1,r={}){if(this.#t=t,this.#e=i,this.#s=r,!this.#e){try{this.#r=require("rotating-file-stream").createStream}catch{throw new Error("The 'rotating-file-stream' package is missing. Make sure to install the 'rotating-file-stream' package.")}this.#i=this.#r(this.#t,r)}}write(t){let i=this.#i;this.#e&&(i=this.#r(this.#t,this.#s));const r=new l(i,this.#t);r.write(t),this.#e&&r.end()}end(){this.#i!==void 0&&this.#i.end()}}var p=Object.defineProperty,w=s((e,t)=>p(e,"name",{value:t,configurable:!0}),"r");class f extends o.A{static{s(this,"JsonFileReporter")}static{w(this,"JsonFileReporter")}stream;constructor(t){super();const{filePath:i,writeImmediately:r=!1,...a}=t;this.stream=new u(i,r,{compress:"gzip",interval:"1d",size:"10M",...a})}_log(t){this.stream.write(t+`
|
|
2
|
-
`)}}exports.JsonFileReporter=f;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var h=Object.defineProperty;var s=(e,t)=>h(e,"name",{value:t,configurable:!0});import{A as n}from"./abstract-json-reporter-29d4dwOH.mjs";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
-
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
-
var o=Object.defineProperty,c=s((e,t)=>o(e,"name",{value:t,configurable:!0}),"e");class l{static{s(this,"n")}static{c(this,"SafeStreamHandler")}#t=!0;#e;#i;constructor(t,i){this.#e=t,this.#i=i}write(t){this.writeStream(t)}end(...t){this.#e.end(...t)}get isReady(){return this.#t}writeStream(t){if(!this.#t){console.warn("Stream busy: "+this.#i+'. Write will be dropped: "'+t+'"');return}this.#t=!1,this.#e.on("error",i=>{throw i}),this.#e.on("drain",()=>{this.#t=!0}),this.#e.on("finish",()=>{this.#t=!0}),this.#t=this.#e.write(t,()=>{})}}var m=Object.defineProperty,d=s((e,t)=>m(e,"name",{value:t,configurable:!0}),"r$1");class p{static{s(this,"o")}static{d(this,"RotatingFileStream")}#t;#e;#i;#s;#r;constructor(t,i=!1,r={}){if(this.#t=t,this.#e=i,this.#s=r,!this.#e){try{this.#r=require("rotating-file-stream").createStream}catch{throw new Error("The 'rotating-file-stream' package is missing. Make sure to install the 'rotating-file-stream' package.")}this.#i=this.#r(this.#t,r)}}write(t){let i=this.#i;this.#e&&(i=this.#r(this.#t,this.#s));const r=new l(i,this.#t);r.write(t),this.#e&&r.end()}end(){this.#i!==void 0&&this.#i.end()}}var u=Object.defineProperty,w=s((e,t)=>u(e,"name",{value:t,configurable:!0}),"r");class v extends n{static{s(this,"JsonFileReporter")}static{w(this,"JsonFileReporter")}stream;constructor(t){super();const{filePath:i,writeImmediately:r=!1,...a}=t;this.stream=new p(i,r,{compress:"gzip",interval:"1d",size:"10M",...a})}_log(t){this.stream.write(t+`
|
|
4
|
-
`)}}export{v as JsonFileReporter};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var e=(r,t)=>n(r,"name",{value:t,configurable:!0});const s=require("node:process"),a=require("./write-stream-Bgxqp0HI.cjs"),c=require("./abstract-json-reporter-Z6bVrpPK.cjs");var u=Object.defineProperty,d=e((r,t)=>u(r,"name",{value:t,configurable:!0}),"e");class h extends c.A{static{e(this,"d")}static{d(this,"JsonReporter")}#t;#r;constructor(t={}){super(t),this.#t=s.stdout,this.#r=s.stderr}setStdout(t){this.#t=t}setStderr(t){this.#r=t}_log(t,i){const o=["error","warn"].includes(i)?this.#r:this.#t;a.n(t+`
|
|
2
|
-
`,o)}}module.exports=h;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var t=(r,e)=>o(r,"name",{value:e,configurable:!0});const a=require("./write-console-log-3G15muTS.cjs"),c=require("./abstract-json-reporter-Z6bVrpPK.cjs");var n=Object.defineProperty,i=t((r,e)=>n(r,"name",{value:e,configurable:!0}),"e");class u extends c.A{static{t(this,"p")}static{i(this,"JsonReporter")}constructor(e={}){super(e)}_log(e,s){a.t(s)(e)}}module.exports=u;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s=Object.defineProperty;var t=(e,r)=>s(e,"name",{value:r,configurable:!0});import{t as a}from"./write-console-log-BP95fgQZ.mjs";import{A as p}from"./abstract-json-reporter-29d4dwOH.mjs";var c=Object.defineProperty,n=t((e,r)=>c(e,"name",{value:r,configurable:!0}),"e");class m extends p{static{t(this,"p")}static{n(this,"JsonReporter")}constructor(r={}){super(r)}_log(r,o){a(o)(r)}}export{m as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var s=(r,t)=>i(r,"name",{value:t,configurable:!0});import{stdout as a,stderr as n}from"node:process";import{n as c}from"./write-stream-C17GXSxA.mjs";import{A as d}from"./abstract-json-reporter-29d4dwOH.mjs";var p=Object.defineProperty,u=s((r,t)=>p(r,"name",{value:t,configurable:!0}),"e");class b extends d{static{s(this,"d")}static{u(this,"JsonReporter")}#t;#r;constructor(t={}){super(t),this.#t=a,this.#r=n}setStdout(t){this.#t=t}setStderr(t){this.#r=t}_log(t,e){const o=["error","warn"].includes(e)?this.#r:this.#t;c(t+`
|
|
2
|
-
`,o)}}export{b as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var n=(o,t)=>a(o,"name",{value:t,configurable:!0});const c=require("@visulima/fmt");var u=Object.defineProperty,f=n((o,t)=>u(o,"name",{value:t,configurable:!0}),"o");class y{static{n(this,"p")}static{f(this,"MessageFormatterProcessor")}#t;#e;constructor(t={}){this.#e=t.formatters}setStringify(t){this.#t=t}process(t){const e=c.build({formatters:this.#e,stringify:f(s=>{const r=this.#t(s);return r===void 0?(console.warn("Unable to stringify value of type "+typeof s,s),"undefined"):r},"stringify")});return t.message!==void 0&&(t.message=this._format(e,t.message,t.context??[])),t}_format(t,e,s=[]){if(typeof e=="string")return t(e,s);if(typeof e=="object"&&e!==null)for(const r in e){const i=e[r];(typeof i=="string"||Array.isArray(i)||typeof i=="object")&&(e[r]=this._format(t,i,s))}return e}}module.exports=y;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=Object.defineProperty;var a=(o,t)=>n(o,"name",{value:t,configurable:!0});import{build as c}from"@visulima/fmt";var y=Object.defineProperty,f=a((o,t)=>y(o,"name",{value:t,configurable:!0}),"o");class g{static{a(this,"p")}static{f(this,"MessageFormatterProcessor")}#t;#e;constructor(t={}){this.#e=t.formatters}setStringify(t){this.#t=t}process(t){const e=c({formatters:this.#e,stringify:f(s=>{const r=this.#t(s);return r===void 0?(console.warn("Unable to stringify value of type "+typeof s,s),"undefined"):r},"stringify")});return t.message!==void 0&&(t.message=this._format(e,t.message,t.context??[])),t}_format(t,e,s=[]){if(typeof e=="string")return t(e,s);if(typeof e=="object"&&e!==null)for(const r in e){const i=e[r];(typeof i=="string"||Array.isArray(i)||typeof i=="object")&&(e[r]=this._format(t,i,s))}return e}}export{g as default};
|