@visulima/pail 3.2.2 → 4.0.0-alpha.10

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/LICENSE.md +434 -6
  3. package/README.md +355 -24
  4. package/dist/error.d.ts +104 -0
  5. package/dist/error.js +76 -0
  6. package/dist/index.browser.d.ts +3 -1
  7. package/dist/index.browser.js +1490 -3
  8. package/dist/index.server.d.ts +3 -1
  9. package/dist/index.server.js +2668 -14
  10. package/dist/interactive/index.js +2 -2
  11. package/dist/middleware/elysia.d.ts +71 -0
  12. package/dist/middleware/elysia.js +70 -0
  13. package/dist/middleware/express.d.ts +86 -0
  14. package/dist/middleware/express.js +29 -0
  15. package/dist/middleware/fastify.d.ts +81 -0
  16. package/dist/middleware/fastify.js +46 -0
  17. package/dist/middleware/hono.d.ts +85 -0
  18. package/dist/middleware/hono.js +33 -0
  19. package/dist/middleware/next/handler.d.ts +36 -0
  20. package/dist/middleware/next/handler.js +53 -0
  21. package/dist/middleware/next/middleware.d.ts +59 -0
  22. package/dist/middleware/next/storage.d.ts +14 -0
  23. package/dist/middleware/shared/create-middleware-logger.d.ts +82 -0
  24. package/dist/middleware/shared/headers.d.ts +14 -0
  25. package/dist/middleware/shared/routes.d.ts +30 -0
  26. package/dist/middleware/shared/storage.d.ts +29 -0
  27. package/dist/middleware/sveltekit.d.ts +123 -0
  28. package/dist/middleware/sveltekit.js +43 -0
  29. package/dist/object-tree.d.ts +2 -2
  30. package/dist/object-tree.js +7 -7
  31. package/dist/packem_shared/{AbstractJsonReporter-intFdT_A.js → AbstractJsonReporter-CjtVgHbU.js} +112 -28
  32. package/dist/packem_shared/AbstractJsonReporter-DlugSJpY.js +288 -0
  33. package/dist/packem_shared/{InteractiveManager-CZ85hGNW.js → InteractiveManager-CowYA3Hx.js} +17 -11
  34. package/dist/packem_shared/{interactive-stream-hook-DG4BtN12.js → InteractiveStreamHook-BypRlYTX.js} +3 -11
  35. package/dist/packem_shared/{JsonReporter-C0AXk99i.js → JsonReporter-BgPvIyC2.js} +2 -2
  36. package/dist/packem_shared/{JsonReporter-DcM2LBX9.js → JsonReporter-Dbw82ewj.js} +2 -2
  37. package/dist/packem_shared/{PrettyReporter-CuLLKr6-.js → PrettyReporter-C2dCzIaf.js} +54 -8
  38. package/dist/packem_shared/{format-label-Btft2KGP.js → PrettyReporter-gMqa7j_m.js} +372 -78
  39. package/dist/packem_shared/Spinner-Cokext9b.js +2183 -0
  40. package/dist/packem_shared/abstract-pretty-reporter-szQO-IgK.js +2635 -0
  41. package/dist/packem_shared/constants-B1RjD_ps.js +99 -0
  42. package/dist/packem_shared/{constants-DfDr4MHC.js → constants-omsTHUWB.js} +1 -1
  43. package/dist/packem_shared/createPailError-B_sgL0nF.js +76 -0
  44. package/dist/packem_shared/getBarChar-D7JfmdTr.js +459 -0
  45. package/dist/packem_shared/headers-BxHWM6KI.js +127 -0
  46. package/dist/packem_shared/{index-DqKWykfa.js → index-BEfVUy9P.js} +174 -64
  47. package/dist/packem_shared/{index-BomQ3E6J.js → index-Bx3-C0j9.js} +29 -21
  48. package/dist/packem_shared/pailMiddleware-Ci88geIF.js +24 -0
  49. package/dist/packem_shared/storage-D0vqz8OX.js +36 -0
  50. package/dist/packem_shared/{InteractiveStreamHook-DiSubbJ1.js → useLogger-D0rU3lcX.js} +13 -1
  51. package/dist/packem_shared/{write-console-log-based-on-level-DBmRYXpj.js → write-console-log-based-on-level-ree2lDPw.js} +5 -4
  52. package/dist/packem_shared/{write-stream-BG8fhcs3.js → write-stream-BuFtjATz.js} +1 -1
  53. package/dist/pail.browser.d.ts +1 -1
  54. package/dist/processor/environment-processor.d.ts +124 -0
  55. package/dist/processor/environment-processor.js +82 -0
  56. package/dist/processor/message-formatter-processor.d.ts +2 -2
  57. package/dist/processor/message-formatter-processor.js +654 -6
  58. package/dist/processor/opentelemetry-processor.js +4 -4
  59. package/dist/processor/redact-processor.d.ts +1 -1
  60. package/dist/processor/redact-processor.js +2 -1
  61. package/dist/processor/sampling-processor.d.ts +111 -0
  62. package/dist/processor/sampling-processor.js +59 -0
  63. package/dist/progress-bar.d.ts +10 -1
  64. package/dist/progress-bar.js +75 -20
  65. package/dist/reporter/file/json-file-reporter.js +1 -1
  66. package/dist/reporter/http/abstract-http-reporter.js +23 -26
  67. package/dist/reporter/http/http-reporter.edge-light.js +134 -53
  68. package/dist/reporter/json/abstract-json-reporter.d.ts +1 -1
  69. package/dist/reporter/json/index.browser.js +2 -2
  70. package/dist/reporter/json/index.js +2 -2
  71. package/dist/reporter/pretty/index.browser.js +1 -1
  72. package/dist/reporter/pretty/index.js +1 -1
  73. package/dist/reporter/simple/simple-reporter.server.js +8 -12
  74. package/dist/spinner.js +37 -4
  75. package/dist/types.d.ts +4 -4
  76. package/dist/wide-event.d.ts +300 -0
  77. package/dist/wide-event.js +283 -0
  78. package/package.json +73 -8
  79. package/dist/packem_shared/PrettyReporter-BFWaYP_J.js +0 -222
  80. package/dist/packem_shared/abstract-pretty-reporter-DMPDCslJ.js +0 -50
  81. package/dist/packem_shared/get-longest-label-C9PWeyKq.js +0 -9
  82. package/dist/packem_shared/pail.browser-CPjQrsyy.js +0 -1427
@@ -0,0 +1,288 @@
1
+ import { E as EMPTY_SYMBOL } from './constants-omsTHUWB.js';
2
+
3
+ function isPlainObject(value) {
4
+ if (typeof value !== "object" || value === null) {
5
+ return false;
6
+ }
7
+ const prototype = Object.getPrototypeOf(value);
8
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
9
+ }
10
+
11
+ const ErrorProto = Object.create(
12
+ {},
13
+ {
14
+ cause: {
15
+ enumerable: false,
16
+ value: void 0,
17
+ writable: true
18
+ },
19
+ code: {
20
+ enumerable: true,
21
+ value: void 0,
22
+ writable: true
23
+ },
24
+ errors: {
25
+ enumerable: false,
26
+ value: void 0,
27
+ writable: true
28
+ },
29
+ message: {
30
+ enumerable: false,
31
+ value: void 0,
32
+ writable: true
33
+ },
34
+ name: {
35
+ enumerable: false,
36
+ value: void 0,
37
+ writable: true
38
+ },
39
+ stack: {
40
+ enumerable: false,
41
+ value: void 0,
42
+ writable: true
43
+ }
44
+ }
45
+ );
46
+ const toJsonWasCalled = /* @__PURE__ */ new WeakSet();
47
+ const makePropertiesEnumerable = (object) => {
48
+ const props = Object.getOwnPropertyNames(object);
49
+ for (const prop of props) {
50
+ const descriptor = Object.getOwnPropertyDescriptor(object, prop);
51
+ if (descriptor) {
52
+ if (!descriptor.enumerable) {
53
+ Object.defineProperty(object, prop, {
54
+ ...descriptor,
55
+ enumerable: true
56
+ });
57
+ }
58
+ if (descriptor.value && typeof descriptor.value === "object" && !Array.isArray(descriptor.value) && (Object.getPrototypeOf(descriptor.value) === Object.prototype || Object.getPrototypeOf(descriptor.value) === null)) {
59
+ makePropertiesEnumerable(descriptor.value);
60
+ }
61
+ }
62
+ }
63
+ };
64
+ const toJSON = (from) => {
65
+ toJsonWasCalled.add(from);
66
+ const json = from.toJSON();
67
+ toJsonWasCalled.delete(from);
68
+ if (
69
+ // Only make properties enumerable if the object is extensible
70
+ // Non-extensible objects (like when toJSON returns 'this') should preserve original enumerability
71
+ Object.isExtensible(json)
72
+ ) {
73
+ makePropertiesEnumerable(json);
74
+ }
75
+ return json;
76
+ };
77
+ const serializeValue = (value, seen, depth, options) => {
78
+ if (value && value instanceof Uint8Array && value.constructor.name === "Buffer") {
79
+ return "[object Buffer]";
80
+ }
81
+ if (value !== null && typeof value === "object" && "pipe" in value && typeof value.pipe === "function") {
82
+ return "[object Stream]";
83
+ }
84
+ if (value instanceof Error) {
85
+ if (seen.has(value)) {
86
+ return "[Circular]";
87
+ }
88
+ depth += 1;
89
+ return _serialize(value, options, seen, depth);
90
+ }
91
+ if (options.useToJSON && value !== null && typeof value === "object" && "toJSON" in value && typeof value.toJSON === "function") {
92
+ return value.toJSON();
93
+ }
94
+ if (value instanceof Date) {
95
+ return value.toISOString();
96
+ }
97
+ if (typeof value === "function") {
98
+ return `[Function: ${value.name || "anonymous"}]`;
99
+ }
100
+ if (typeof value === "bigint") {
101
+ return `${String(value)}n`;
102
+ }
103
+ if (isPlainObject(value)) {
104
+ if (options.maxDepth !== void 0 && options.maxDepth !== Number.POSITIVE_INFINITY && depth + 1 >= options.maxDepth) {
105
+ return {};
106
+ }
107
+ depth += 1;
108
+ const plainObject = {};
109
+ for (const key in value) {
110
+ plainObject[key] = serializeValue(value[key], seen, depth, options);
111
+ }
112
+ return plainObject;
113
+ }
114
+ try {
115
+ return value;
116
+ } catch {
117
+ return "[Not Available]";
118
+ }
119
+ };
120
+ const _serialize = (error, options, seen, depth) => {
121
+ seen.add(error);
122
+ if (options.maxDepth === 0) {
123
+ return {};
124
+ }
125
+ if (options.useToJSON && typeof error.toJSON === "function" && !toJsonWasCalled.has(error)) {
126
+ return toJSON(error);
127
+ }
128
+ const protoError = Object.create(ErrorProto);
129
+ Object.defineProperty(protoError, "name", {
130
+ configurable: true,
131
+ enumerable: true,
132
+ value: Object.prototype.toString.call(error.constructor) === "[object Function]" ? error.constructor.name : error.name,
133
+ writable: true
134
+ });
135
+ Object.defineProperty(protoError, "message", {
136
+ configurable: true,
137
+ enumerable: true,
138
+ value: error.message,
139
+ writable: true
140
+ });
141
+ Object.defineProperty(protoError, "stack", {
142
+ configurable: true,
143
+ enumerable: true,
144
+ value: error.stack,
145
+ writable: true
146
+ });
147
+ if (Array.isArray(error.errors)) {
148
+ const aggregateErrors = [];
149
+ for (const aggregateError of error.errors) {
150
+ if (!(aggregateError instanceof Error)) {
151
+ throw new TypeError("All errors in the 'errors' property must be instances of Error");
152
+ }
153
+ if (seen.has(aggregateError)) {
154
+ Object.defineProperty(protoError, "errors", {
155
+ configurable: true,
156
+ enumerable: true,
157
+ value: [],
158
+ writable: true
159
+ });
160
+ return protoError;
161
+ }
162
+ aggregateErrors.push(_serialize(aggregateError, options, seen, depth));
163
+ }
164
+ Object.defineProperty(protoError, "errors", {
165
+ configurable: true,
166
+ enumerable: true,
167
+ value: aggregateErrors,
168
+ writable: true
169
+ });
170
+ }
171
+ const causeValue = error.cause;
172
+ if (causeValue !== void 0 && causeValue !== null) {
173
+ if (causeValue instanceof Error) {
174
+ if (seen.has(causeValue)) {
175
+ Object.defineProperty(protoError, "cause", {
176
+ configurable: true,
177
+ enumerable: true,
178
+ value: "[Circular]",
179
+ writable: true
180
+ });
181
+ } else {
182
+ Object.defineProperty(protoError, "cause", {
183
+ configurable: true,
184
+ enumerable: true,
185
+ value: _serialize(causeValue, options, seen, depth),
186
+ writable: true
187
+ });
188
+ }
189
+ } else {
190
+ const serializedCause = serializeValue(causeValue, seen, depth, options);
191
+ Object.defineProperty(protoError, "cause", {
192
+ configurable: true,
193
+ enumerable: true,
194
+ value: serializedCause,
195
+ writable: true
196
+ });
197
+ }
198
+ }
199
+ for (const key in error) {
200
+ if (key === "name" || key === "message" || key === "stack" || key === "cause" || key === "errors") {
201
+ continue;
202
+ }
203
+ const value = error[key];
204
+ const serializedValue = serializeValue(value, seen, depth, options);
205
+ Object.defineProperty(protoError, key, {
206
+ configurable: true,
207
+ enumerable: true,
208
+ value: serializedValue,
209
+ writable: true
210
+ });
211
+ }
212
+ if (Array.isArray(options.exclude) && options.exclude.length > 0) {
213
+ for (const key of options.exclude) {
214
+ try {
215
+ delete protoError[key];
216
+ } catch {
217
+ }
218
+ }
219
+ }
220
+ return protoError;
221
+ };
222
+ const serialize = (error, options = {}) => _serialize(
223
+ error,
224
+ {
225
+ exclude: options.exclude ?? [],
226
+ maxDepth: options.maxDepth ?? Number.POSITIVE_INFINITY,
227
+ useToJSON: options.useToJSON ?? false
228
+ },
229
+ /* @__PURE__ */ new Set(),
230
+ 0
231
+ );
232
+
233
+ class AbstractJsonReporter {
234
+ /** Custom stringify function for object serialization */
235
+ stringify;
236
+ /** Error serialization options */
237
+ errorOptions;
238
+ /**
239
+ * Creates a new AbstractJsonReporter instance.
240
+ * @param options Configuration options for JSON formatting and error handling
241
+ */
242
+ constructor(options = {}) {
243
+ this.errorOptions = options.error ?? {};
244
+ }
245
+ /**
246
+ * Sets a custom stringify function for object serialization.
247
+ * @param function_ The stringify function to use for serialization
248
+ */
249
+ setStringify(function_) {
250
+ this.stringify = function_;
251
+ }
252
+ // eslint-disable-next-line sonarjs/cognitive-complexity
253
+ log(meta) {
254
+ const { context, error, file, message, type, ...rest } = meta;
255
+ if (rest.label) {
256
+ rest.label = rest.label.trim();
257
+ }
258
+ if (file) {
259
+ rest.file = `${file.name ?? ""}:${String(file.line)}${file.column ? `:${String(file.column)}` : ""}`;
260
+ }
261
+ if (message === EMPTY_SYMBOL) {
262
+ rest.message = void 0;
263
+ } else {
264
+ rest.message = message;
265
+ }
266
+ if (error) {
267
+ rest.error = serialize(error, this.errorOptions);
268
+ }
269
+ if (context) {
270
+ const newContext = [];
271
+ for (let i = 0; i < context.length; i += 1) {
272
+ const item = context[i];
273
+ if (item === EMPTY_SYMBOL) {
274
+ continue;
275
+ }
276
+ if (item instanceof Error) {
277
+ newContext.push(serialize(item, this.errorOptions));
278
+ } else {
279
+ newContext.push(item);
280
+ }
281
+ }
282
+ rest.context = newContext;
283
+ }
284
+ this._log(this.stringify(rest), type.level);
285
+ }
286
+ }
287
+
288
+ export { AbstractJsonReporter };
@@ -1,4 +1,4 @@
1
- import { t as terminalSize, w as wordWrap, W as WrapMode } from './index-DqKWykfa.js';
1
+ import { t as terminalSize, w as wordWrap, W as WrapMode } from './index-BEfVUy9P.js';
2
2
 
3
3
  class InteractiveManager {
4
4
  #stream;
@@ -64,9 +64,6 @@ class InteractiveManager {
64
64
  * @throws {TypeError} If the specified stream is not available
65
65
  */
66
66
  erase(stream, count = this.#lastLength) {
67
- if (this.#stream[stream] === void 0) {
68
- throw new TypeError(`Stream "${stream}" is not available`);
69
- }
70
67
  this.#stream[stream].erase(count);
71
68
  }
72
69
  /**
@@ -75,7 +72,10 @@ class InteractiveManager {
75
72
  */
76
73
  hook() {
77
74
  if (!this.#isActive) {
78
- Object.values(this.#stream).forEach((hook) => hook.active());
75
+ const hooks = Object.values(this.#stream);
76
+ for (let i = 0; i < hooks.length; i += 1) {
77
+ hooks[i].active();
78
+ }
79
79
  this.#clear(true);
80
80
  }
81
81
  return this.#isActive;
@@ -92,7 +92,10 @@ class InteractiveManager {
92
92
  this.erase(stream, eraseRowCount);
93
93
  }
94
94
  this.#lastLength = 0;
95
- Object.values(this.#stream).forEach((hook) => hook.active());
95
+ const hooks = Object.values(this.#stream);
96
+ for (let i = 0; i < hooks.length; i += 1) {
97
+ hooks[i].active();
98
+ }
96
99
  }
97
100
  }
98
101
  /**
@@ -106,7 +109,10 @@ class InteractiveManager {
106
109
  if (erase) {
107
110
  this.erase(stream);
108
111
  }
109
- Object.values(this.#stream).forEach((hook) => hook.renew());
112
+ const hooks = Object.values(this.#stream);
113
+ for (let i = 0; i < hooks.length; i += 1) {
114
+ hooks[i].renew();
115
+ }
110
116
  }
111
117
  }
112
118
  /**
@@ -116,7 +122,10 @@ class InteractiveManager {
116
122
  */
117
123
  unhook(separateHistory = true) {
118
124
  if (this.#isActive) {
119
- Object.values(this.#stream).forEach((hook) => hook.inactive(separateHistory));
125
+ const hooks = Object.values(this.#stream);
126
+ for (let i = 0; i < hooks.length; i += 1) {
127
+ hooks[i].inactive(separateHistory);
128
+ }
120
129
  this.#clear();
121
130
  }
122
131
  return !this.#isActive;
@@ -129,9 +138,6 @@ class InteractiveManager {
129
138
  */
130
139
  update(stream, rows, from = 0) {
131
140
  if (rows.length > 0) {
132
- if (this.#stream[stream] === void 0) {
133
- throw new TypeError(`Stream "${stream}" is not available`);
134
- }
135
141
  const hook = this.#stream[stream];
136
142
  const { columns: width, rows: height } = terminalSize();
137
143
  const position = from > height ? height - 1 : Math.max(0, Math.min(height - 1, from));
@@ -22,17 +22,9 @@ const {
22
22
  } = __cjs_getBuiltinModule("node:string_decoder");
23
23
 
24
24
  const ESC = "\x1B[";
25
- const eraseScreen = `${ESC}2J`;
26
25
  const eraseLine = `${ESC}2K`;
27
26
  const cursorLeft = `${ESC}G`;
28
- const cursorUp = (count = 1) => `${ESC + count}A`;
29
- const clearTerminal = process.platform === "win32" ? `${eraseScreen}${ESC}0f` : (
30
- // 1. Erases the screen (Only done in case `2` is not supported)
31
- // 2. Erases the whole screen including scrollback buffer
32
- // 3. Moves cursor to the top-left position
33
- // More info: https://www.real-world-systems.com/docs/ANSIcode.html
34
- `${eraseScreen}${ESC}3J${ESC}H`
35
- );
27
+ const cursorUp = (count = 1) => `${ESC}${String(count)}A`;
36
28
  const cursorHide = `${ESC}?25l`;
37
29
  const cursorShow = `${ESC}?25h`;
38
30
  const eraseLines = (count) => {
@@ -58,7 +50,7 @@ class InteractiveStreamHook {
58
50
  * @param stream The Node.js WriteStream to hook into (usually stdout or stderr)
59
51
  */
60
52
  constructor(stream) {
61
- this.#method = stream.write;
53
+ this.#method = stream.write.bind(stream);
62
54
  this.#stream = stream;
63
55
  }
64
56
  /**
@@ -138,4 +130,4 @@ class InteractiveStreamHook {
138
130
  }
139
131
  }
140
132
 
141
- export { InteractiveStreamHook as I, clearTerminal as c };
133
+ export { InteractiveStreamHook as default };
@@ -8,8 +8,8 @@ const {
8
8
  stdout,
9
9
  stderr
10
10
  } = __cjs_getProcess;
11
- import { w as writeStream } from './write-stream-BG8fhcs3.js';
12
- import { AbstractJsonReporter } from './AbstractJsonReporter-intFdT_A.js';
11
+ import { w as writeStream } from './write-stream-BuFtjATz.js';
12
+ import { AbstractJsonReporter } from './AbstractJsonReporter-CjtVgHbU.js';
13
13
 
14
14
  class JsonReporter extends AbstractJsonReporter {
15
15
  /** Standard output stream */
@@ -1,5 +1,5 @@
1
- import { AbstractJsonReporter } from './AbstractJsonReporter-intFdT_A.js';
2
- import { w as writeConsoleLogBasedOnLevel } from './write-console-log-based-on-level-DBmRYXpj.js';
1
+ import { AbstractJsonReporter } from './AbstractJsonReporter-DlugSJpY.js';
2
+ import { w as writeConsoleLogBasedOnLevel } from './write-console-log-based-on-level-ree2lDPw.js';
3
3
 
4
4
  class JsonReporter extends AbstractJsonReporter {
5
5
  /**
@@ -1,9 +1,54 @@
1
1
  import colorize, { grey, white, underline, bold } from '@visulima/colorize/browser';
2
- import { f as format } from './index-BomQ3E6J.js';
3
- import { E as EMPTY_SYMBOL } from './constants-DfDr4MHC.js';
4
- import { A as AbstractPrettyReporter, g as getLongestBadge } from './abstract-pretty-reporter-DMPDCslJ.js';
5
- import { g as getLongestLabel } from './get-longest-label-C9PWeyKq.js';
6
- import { w as writeConsoleLogBasedOnLevel } from './write-console-log-based-on-level-DBmRYXpj.js';
2
+ import { f as format, g as getLongestLabel } from './index-Bx3-C0j9.js';
3
+ import { L as LOG_TYPES, E as EMPTY_SYMBOL } from './constants-omsTHUWB.js';
4
+ import { w as writeConsoleLogBasedOnLevel } from './write-console-log-based-on-level-ree2lDPw.js';
5
+
6
+ const getLongestBadge = (types) => {
7
+ const badges = Object.keys(types).map((x) => types[x].badge ?? "");
8
+ if (badges.length === 0) {
9
+ return "";
10
+ }
11
+ return badges.reduce((x, y) => x.length > y.length ? x : y, "");
12
+ };
13
+
14
+ const dateFormatter = (date) => [date.getHours(), date.getMinutes(), date.getSeconds()].map((n) => String(n).padStart(2, "0")).join(":");
15
+ class AbstractPrettyReporter {
16
+ /** Styling options for pretty formatting */
17
+ styles;
18
+ /** Logger type configurations for styling */
19
+ loggerTypes;
20
+ /**
21
+ * Creates a new AbstractPrettyReporter instance.
22
+ * @param options Styling options for pretty formatting
23
+ * @protected
24
+ */
25
+ constructor(options) {
26
+ this.styles = {
27
+ bold: {
28
+ label: false
29
+ },
30
+ dateFormatter,
31
+ underline: {
32
+ label: false,
33
+ message: false,
34
+ prefix: false,
35
+ suffix: false
36
+ },
37
+ uppercase: {
38
+ label: false
39
+ },
40
+ ...options
41
+ };
42
+ this.loggerTypes = LOG_TYPES;
43
+ }
44
+ /**
45
+ * Sets the logger types configuration for styling.
46
+ * @param types Logger type configurations with colors and labels
47
+ */
48
+ setLoggerTypes(types) {
49
+ this.loggerTypes = types;
50
+ }
51
+ }
7
52
 
8
53
  class PrettyReporter extends AbstractPrettyReporter {
9
54
  /**
@@ -19,7 +64,7 @@ class PrettyReporter extends AbstractPrettyReporter {
19
64
  ...options
20
65
  });
21
66
  }
22
- // eslint-disable-next-line sonarjs/cognitive-complexity
67
+ // eslint-disable-next-line sonarjs/cognitive-complexity -- browser colorize returns arrays where spread is intentional
23
68
  log(meta) {
24
69
  const isNotBrowser = typeof globalThis.window !== "undefined" && typeof globalThis.document !== "undefined";
25
70
  const consoleLogFunction = writeConsoleLogBasedOnLevel(meta.type.level);
@@ -139,9 +184,10 @@ ${cSuffix[0]}`, ...cSuffix.slice(1)]);
139
184
  let logMessage = "";
140
185
  const css = [];
141
186
  const arguments_ = [];
142
- for (const value of items) {
187
+ for (let i = 0; i < items.length; i += 1) {
188
+ const value = items[i];
143
189
  if (Array.isArray(value) && value.length > 1 && value[0].includes("%c")) {
144
- logMessage += value[0];
190
+ logMessage += String(value[0]);
145
191
  css.push(...value.slice(1));
146
192
  } else {
147
193
  arguments_.push(value);