@loglayer/transport-simple-pretty-terminal 1.0.0

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/dist/index.js ADDED
@@ -0,0 +1,625 @@
1
+ // src/SimplePrettyTerminalTransport.ts
2
+ import { LoggerlessTransport } from "@loglayer/transport";
3
+ import chalk4 from "chalk";
4
+
5
+ // src/themes.ts
6
+ import chalk from "chalk";
7
+ var moonlight = {
8
+ colors: {
9
+ trace: chalk.rgb(114, 135, 153),
10
+ // Muted blue-grey for less important info
11
+ debug: chalk.rgb(130, 170, 255),
12
+ // Soft blue that pops but doesn't strain
13
+ info: chalk.rgb(195, 232, 141),
14
+ // Sage green for good readability
15
+ warn: chalk.rgb(255, 203, 107),
16
+ // Warm yellow, less harsh than pure yellow
17
+ error: chalk.rgb(247, 118, 142),
18
+ // Soft red that stands out without being aggressive
19
+ fatal: chalk.bgRgb(247, 118, 142).white
20
+ // Inverted soft red for maximum visibility
21
+ },
22
+ logIdColor: chalk.rgb(84, 98, 117),
23
+ // Darker blue-grey for secondary information
24
+ dataValueColor: chalk.rgb(209, 219, 231),
25
+ // Light grey-blue for primary content
26
+ dataKeyColor: chalk.rgb(130, 170, 255)
27
+ // Matching debug blue for consistency
28
+ };
29
+ var sunlight = {
30
+ colors: {
31
+ trace: chalk.rgb(110, 110, 110),
32
+ // Dark grey for subtle information
33
+ debug: chalk.rgb(32, 96, 159),
34
+ // Deep blue for strong contrast on white
35
+ info: chalk.rgb(35, 134, 54),
36
+ // Forest green, easier on the eyes than bright green
37
+ warn: chalk.rgb(176, 95, 0),
38
+ // Brown-orange for natural warning color
39
+ error: chalk.rgb(191, 0, 0),
40
+ // Deep red for clear visibility on light backgrounds
41
+ fatal: chalk.bgRgb(191, 0, 0).white
42
+ // White on deep red for critical issues
43
+ },
44
+ logIdColor: chalk.rgb(110, 110, 110),
45
+ dataValueColor: chalk.rgb(0, 0, 0),
46
+ dataKeyColor: chalk.rgb(32, 96, 159)
47
+ };
48
+ var neon = {
49
+ colors: {
50
+ trace: chalk.rgb(108, 108, 255),
51
+ // Electric blue
52
+ debug: chalk.rgb(255, 82, 246),
53
+ // Hot pink
54
+ info: chalk.rgb(0, 255, 163),
55
+ // Cyber green
56
+ warn: chalk.rgb(255, 231, 46),
57
+ // Electric yellow
58
+ error: chalk.rgb(255, 53, 91),
59
+ // Neon red
60
+ fatal: chalk.bgRgb(255, 53, 91).rgb(0, 255, 163)
61
+ // Neon red bg with cyber green text
62
+ },
63
+ logIdColor: chalk.rgb(187, 134, 252),
64
+ // Bright purple
65
+ dataValueColor: chalk.rgb(255, 255, 255),
66
+ // Pure white
67
+ dataKeyColor: chalk.rgb(0, 255, 240)
68
+ // Cyan
69
+ };
70
+ var nature = {
71
+ colors: {
72
+ trace: chalk.rgb(101, 115, 126),
73
+ // Slate grey
74
+ debug: chalk.rgb(34, 139, 34),
75
+ // Forest green
76
+ info: chalk.rgb(46, 139, 87),
77
+ // Sea green
78
+ warn: chalk.rgb(218, 165, 32),
79
+ // Golden rod
80
+ error: chalk.rgb(139, 69, 19),
81
+ // Saddle brown
82
+ fatal: chalk.bgRgb(139, 69, 19).white
83
+ // Brown background with white text
84
+ },
85
+ logIdColor: chalk.rgb(101, 115, 126),
86
+ dataValueColor: chalk.rgb(0, 0, 0),
87
+ dataKeyColor: chalk.rgb(34, 139, 34)
88
+ };
89
+ var pastel = {
90
+ colors: {
91
+ trace: chalk.rgb(200, 200, 200),
92
+ // Light grey
93
+ debug: chalk.rgb(173, 216, 230),
94
+ // Light blue
95
+ info: chalk.rgb(144, 238, 144),
96
+ // Light green
97
+ warn: chalk.rgb(255, 218, 185),
98
+ // Peach
99
+ error: chalk.rgb(255, 182, 193),
100
+ // Light pink
101
+ fatal: chalk.bgRgb(255, 182, 193).rgb(105, 105, 105)
102
+ // Light pink bg with dim grey text
103
+ },
104
+ logIdColor: chalk.rgb(200, 200, 200),
105
+ dataValueColor: chalk.rgb(105, 105, 105),
106
+ dataKeyColor: chalk.rgb(173, 216, 230)
107
+ };
108
+
109
+ // src/views/SimpleView.ts
110
+ import wrap from "wrap-ansi";
111
+
112
+ // src/vendor/prettyjson.js
113
+ import chalk2 from "chalk";
114
+
115
+ // src/vendor/utils.js
116
+ function indent(numSpaces) {
117
+ return new Array(numSpaces + 1).join(" ");
118
+ }
119
+ function getMaxIndexLength(input) {
120
+ var maxWidth = 0;
121
+ Object.getOwnPropertyNames(input).forEach((key) => {
122
+ if (input[key] === void 0) {
123
+ return;
124
+ }
125
+ maxWidth = Math.max(maxWidth, key.length);
126
+ });
127
+ return maxWidth;
128
+ }
129
+ function isIsoStringDate(isoString) {
130
+ if (typeof isoString !== "string") {
131
+ return false;
132
+ }
133
+ if (!/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?$/.test(isoString)) {
134
+ return false;
135
+ }
136
+ const testDate = new Date(isoString);
137
+ return !Number.isNaN(testDate.getTime());
138
+ }
139
+
140
+ // src/vendor/prettyjson.js
141
+ var conflictChars = /[^\w\s\n\r\v\t.,]/i;
142
+ var isPrintable = (input, options) => input !== void 0 || options.renderUndefined;
143
+ var isSerializable = (input, onlyPrimitives, options) => {
144
+ if (typeof input === "boolean" || typeof input === "number" || typeof input === "function" || input === null || input === void 0 || input instanceof Date) {
145
+ return true;
146
+ }
147
+ if (typeof input === "string" && input.indexOf("\n") === -1) {
148
+ return true;
149
+ }
150
+ if (options.inlineArrays && !onlyPrimitives) {
151
+ if (Array.isArray(input) && isSerializable(input[0], true, options)) {
152
+ return true;
153
+ }
154
+ }
155
+ return false;
156
+ };
157
+ var getColorRenderer = (colorFn, options) => {
158
+ if (options.noColor) {
159
+ return (text) => text;
160
+ }
161
+ if (typeof colorFn !== "function") {
162
+ return (text) => text;
163
+ }
164
+ return colorFn;
165
+ };
166
+ var addColorToData = (input, options) => {
167
+ if (options.noColor) {
168
+ return input;
169
+ }
170
+ if (input instanceof Date) {
171
+ return getColorRenderer(options.dateColor, options)(input.toISOString());
172
+ }
173
+ if (typeof input === "string") {
174
+ if (isIsoStringDate(input)) {
175
+ return getColorRenderer(options.dateColor, options)(input);
176
+ }
177
+ return getColorRenderer(options.stringColor, options)(input);
178
+ }
179
+ const sInput = `${input}`;
180
+ if (typeof input === "boolean") {
181
+ return getColorRenderer(options.booleanColor, options)(sInput);
182
+ }
183
+ if (input === null || input === void 0) {
184
+ return getColorRenderer(options.nullUndefinedColor, options)(sInput);
185
+ }
186
+ if (typeof input === "number") {
187
+ if (input >= 0) {
188
+ return getColorRenderer(options.positiveNumberColor, options)(sInput);
189
+ }
190
+ return getColorRenderer(options.negativeNumberColor, options)(sInput);
191
+ }
192
+ if (typeof input === "function") {
193
+ return "function() {}";
194
+ }
195
+ if (Array.isArray(input)) {
196
+ return input.join(", ");
197
+ }
198
+ return sInput;
199
+ };
200
+ var colorMultilineString = (options, line) => getColorRenderer(options.multilineStringColor, options)(line);
201
+ var indentLines = (string, spaces, options) => {
202
+ let lines = string.split("\n");
203
+ lines = lines.map((line) => indent(spaces) + colorMultilineString(options, line));
204
+ return lines.join("\n");
205
+ };
206
+ var renderToArray = (data, options, indentation) => {
207
+ if (typeof data === "string" && data.match(conflictChars) && options.escape) {
208
+ data = JSON.stringify(data);
209
+ }
210
+ if (!isPrintable(data, options)) {
211
+ return [];
212
+ }
213
+ if (isSerializable(data, false, options)) {
214
+ return [indent(indentation) + addColorToData(data, options)];
215
+ }
216
+ if (typeof data === "string") {
217
+ return [
218
+ indent(indentation) + colorMultilineString(options, '"""'),
219
+ indentLines(data, indentation + options.defaultIndentation, options),
220
+ indent(indentation) + colorMultilineString(options, '"""')
221
+ ];
222
+ }
223
+ if (Array.isArray(data)) {
224
+ if (data.length === 0) {
225
+ return [indent(indentation) + options.emptyArrayMsg];
226
+ }
227
+ if (options.collapseArrays && data.length > 0) {
228
+ return [`${indent(indentation)}[... ${data.length} items]`];
229
+ }
230
+ const outputArray = [];
231
+ data.forEach((element) => {
232
+ if (!isPrintable(element, options)) {
233
+ return;
234
+ }
235
+ let line = "- ";
236
+ line = getColorRenderer(options.dashColor, options)(line);
237
+ line = indent(indentation) + line;
238
+ if (isSerializable(element, false, options)) {
239
+ line += renderToArray(element, options, 0)[0];
240
+ outputArray.push(line);
241
+ } else {
242
+ outputArray.push(line);
243
+ outputArray.push.apply(outputArray, renderToArray(element, options, indentation + options.defaultIndentation));
244
+ }
245
+ });
246
+ return outputArray;
247
+ }
248
+ if (data instanceof Error) {
249
+ return renderToArray(
250
+ {
251
+ message: data.message,
252
+ stack: data.stack.split("\n")
253
+ },
254
+ options,
255
+ indentation
256
+ );
257
+ }
258
+ const maxIndexLength = options.noAlign ? 0 : getMaxIndexLength(data);
259
+ let key;
260
+ const output = [];
261
+ Object.getOwnPropertyNames(data).forEach((i) => {
262
+ if (!isPrintable(data[i], options)) {
263
+ return;
264
+ }
265
+ key = `${i}: `;
266
+ key = getColorRenderer(options.keysColor, options)(key);
267
+ key = indent(indentation) + key;
268
+ if (isSerializable(data[i], false, options)) {
269
+ const nextIndentation = options.noAlign ? 0 : maxIndexLength - i.length;
270
+ key += renderToArray(data[i], options, nextIndentation)[0];
271
+ output.push(key);
272
+ } else {
273
+ output.push(key);
274
+ output.push.apply(output, renderToArray(data[i], options, indentation + options.defaultIndentation));
275
+ }
276
+ });
277
+ return output;
278
+ };
279
+ var validateOptionsAndSetDefaults = (options) => {
280
+ options = options || {};
281
+ options.emptyArrayMsg = options.emptyArrayMsg || "(empty array)";
282
+ options.keysColor = options.keysColor || chalk2.green;
283
+ options.dashColor = options.dashColor || chalk2.green;
284
+ options.booleanColor = options.booleanColor || chalk2.cyan;
285
+ options.nullUndefinedColor = options.nullUndefinedColor || chalk2.grey;
286
+ options.numberColor = options.numberColor || chalk2.blue;
287
+ options.positiveNumberColor = options.positiveNumberColor || options.numberColor;
288
+ options.negativeNumberColor = options.negativeNumberColor || options.numberColor;
289
+ options.dateColor = options.dateColor || chalk2.magenta;
290
+ options.defaultIndentation = options.defaultIndentation || 2;
291
+ options.noColor = !!options.noColor;
292
+ options.noAlign = !!options.noAlign;
293
+ options.escape = !!options.escape;
294
+ options.renderUndefined = !!options.renderUndefined;
295
+ options.collapseArrays = !!options.collapseArrays;
296
+ options.stringColor = options.stringColor || null;
297
+ options.multilineStringColor = options.multilineStringColor || options.stringColor || null;
298
+ return options;
299
+ };
300
+ function render(data, options, indentation) {
301
+ indentation = indentation || 0;
302
+ options = validateOptionsAndSetDefaults(options);
303
+ return renderToArray(data, options, indentation).join("\n");
304
+ }
305
+
306
+ // src/views/utils.ts
307
+ import chalk3 from "chalk";
308
+ import { format } from "date-fns";
309
+ function formatTimestamp(timestamp, colorFn, timestampFormat = "HH:mm:ss.SSS") {
310
+ let formattedTime;
311
+ if (typeof timestampFormat === "function") {
312
+ formattedTime = timestampFormat(timestamp);
313
+ } else {
314
+ const date = new Date(timestamp);
315
+ formattedTime = format(date, timestampFormat);
316
+ }
317
+ return colorFn(`[${formattedTime}]`);
318
+ }
319
+ function getLevelColor(level, colors) {
320
+ const levelLower = level.toLowerCase();
321
+ switch (levelLower) {
322
+ case "trace":
323
+ return colors.trace || chalk3.white;
324
+ case "debug":
325
+ return colors.debug || chalk3.white;
326
+ case "info":
327
+ return colors.info || chalk3.white;
328
+ case "warn":
329
+ return colors.warn || chalk3.white;
330
+ case "error":
331
+ return colors.error || chalk3.white;
332
+ case "fatal":
333
+ return colors.fatal || chalk3.white;
334
+ default:
335
+ return colors.info || chalk3.white;
336
+ }
337
+ }
338
+ function formatValue(value, expanded = false, collapseArrays = true) {
339
+ if (typeof value === "string") return value;
340
+ if (typeof value === "number" || typeof value === "boolean") return value.toString();
341
+ if (value === null) return "null";
342
+ if (value === void 0) return "undefined";
343
+ if (Array.isArray(value)) return expanded ? JSON.stringify(value) : collapseArrays ? "[...]" : value.toString();
344
+ if (typeof value === "object") return expanded ? JSON.stringify(value) : "{...}";
345
+ return value.toString();
346
+ }
347
+ function formatInlineData(data, config, maxDepth, expanded = false, collapseArrays = true) {
348
+ if (!data) return "";
349
+ const pairs = [];
350
+ const traverse = (obj, prefix = "", depth = 0) => {
351
+ if (!expanded && depth >= maxDepth) return;
352
+ for (const [key, value] of Object.entries(obj)) {
353
+ const fullKey = prefix ? `${prefix}.${key}` : key;
354
+ if (value && typeof value === "object" && !Array.isArray(value)) {
355
+ if (expanded) {
356
+ pairs.push(`${config.dataKeyColor(fullKey)}=${config.dataValueColor(JSON.stringify(value))}`);
357
+ } else {
358
+ traverse(value, fullKey, depth + 1);
359
+ }
360
+ } else {
361
+ pairs.push(
362
+ `${config.dataKeyColor(fullKey)}=${config.dataValueColor(formatValue(value, expanded, collapseArrays))}`
363
+ );
364
+ }
365
+ }
366
+ };
367
+ traverse(data);
368
+ const result = pairs.join(" ");
369
+ return result;
370
+ }
371
+
372
+ // src/views/SimpleView.ts
373
+ var SimpleView = class {
374
+ termWidth;
375
+ config;
376
+ viewMode;
377
+ maxInlineDepth;
378
+ showLogId;
379
+ timestampFormat;
380
+ collapseArrays;
381
+ flattenNestedObjects;
382
+ constructor(config) {
383
+ this.config = config;
384
+ this.viewMode = config.viewMode;
385
+ this.maxInlineDepth = config.maxInlineDepth;
386
+ this.showLogId = config.showLogId;
387
+ this.timestampFormat = config.timestampFormat;
388
+ this.collapseArrays = config.collapseArrays !== false;
389
+ this.flattenNestedObjects = config.flattenNestedObjects !== false;
390
+ this.termWidth = process.stdout.columns || 120;
391
+ }
392
+ updateTerminalWidth(width) {
393
+ this.termWidth = width;
394
+ }
395
+ getConfig() {
396
+ return this.config;
397
+ }
398
+ getViewMode() {
399
+ return this.viewMode;
400
+ }
401
+ /**
402
+ * Renders a single log entry based on the current view mode
403
+ */
404
+ renderLogLine(entry) {
405
+ const levelColor = getLevelColor(entry.level, this.config.config.colors);
406
+ const chevron = levelColor(`\u25B6 ${entry.level.toUpperCase()} `);
407
+ const message = entry.message || "(no message)";
408
+ const timestamp = formatTimestamp(entry.timestamp, this.config.config.logIdColor, this.timestampFormat);
409
+ switch (this.viewMode) {
410
+ case "message-only": {
411
+ const condensedLine = `${timestamp} ${chevron}${message}`;
412
+ console.log(wrap(condensedLine, this.termWidth, { hard: true }));
413
+ break;
414
+ }
415
+ case "inline": {
416
+ const logId = this.showLogId ? this.config.config.logIdColor(`[${entry.id}]`) : "";
417
+ const fullData = entry.data ? formatInlineData(
418
+ JSON.parse(entry.data),
419
+ this.config.config,
420
+ this.maxInlineDepth,
421
+ !this.flattenNestedObjects,
422
+ this.collapseArrays
423
+ ) : "";
424
+ const expandedLine = `${timestamp} ${chevron}${logId ? `${logId} ` : ""}${message}${fullData ? ` ${fullData}` : ""}`;
425
+ console.log(expandedLine);
426
+ break;
427
+ }
428
+ case "expanded": {
429
+ const logId = this.showLogId ? this.config.config.logIdColor(`[${entry.id}]`) : "";
430
+ const firstLine = `${timestamp} ${chevron}${logId ? `${logId} ` : ""}${message}`;
431
+ console.log(wrap(firstLine, this.termWidth, { hard: true }));
432
+ if (entry.data) {
433
+ const jsonLines = render(JSON.parse(entry.data), {
434
+ defaultIndentation: 2,
435
+ keysColor: this.config.config.dataKeyColor,
436
+ dashColor: this.config.config.dataKeyColor,
437
+ numberColor: this.config.config.dataValueColor,
438
+ stringColor: this.config.config.dataValueColor,
439
+ multilineStringColor: this.config.config.dataValueColor,
440
+ positiveNumberColor: this.config.config.dataValueColor,
441
+ negativeNumberColor: this.config.config.dataValueColor,
442
+ booleanColor: this.config.config.dataValueColor,
443
+ nullUndefinedColor: this.config.config.dataValueColor,
444
+ dateColor: this.config.config.dataValueColor,
445
+ collapseArrays: this.collapseArrays
446
+ }).split("\n");
447
+ for (const line of jsonLines) {
448
+ if (line.trim() === "") {
449
+ console.log(" ");
450
+ } else {
451
+ console.log(` ${line}`);
452
+ }
453
+ }
454
+ }
455
+ break;
456
+ }
457
+ default: {
458
+ const logId = this.showLogId ? this.config.config.logIdColor(`[${entry.id}]`) : "";
459
+ const fullData = entry.data ? formatInlineData(JSON.parse(entry.data), this.config.config, this.maxInlineDepth, true, this.collapseArrays) : "";
460
+ const expandedLine = `${timestamp} ${chevron}${logId ? `${logId} ` : ""}${message}${fullData ? ` ${fullData}` : ""}`;
461
+ console.log(wrap(expandedLine, this.termWidth, { hard: true }));
462
+ break;
463
+ }
464
+ }
465
+ }
466
+ };
467
+
468
+ // src/SimplePrettyTerminalTransport.ts
469
+ var SimplePrettyTerminalTransport = class extends LoggerlessTransport {
470
+ /** Handles rendering and formatting of logs */
471
+ renderer;
472
+ /** Configuration options */
473
+ config;
474
+ /** Current terminal width in characters */
475
+ termWidth;
476
+ /**
477
+ * Creates a new SimplePrettyTerminalTransport instance.
478
+ *
479
+ * @param config - Configuration options for the transport
480
+ */
481
+ constructor(config = {}) {
482
+ super(config);
483
+ this.config = config;
484
+ if (config.enabled === false) {
485
+ return;
486
+ }
487
+ const maxInlineDepth = config.maxInlineDepth || 4;
488
+ const theme = config.theme || moonlight;
489
+ const viewMode = config.viewMode || "inline";
490
+ const showLogId = config.showLogId || false;
491
+ const timestampFormat = config.timestampFormat || "HH:mm:ss.SSS";
492
+ const collapseArrays = config.collapseArrays !== false;
493
+ const flattenNestedObjects = config.flattenNestedObjects !== false;
494
+ const viewConfig = {
495
+ colors: {
496
+ trace: chalk4.gray,
497
+ // Lowest level, used for verbose output
498
+ debug: chalk4.blue,
499
+ // Debug information
500
+ info: chalk4.green,
501
+ // Normal operation
502
+ warn: chalk4.yellow,
503
+ // Warning conditions
504
+ error: chalk4.red,
505
+ // Error conditions
506
+ fatal: chalk4.bgRed.white,
507
+ // Critical errors
508
+ ...theme.colors
509
+ },
510
+ logIdColor: theme.logIdColor || chalk4.dim,
511
+ dataValueColor: theme.dataValueColor || chalk4.white,
512
+ dataKeyColor: theme.dataKeyColor || chalk4.dim
513
+ };
514
+ this.termWidth = process.stdout.columns || 80;
515
+ this.renderer = new SimpleView({
516
+ viewMode,
517
+ maxInlineDepth,
518
+ showLogId,
519
+ timestampFormat,
520
+ collapseArrays,
521
+ flattenNestedObjects,
522
+ config: viewConfig
523
+ });
524
+ process.stdout.on("resize", () => {
525
+ this.termWidth = process.stdout.columns || 80;
526
+ this.renderer.updateTerminalWidth(this.termWidth);
527
+ });
528
+ }
529
+ /**
530
+ * Generates a random ID for each log entry.
531
+ * Uses base36 encoding for compact, readable IDs.
532
+ *
533
+ * @returns A 6-character string ID
534
+ * @example
535
+ * "a1b2c3" // Example generated ID
536
+ */
537
+ generateId() {
538
+ return Math.random().toString(36).substring(2, 8);
539
+ }
540
+ /**
541
+ * Main transport method that receives logs from LogLayer.
542
+ * This method is called for each log event and handles:
543
+ * - Generating a unique ID for the log
544
+ * - Converting the log data to a storable format
545
+ * - Rendering the log using the SimpleView renderer
546
+ *
547
+ * @param logLevel - The severity level of the log
548
+ * @param messages - Array of message strings to be joined
549
+ * @param data - Additional structured data to be logged
550
+ * @param hasData - Whether the log includes additional data
551
+ * @returns The original messages array
552
+ */
553
+ shipToLogger({ logLevel, messages, data, hasData }) {
554
+ if (this.config.enabled === false) {
555
+ return messages;
556
+ }
557
+ const entry = {
558
+ id: this.generateId(),
559
+ timestamp: Date.now(),
560
+ level: logLevel,
561
+ message: messages.join(" "),
562
+ data: hasData ? JSON.stringify(data) : null
563
+ };
564
+ this.renderer.renderLogLine(entry);
565
+ return messages;
566
+ }
567
+ /**
568
+ * Changes the view mode for log display.
569
+ *
570
+ * @param viewMode - The new view mode to use
571
+ */
572
+ setViewMode(viewMode) {
573
+ if (this.config.enabled === false) {
574
+ return;
575
+ }
576
+ const theme = this.config.theme || moonlight;
577
+ const viewConfig = {
578
+ colors: {
579
+ trace: chalk4.gray,
580
+ debug: chalk4.blue,
581
+ info: chalk4.green,
582
+ warn: chalk4.yellow,
583
+ error: chalk4.red,
584
+ fatal: chalk4.bgRed.white,
585
+ ...theme.colors
586
+ },
587
+ logIdColor: theme.logIdColor || chalk4.dim,
588
+ dataValueColor: theme.dataValueColor || chalk4.white,
589
+ dataKeyColor: theme.dataKeyColor || chalk4.dim
590
+ };
591
+ this.renderer = new SimpleView({
592
+ viewMode,
593
+ maxInlineDepth: this.config.maxInlineDepth || 4,
594
+ showLogId: this.config.showLogId || false,
595
+ timestampFormat: this.config.timestampFormat || "HH:mm:ss.SSS",
596
+ collapseArrays: this.config.collapseArrays !== false,
597
+ flattenNestedObjects: this.config.flattenNestedObjects !== false,
598
+ config: viewConfig
599
+ });
600
+ }
601
+ /**
602
+ * Gets the current view mode.
603
+ *
604
+ * @returns The current view mode
605
+ */
606
+ getViewMode() {
607
+ return this.renderer.getViewMode();
608
+ }
609
+ };
610
+
611
+ // src/index.ts
612
+ export * from "chalk";
613
+ function getSimplePrettyTerminal(config = {}) {
614
+ return new SimplePrettyTerminalTransport(config);
615
+ }
616
+ export {
617
+ SimplePrettyTerminalTransport,
618
+ getSimplePrettyTerminal,
619
+ moonlight,
620
+ nature,
621
+ neon,
622
+ pastel,
623
+ sunlight
624
+ };
625
+ //# sourceMappingURL=index.js.map