@visulima/pail 2.1.26 → 2.1.28
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 +22 -0
- package/dist/index.browser.cjs +1 -19
- package/dist/index.browser.mjs +1 -14
- package/dist/index.server.cjs +5 -442
- package/dist/index.server.mjs +5 -437
- package/dist/packem_shared/CallerProcessor-DJnmMPMj.cjs +1 -0
- package/dist/packem_shared/CallerProcessor-mNkBei3j.mjs +1 -0
- package/dist/packem_shared/JsonFileReporter-BnxuhH4o.cjs +2 -0
- package/dist/packem_shared/JsonFileReporter-Og8hyKfg.mjs +4 -0
- package/dist/packem_shared/JsonReporter-BdExg5gk.mjs +1 -0
- package/dist/packem_shared/JsonReporter-CjvkrXUp.cjs +1 -0
- package/dist/packem_shared/JsonReporter-DRGJgjAO.mjs +2 -0
- package/dist/packem_shared/JsonReporter-DuF0Ho5i.cjs +2 -0
- package/dist/packem_shared/MessageFormatterProcessor-BjBZzL2D.mjs +1 -0
- package/dist/packem_shared/MessageFormatterProcessor-CCRIUIdT.cjs +1 -0
- package/dist/packem_shared/PrettyReporter-BRFlkORc.mjs +5 -0
- package/dist/packem_shared/PrettyReporter-BuKPqA5T.cjs +5 -0
- package/dist/packem_shared/PrettyReporter-DDsX0vlT.mjs +13 -0
- package/dist/packem_shared/PrettyReporter-Dx1OfdGj.cjs +13 -0
- package/dist/packem_shared/RedactProcessor-BBJysXaX.cjs +1 -0
- package/dist/packem_shared/RedactProcessor-CxKTN42V.mjs +3 -0
- package/dist/packem_shared/SimpleReporter-BV0taliz.mjs +11 -0
- package/dist/packem_shared/SimpleReporter-YuzZZabX.cjs +11 -0
- package/dist/packem_shared/abstract-json-reporter-Z6bVrpPK.cjs +1 -0
- package/dist/packem_shared/abstract-json-reporter-tFmKAzRZ.mjs +1 -0
- package/dist/packem_shared/abstract-pretty-reporter-C2vDqWAQ.cjs +1 -0
- package/dist/packem_shared/abstract-pretty-reporter-CRcf4WZd.mjs +1 -0
- package/dist/packem_shared/constants-BFrKdBPm.cjs +1 -0
- package/dist/packem_shared/constants-BMS51p6Y.mjs +1 -0
- package/dist/packem_shared/format-label-CKRxcWAQ.cjs +8 -0
- package/dist/packem_shared/format-label-D2xt_3df.mjs +8 -0
- package/dist/packem_shared/get-longest-label-7LkwzzHo.cjs +1 -0
- package/dist/packem_shared/get-longest-label-B0NrI-o2.mjs +1 -0
- package/dist/packem_shared/pail.browser-DC6QwLTj.cjs +1 -0
- package/dist/packem_shared/pail.browser-DkNIDzgk.mjs +1 -0
- package/dist/packem_shared/write-console-log-3G15muTS.cjs +1 -0
- package/dist/packem_shared/write-console-log-BP95fgQZ.mjs +1 -0
- package/dist/packem_shared/write-stream-CD8XFv1L.mjs +1 -0
- package/dist/packem_shared/write-stream-Dl-usQqh.cjs +1 -0
- package/dist/processor.browser.cjs +1 -11
- package/dist/processor.browser.mjs +1 -2
- package/dist/processor.server.cjs +1 -13
- package/dist/processor.server.mjs +1 -3
- package/dist/reporter.browser.cjs +1 -11
- package/dist/reporter.browser.mjs +1 -2
- package/dist/reporter.server.cjs +1 -15
- package/dist/reporter.server.mjs +1 -4
- package/package.json +2 -2
- package/dist/packem_shared/CallerProcessor-CNhuyGAa.mjs +0 -58
- package/dist/packem_shared/CallerProcessor-DJ5euiUK.cjs +0 -60
- package/dist/packem_shared/JsonFileReporter-BazAMbEI.mjs +0 -133
- package/dist/packem_shared/JsonFileReporter-PNmBNTr1.cjs +0 -135
- package/dist/packem_shared/JsonReporter-CKWF4Ibl.mjs +0 -20
- package/dist/packem_shared/JsonReporter-CcOVaf3A.cjs +0 -34
- package/dist/packem_shared/JsonReporter-Cg5R1FXn.cjs +0 -22
- package/dist/packem_shared/JsonReporter-DFFyVZyh.mjs +0 -32
- package/dist/packem_shared/MessageFormatterProcessor-Cd4HntPG.mjs +0 -53
- package/dist/packem_shared/MessageFormatterProcessor-t4t6CpzV.cjs +0 -55
- package/dist/packem_shared/PrettyReporter-3oMWkX6j.cjs +0 -200
- package/dist/packem_shared/PrettyReporter-Bx3QLZrW.mjs +0 -162
- package/dist/packem_shared/PrettyReporter-C2hjNe-y.mjs +0 -192
- package/dist/packem_shared/PrettyReporter-mFCjMb0i.cjs +0 -168
- package/dist/packem_shared/RedactProcessor-CfNkF2lC.mjs +0 -26
- package/dist/packem_shared/RedactProcessor-DWE5iqAQ.cjs +0 -26
- package/dist/packem_shared/SimpleReporter-CXXqr1h3.cjs +0 -186
- package/dist/packem_shared/SimpleReporter-TOcMSqJb.mjs +0 -178
- package/dist/packem_shared/abstract-json-reporter-okwLqT9k.cjs +0 -57
- package/dist/packem_shared/abstract-json-reporter-sxnmNIlg.mjs +0 -55
- package/dist/packem_shared/abstract-pretty-reporter-BR_6_JVa.cjs +0 -49
- package/dist/packem_shared/abstract-pretty-reporter-izJgxoMv.mjs +0 -46
- package/dist/packem_shared/constants-BYYZ5WNW.mjs +0 -114
- package/dist/packem_shared/constants-DHfYGxxG.cjs +0 -118
- package/dist/packem_shared/format-label-DYEhjrTZ.cjs +0 -621
- package/dist/packem_shared/format-label-Uj-cxY3j.mjs +0 -609
- package/dist/packem_shared/get-longest-label-CM8kLFWH.mjs +0 -11
- package/dist/packem_shared/get-longest-label-CQ7lRhgD.cjs +0 -13
- package/dist/packem_shared/pail.browser-Bp1fz428.mjs +0 -384
- package/dist/packem_shared/pail.browser-O53Q_cus.cjs +0 -387
- package/dist/packem_shared/write-console-log-Cu0-IDN-.cjs +0 -18
- package/dist/packem_shared/write-console-log-Tptfzg9D.mjs +0 -16
- package/dist/packem_shared/write-stream-BBAF33Zm.mjs +0 -8
- package/dist/packem_shared/write-stream-CkNf2Ju8.cjs +0 -10
|
@@ -1,384 +0,0 @@
|
|
|
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 === void 0) {
|
|
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: void 0,
|
|
283
|
-
context: void 0,
|
|
284
|
-
error: void 0,
|
|
285
|
-
label: void 0,
|
|
286
|
-
message: EMPTY_SYMBOL,
|
|
287
|
-
prefix: void 0,
|
|
288
|
-
repeated: void 0,
|
|
289
|
-
scope: void 0,
|
|
290
|
-
suffix: void 0
|
|
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 };
|