@loglayer/transport-simple-pretty-terminal 2.2.6 → 2.2.8

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.d.ts CHANGED
@@ -1,38 +1,40 @@
1
- import { LoggerlessTransportConfig, LoggerlessTransport, LogLayerTransportParams } from '@loglayer/transport';
2
- import { ChalkInstance } from 'chalk';
3
- export * from 'chalk';
1
+ import { LogLayerTransportParams, LoggerlessTransport, LoggerlessTransportConfig } from "@loglayer/transport";
2
+ import { ChalkInstance } from "chalk";
3
+ export * from "chalk";
4
+
5
+ //#region src/types.d.ts
4
6
 
5
7
  /**
6
8
  * Configuration for log level colors.
7
9
  * Each log level can have its own chalk styling.
8
10
  */
9
11
  interface ColorConfig {
10
- /** Style for trace level logs - lowest severity */
11
- trace?: ChalkInstance;
12
- /** Style for debug level logs */
13
- debug?: ChalkInstance;
14
- /** Style for info level logs - normal operation */
15
- info?: ChalkInstance;
16
- /** Style for warning level logs */
17
- warn?: ChalkInstance;
18
- /** Style for error level logs */
19
- error?: ChalkInstance;
20
- /** Style for fatal level logs - highest severity */
21
- fatal?: ChalkInstance;
12
+ /** Style for trace level logs - lowest severity */
13
+ trace?: ChalkInstance;
14
+ /** Style for debug level logs */
15
+ debug?: ChalkInstance;
16
+ /** Style for info level logs - normal operation */
17
+ info?: ChalkInstance;
18
+ /** Style for warning level logs */
19
+ warn?: ChalkInstance;
20
+ /** Style for error level logs */
21
+ error?: ChalkInstance;
22
+ /** Style for fatal level logs - highest severity */
23
+ fatal?: ChalkInstance;
22
24
  }
23
25
  /**
24
26
  * Configuration for log view styling.
25
27
  * Defines colors and styles for different log elements.
26
28
  */
27
29
  interface ViewConfig {
28
- /** Color configuration for different log levels */
29
- colors?: ColorConfig;
30
- /** Style for log entry IDs */
31
- logIdColor?: ChalkInstance;
32
- /** Style for data values in structured data */
33
- dataValueColor?: ChalkInstance;
34
- /** Style for data keys in structured data */
35
- dataKeyColor?: ChalkInstance;
30
+ /** Color configuration for different log levels */
31
+ colors?: ColorConfig;
32
+ /** Style for log entry IDs */
33
+ logIdColor?: ChalkInstance;
34
+ /** Style for data values in structured data */
35
+ dataValueColor?: ChalkInstance;
36
+ /** Style for data keys in structured data */
37
+ dataKeyColor?: ChalkInstance;
36
38
  }
37
39
  /**
38
40
  * Runtime environment for the transport.
@@ -43,8 +45,7 @@ type Runtime = "node" | "browser";
43
45
  * Theme configuration for the simple pretty terminal transport.
44
46
  * Defines styling for log output.
45
47
  */
46
- interface SimplePrettyTerminalTheme extends ViewConfig {
47
- }
48
+ interface SimplePrettyTerminalTheme extends ViewConfig {}
48
49
  /**
49
50
  * View modes for log display.
50
51
  * - inline: Shows all information with complete data structures inline (no truncation)
@@ -57,52 +58,29 @@ type PrettyTerminalViewMode = "inline" | "message-only" | "expanded";
57
58
  * Extends the base transport configuration with simple pretty terminal specific options.
58
59
  */
59
60
  interface SimplePrettyTerminalConfig extends LoggerlessTransportConfig {
60
- /** Maximum depth for inline data display before collapsing. Default is 4. */
61
- maxInlineDepth?: number;
62
- /** Custom theme configuration for log display */
63
- theme?: SimplePrettyTerminalTheme;
64
- /** Whether the transport is enabled. If false, all operations will no-op. Defaults to true */
65
- enabled?: boolean;
66
- /** View mode for log display. Defaults to "inline" */
67
- viewMode?: PrettyTerminalViewMode;
68
- /** Whether to show log IDs in the output. Defaults to false */
69
- showLogId?: boolean;
70
- /** Custom timestamp format. Can be a date-fns format string or a custom function. Defaults to "HH:mm:ss.SSS" */
71
- timestampFormat?: string | ((timestamp: number) => string);
72
- /** Whether to collapse arrays in expanded mode. Defaults to true */
73
- collapseArrays?: boolean;
74
- /** Whether to flatten nested objects with dot notation in inline mode. Defaults to true */
75
- flattenNestedObjects?: boolean;
76
- /** Runtime environment for output */
77
- runtime: Runtime;
78
- /** Whether to include data object as second parameter in browser console calls for better debugging. Defaults to false */
79
- includeDataInBrowserConsole?: boolean;
61
+ /** Maximum depth for inline data display before collapsing. Default is 4. */
62
+ maxInlineDepth?: number;
63
+ /** Custom theme configuration for log display */
64
+ theme?: SimplePrettyTerminalTheme;
65
+ /** Whether the transport is enabled. If false, all operations will no-op. Defaults to true */
66
+ enabled?: boolean;
67
+ /** View mode for log display. Defaults to "inline" */
68
+ viewMode?: PrettyTerminalViewMode;
69
+ /** Whether to show log IDs in the output. Defaults to false */
70
+ showLogId?: boolean;
71
+ /** Custom timestamp format. Can be a date-fns format string or a custom function. Defaults to "HH:mm:ss.SSS" */
72
+ timestampFormat?: string | ((timestamp: number) => string);
73
+ /** Whether to collapse arrays in expanded mode. Defaults to true */
74
+ collapseArrays?: boolean;
75
+ /** Whether to flatten nested objects with dot notation in inline mode. Defaults to true */
76
+ flattenNestedObjects?: boolean;
77
+ /** Runtime environment for output */
78
+ runtime: Runtime;
79
+ /** Whether to include data object as second parameter in browser console calls for better debugging. Defaults to false */
80
+ includeDataInBrowserConsole?: boolean;
80
81
  }
81
-
82
- /**
83
- * A transport for LogLayer that provides simple pretty terminal output.
84
- * This transport displays logs with theming and formatting but without interactive features.
85
- *
86
- * Features:
87
- * - Real-time log display with color-coded levels
88
- * - Configurable themes and colors
89
- * - Three view modes: inline, message-only, expanded
90
- * - JSON data pretty printing
91
- * - No interactive features (no keyboard navigation, no input)
92
- * - Browser and Node.js runtime support
93
- *
94
- * Usage:
95
- * ```typescript
96
- * const transport = new SimplePrettyTerminalTransport({
97
- * maxInlineDepth: 4,
98
- * maxInlineLength: 120,
99
- * theme: customTheme,
100
- * viewMode: "inline",
101
- * runtime: "node" // or "browser"
102
- * });
103
- * ```
104
- */
105
-
82
+ //#endregion
83
+ //#region src/SimplePrettyTerminalTransport.d.ts
106
84
  /**
107
85
  * Main transport class that handles simple pretty terminal output.
108
86
  * This class provides the display functionality of PrettyTerminal without interactive features.
@@ -113,53 +91,59 @@ interface SimplePrettyTerminalConfig extends LoggerlessTransportConfig {
113
91
  * 3. Expanded: Shows timestamp, level, and message on first line, with data on indented separate lines
114
92
  */
115
93
  declare class SimplePrettyTerminalTransport extends LoggerlessTransport {
116
- /** Handles rendering and formatting of logs */
117
- private renderer;
118
- /** Configuration options */
119
- private config;
120
- /**
121
- * Creates a new SimplePrettyTerminalTransport instance.
122
- *
123
- * @param config - Configuration options for the transport
124
- */
125
- constructor(config: SimplePrettyTerminalConfig);
126
- /**
127
- * Generates a random ID for each log entry.
128
- * Uses base36 encoding for compact, readable IDs.
129
- *
130
- * @returns A 6-character string ID
131
- * @example
132
- * "a1b2c3" // Example generated ID
133
- */
134
- private generateId;
135
- /**
136
- * Main transport method that receives logs from LogLayer.
137
- * This method is called for each log event and handles:
138
- * - Generating a unique ID for the log
139
- * - Converting the log data to a storable format
140
- * - Rendering the log using the SimpleView renderer
141
- *
142
- * @param logLevel - The severity level of the log
143
- * @param messages - Array of message strings to be joined
144
- * @param data - Additional structured data to be logged
145
- * @param hasData - Whether the log includes additional data
146
- * @returns The original messages array
147
- */
148
- shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams): any[];
149
- /**
150
- * Changes the view mode for log display.
151
- *
152
- * @param viewMode - The new view mode to use
153
- */
154
- setViewMode(viewMode: PrettyTerminalViewMode): void;
155
- /**
156
- * Gets the current view mode.
157
- *
158
- * @returns The current view mode
159
- */
160
- getViewMode(): PrettyTerminalViewMode;
94
+ /** Handles rendering and formatting of logs */
95
+ private renderer;
96
+ /** Configuration options */
97
+ private config;
98
+ /**
99
+ * Creates a new SimplePrettyTerminalTransport instance.
100
+ *
101
+ * @param config - Configuration options for the transport
102
+ */
103
+ constructor(config: SimplePrettyTerminalConfig);
104
+ /**
105
+ * Generates a random ID for each log entry.
106
+ * Uses base36 encoding for compact, readable IDs.
107
+ *
108
+ * @returns A 6-character string ID
109
+ * @example
110
+ * "a1b2c3" // Example generated ID
111
+ */
112
+ private generateId;
113
+ /**
114
+ * Main transport method that receives logs from LogLayer.
115
+ * This method is called for each log event and handles:
116
+ * - Generating a unique ID for the log
117
+ * - Converting the log data to a storable format
118
+ * - Rendering the log using the SimpleView renderer
119
+ *
120
+ * @param logLevel - The severity level of the log
121
+ * @param messages - Array of message strings to be joined
122
+ * @param data - Additional structured data to be logged
123
+ * @param hasData - Whether the log includes additional data
124
+ * @returns The original messages array
125
+ */
126
+ shipToLogger({
127
+ logLevel,
128
+ messages,
129
+ data,
130
+ hasData
131
+ }: LogLayerTransportParams): any[];
132
+ /**
133
+ * Changes the view mode for log display.
134
+ *
135
+ * @param viewMode - The new view mode to use
136
+ */
137
+ setViewMode(viewMode: PrettyTerminalViewMode): void;
138
+ /**
139
+ * Gets the current view mode.
140
+ *
141
+ * @returns The current view mode
142
+ */
143
+ getViewMode(): PrettyTerminalViewMode;
161
144
  }
162
-
145
+ //#endregion
146
+ //#region src/themes.d.ts
163
147
  /**
164
148
  * Moonlight - A dark theme with cool blue tones
165
149
  * Inspired by moonlit nights and modern IDEs
@@ -236,7 +220,9 @@ declare const nature: SimplePrettyTerminalTheme;
236
220
  * - Reduced visual stress
237
221
  */
238
222
  declare const pastel: SimplePrettyTerminalTheme;
239
-
223
+ //#endregion
224
+ //#region src/index.d.ts
240
225
  declare function getSimplePrettyTerminal(config: SimplePrettyTerminalConfig): SimplePrettyTerminalTransport;
241
-
226
+ //#endregion
242
227
  export { type PrettyTerminalViewMode, type Runtime, type SimplePrettyTerminalConfig, type SimplePrettyTerminalTheme, SimplePrettyTerminalTransport, getSimplePrettyTerminal, moonlight, nature, neon, pastel, sunlight };
228
+ //# sourceMappingURL=index.d.ts.map