@virtualdisplay.io/client 3.6.0 → 4.0.0-alpha.1

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.
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Virtual Display
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,314 +0,0 @@
1
- # @virtualdisplay-io/logger
2
-
3
- A simple, TypeScript-first logging library for browser and Node.js applications.
4
-
5
- [![GitHub Package](https://img.shields.io/badge/%40virtualdisplay--io%2Flogger-GitHub%20Package-blue)](https://github.com/virtualdisplay-io/logger/packages)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
- [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
8
-
9
- ## Features
10
-
11
- - **Simple API** - Just `enabled` and `level`, no complex configuration
12
- - **TypeScript Native** - Full type safety and autocompletion
13
- - **Lightweight** - ~3KB gzipped, zero dependencies
14
- - **Visual Clarity** - Emoji indicators and colors for log levels (📘 âš ī¸ ❌ 🐛)
15
- - **Universal** - Works in Node.js, browsers, and workers
16
- - **Extensible** - Custom transports and formatters
17
- - **Memory Transport** - Built-in log analysis and debugging
18
- - **Child Loggers** - Contextual logging with inherited settings
19
-
20
- ## Installation
21
-
22
- This package is published to GitHub Packages. First, configure your npm to use the GitHub Package Registry:
23
-
24
- ```bash
25
- echo "@virtualdisplay-io:registry=https://npm.pkg.github.com" >> .npmrc
26
- ```
27
-
28
- Then install the package:
29
-
30
- ```bash
31
- npm install @virtualdisplay-io/logger
32
- ```
33
-
34
- ```bash
35
- yarn add @virtualdisplay-io/logger
36
- ```
37
-
38
- ```bash
39
- pnpm add @virtualdisplay-io/logger
40
- ```
41
-
42
- ## Quick Start
43
-
44
- ```typescript
45
- import { logger } from '@virtualdisplay-io/logger';
46
-
47
- // The default logger has no prefix - clean and neutral
48
- logger.info('Application started'); // 📘 Application started
49
- logger.warn('This is a warning'); // âš ī¸ This is a warning
50
- logger.error('Something went wrong', { userId: '123' }); // ❌ Something went wrong
51
-
52
- // Create a logger with your own prefix
53
- import { Logger } from '@virtualdisplay-io/logger';
54
-
55
- const appLogger = new Logger({ prefix: 'MyApp' });
56
- appLogger.info('Application started'); // 📘 [MyApp] Application started
57
- ```
58
-
59
- ## Advanced Usage
60
-
61
- ### Simple Configuration
62
-
63
- ```typescript
64
- import { Logger } from '@virtualdisplay-io/logger';
65
-
66
- const logger = new Logger({
67
- prefix: 'MyApp',
68
- level: 'info', // Only show info, warn, and error
69
- enabled: true, // Turn logging on/off
70
- colors: true, // Enable colors in browser (default: true)
71
- context: { version: '1.0.0' }
72
- });
73
-
74
- logger.info('Server started'); // Shows (info level or higher)
75
- logger.debug('Cache cleared'); // Hidden (below info level)
76
- ```
77
-
78
- ### Control Log Levels
79
-
80
- ```typescript
81
- // Set level dynamically
82
- logger.setLevel('debug'); // Now debug messages will show
83
- logger.setLevel('error'); // Only errors will show
84
-
85
- // Turn logging on/off
86
- logger.setEnabled(false); // All logging disabled
87
- logger.setEnabled(true); // Logging re-enabled
88
- ```
89
-
90
- ### Child Loggers
91
-
92
- ```typescript
93
- import { Logger } from '@virtualdisplay-io/logger';
94
-
95
- // Create a base logger without prefix
96
- const baseLogger = new Logger();
97
-
98
- // Create child logger with additional context
99
- const authLogger = baseLogger.child({
100
- prefix: 'Auth',
101
- context: { module: 'authentication' },
102
- });
103
-
104
- const userLogger = authLogger.child({
105
- context: { userId: '123', action: 'login' },
106
- });
107
-
108
- userLogger.info('User login attempt');
109
- // Output: [timestamp] [Auth] INFO: User login attempt {module="authentication" userId="123" action="login"}
110
-
111
- // Or add a prefix to the default logger
112
- import { logger } from '@virtualdisplay-io/logger';
113
- const apiLogger = logger.child({ prefix: 'API', context: { service: 'users' } });
114
- // Output will have [API] prefix
115
- ```
116
-
117
-
118
- ### Custom Formatters
119
-
120
- ```typescript
121
- import { Logger } from '@virtualdisplay-io/logger';
122
- import type { LogFormatter, LogEntry } from '@virtualdisplay-io/logger';
123
-
124
- class CustomFormatter implements LogFormatter {
125
- name = 'custom';
126
-
127
- format(entry: LogEntry): LogEntry {
128
- return {
129
- ...entry,
130
- message: `đŸŽ¯ ${entry.message.toUpperCase()}`,
131
- };
132
- }
133
- }
134
-
135
- const logger = new Logger({
136
- formatters: [new CustomFormatter()],
137
- });
138
-
139
- logger.info('hello world'); // Output: đŸŽ¯ HELLO WORLD
140
- ```
141
-
142
- ### Memory Transport for Log Analysis
143
-
144
- ```typescript
145
- import { Logger } from '@virtualdisplay-io/logger';
146
-
147
- // Memory transport is loaded dynamically to keep bundle size small
148
- const logger = new Logger();
149
-
150
- // Enable memory logging when needed
151
- await logger.enableMemoryLogging(500); // Store max 500 entries
152
-
153
- // Log some events
154
- logger.info('User created', { userId: '123' });
155
- logger.warn('Rate limit exceeded', { ip: '192.168.1.1' });
156
- logger.error('Database connection failed');
157
-
158
- // Use the logger's debug methods to analyze logs
159
- const allLogs = JSON.parse(logger.exportLogs());
160
- const errors = logger.getRecentErrors();
161
- const searchResults = logger.searchLogs(/database/i);
162
-
163
- // Export logs
164
- console.log(logger.exportLogs()); // JSON format
165
- console.log(logger.exportLogsCSV()); // CSV format
166
- ```
167
-
168
- ### Global Muting
169
-
170
- ```typescript
171
- import { Logger } from '@virtualdisplay-io/logger';
172
-
173
- // Mute all logger instances
174
- Logger.setMute(true);
175
- logger.info('This will not be logged');
176
-
177
- // Unmute
178
- Logger.setMute(false);
179
- logger.info('This will be logged');
180
- ```
181
-
182
- ## API Reference
183
-
184
- ### Logger Class
185
-
186
- #### Basic methods:
187
- - `debug(message: string, ...args: unknown[]): void`
188
- - `info(message: string, ...args: unknown[]): void`
189
- - `warn(message: string, ...args: unknown[]): void`
190
- - `error(message: string, ...args: unknown[]): void`
191
- - `child(options?: Partial<LoggerOptions>): Logger`
192
-
193
- #### Configuration methods:
194
- - `setLevel(level: LogLevel): void` - Set the minimum log level
195
- - `getLevel(): LogLevel` - Get the current log level
196
- - `setEnabled(enabled: boolean): void` - Enable/disable logging
197
- - `isEnabled(): boolean` - Check if logging is enabled
198
-
199
- #### Transport & Formatter methods:
200
- - `addTransport(transport: LogTransport): void`
201
- - `removeTransport(name: string): void`
202
- - `getTransport(name: string): LogTransport | undefined`
203
- - `addFormatter(formatter: LogFormatter): void`
204
- - `removeFormatter(name: string): void`
205
- - `getFormatter(name: string): LogFormatter | undefined`
206
-
207
- #### Debug methods (when memory transport is added):
208
- - `enableMemoryLogging(maxSize?: number): Promise<void>`
209
- - `exportLogs(): string` - Export logs as JSON
210
- - `exportLogsCSV(): string` - Export logs as CSV
211
- - `getRecentErrors(minutes?: number): LogEntry[]`
212
- - `searchLogs(query: string | RegExp): LogEntry[]`
213
- - `clearLogs(): void`
214
-
215
- ### Log Levels
216
-
217
- - `debug` (0) - Detailed debugging information
218
- - `info` (1) - General information
219
- - `warn` (2) - Warning messages
220
- - `error` (3) - Error messages
221
-
222
- ### Built-in Transports
223
-
224
- - **ConsoleTransport** - Outputs to console with colors, emojis, and grouped logging
225
- - Colors for visual clarity (can be disabled)
226
- - Collapsible groups showing origin and arguments
227
- - Automatic fallback for environments without color support
228
- - **MemoryTransport** - Stores logs in memory with query capabilities (loaded on-demand)
229
-
230
- ### Built-in Formatters
231
-
232
- - **ContextFormatter** - Appends context data to log messages
233
- - **JSONFormatter** - Converts log entries to JSON format
234
-
235
- ## Browser Support
236
-
237
- - **Modern browsers** (ES2022+)
238
- - **Node.js** 18+
239
-
240
- ## Debug Features
241
-
242
- The logger includes some basic debug features when using the memory transport:
243
-
244
- ```typescript
245
- import { logger } from '@virtualdisplay-io/logger';
246
-
247
- // Enable memory logging to store logs
248
- await logger.enableMemoryLogging(1000); // Store max 1000 log entries
249
-
250
- // Export logs as JSON
251
- const logs = logger.exportLogs();
252
-
253
- // Export logs as CSV
254
- const csv = logger.exportLogsCSV();
255
-
256
- // Get recent errors
257
- const errors = logger.getRecentErrors();
258
-
259
- // Search logs
260
- const searchResults = logger.searchLogs('search term');
261
- ```
262
-
263
-
264
- ## Basic Example
265
-
266
- ```typescript
267
- import { Logger } from '@virtualdisplay-io/logger';
268
-
269
- // Create a logger for your application
270
- const appLogger = new Logger({ prefix: 'MyApp' });
271
-
272
- // Log some messages
273
- appLogger.info('Application started');
274
- appLogger.warn('This is a warning');
275
- appLogger.error('An error occurred');
276
-
277
- // Create child loggers with context
278
- const userLogger = appLogger.child({
279
- context: { userId: '123', module: 'auth' }
280
- });
281
-
282
- userLogger.info('User logged in');
283
- ```
284
-
285
- ## Examples
286
-
287
- The `examples/` directory contains focused examples for each feature:
288
-
289
- - **`basic-usage.ts`** - Getting started, log levels, prefixes
290
- - **`child-loggers.ts`** - Hierarchical logging with context inheritance
291
- - **`memory-transport.ts`** - Log analysis and debugging commands
292
- - **`custom-colors.ts`** - Customize visual appearance
293
- - **`custom-transports.ts`** - Create your own logging destinations
294
- - **`formatters.ts`** - Transform log messages before output
295
- - **`grouped-logging.ts`** - Collapsible browser console groups
296
- - **`advanced-usage.ts`** - Multiple features working together
297
- - **`production-setup.ts`** - Real-world production configuration
298
-
299
- Run any example with:
300
- ```bash
301
- npx tsx examples/basic-usage.ts
302
- ```
303
-
304
- ## Contributing
305
-
306
- Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
307
-
308
- ## License
309
-
310
- MIT Š [Virtual Display](LICENSE)
311
-
312
- ---
313
-
314
- Built with â¤ī¸ by the Virtual Display team
@@ -1,167 +0,0 @@
1
- export declare class ConsoleTransport implements LogTransport {
2
- readonly name = "console";
3
- private readonly colorMap;
4
- private readonly emojiMap;
5
- constructor(_options?: ConsoleTransportOptions);
6
- log(entry: LogEntry): void;
7
- private createStackTrace;
8
- private getConsoleMethod;
9
- private supportsGroupedLogging;
10
- private isTestEnvironment;
11
- }
12
-
13
- export declare interface ConsoleTransportOptions {
14
- colors?: boolean;
15
- timestamp?: boolean;
16
- }
17
-
18
- export declare class ContextFormatter implements LogFormatter {
19
- readonly name = "context";
20
- private readonly includeContext;
21
- private readonly contextPrefix;
22
- constructor(options?: ContextFormatterOptions);
23
- format(entry: LogEntry): LogEntry;
24
- private formatContext;
25
- private formatValue;
26
- }
27
-
28
- export declare interface ContextFormatterOptions {
29
- includeContext?: boolean;
30
- contextPrefix?: string;
31
- }
32
-
33
- export declare const enableMemoryLogging: typeof Logger.enableMemoryLogging;
34
-
35
- export declare interface ILogger {
36
- debug(message: string, ...args: unknown[]): void;
37
- info(message: string, ...args: unknown[]): void;
38
- warn(message: string, ...args: unknown[]): void;
39
- error(message: string, ...args: unknown[]): void;
40
- child(options?: Partial<LoggerOptions>): ILogger;
41
- setLevel(level: LogLevel): void;
42
- getLevel(): LogLevel;
43
- isEnabled(): boolean;
44
- setEnabled(enabled: boolean): void;
45
- addTransport(transport: LogTransport): void;
46
- removeTransport(name: string): void;
47
- addFormatter(formatter: LogFormatter): void;
48
- removeFormatter(name: string): void;
49
- }
50
-
51
- export declare class JSONFormatter implements LogFormatter {
52
- readonly name = "json";
53
- private seen;
54
- format(entry: LogEntry): LogEntry;
55
- private sanitizeMessage;
56
- private sanitizeValue;
57
- private sanitizeObject;
58
- }
59
-
60
- export declare const LOG_LEVEL_NAMES: Record<LogLevelValue, LogLevel>;
61
-
62
- export declare const LOG_LEVELS: Record<LogLevel, LogLevelValue>;
63
-
64
- export declare interface LogEntry {
65
- level: LogLevel;
66
- message: string;
67
- timestamp: Date;
68
- context?: Record<string, unknown>;
69
- args?: unknown[];
70
- prefix?: string;
71
- }
72
-
73
- export declare interface LogFormatter {
74
- name: string;
75
- format(entry: LogEntry): LogEntry;
76
- }
77
-
78
- export declare class Logger implements ILogger {
79
- private static instance;
80
- private static mute;
81
- private readonly prefix?;
82
- private enabled;
83
- private level;
84
- private readonly context;
85
- private readonly transports;
86
- private readonly formatters;
87
- private readonly isRoot;
88
- constructor(options?: LoggerOptions, isRoot?: boolean);
89
- static getInstance(options?: LoggerOptions): Logger;
90
- static setMute(mute: boolean): void;
91
- static isMuted(): boolean;
92
- static exportLogs(): string;
93
- static exportLogsCSV(): string;
94
- static getRecentErrors(minutes?: number): LogEntry[];
95
- static searchLogs(query: string | RegExp): LogEntry[];
96
- static clearLogs(): void;
97
- static enableMemoryLogging(maxSize?: number): Promise<void>;
98
- debug(message: string, ...args: unknown[]): void;
99
- info(message: string, ...args: unknown[]): void;
100
- warn(message: string, ...args: unknown[]): void;
101
- error(message: string, ...args: unknown[]): void;
102
- child(options?: Partial<LoggerOptions>): Logger;
103
- setLevel(level: LogLevel): void;
104
- getLevel(): LogLevel;
105
- isEnabled(): boolean;
106
- setEnabled(enabled: boolean): void;
107
- addTransport(transport: LogTransport): void;
108
- removeTransport(name: string): void;
109
- addFormatter(formatter: LogFormatter): void;
110
- removeFormatter(name: string): void;
111
- getTransport(name: string): LogTransport | undefined;
112
- getFormatter(name: string): LogFormatter | undefined;
113
- exportLogs(): string;
114
- exportLogsCSV(): string;
115
- getRecentErrors(minutes?: number): LogEntry[];
116
- searchLogs(query: string | RegExp): LogEntry[];
117
- clearLogs(): void;
118
- enableMemoryLogging(maxSize?: number): Promise<void>;
119
- private getMemoryTransport;
120
- private log;
121
- private shouldLog;
122
- }
123
-
124
- export declare const logger: Logger;
125
-
126
- export declare interface LoggerOptions {
127
- prefix?: string;
128
- enabled?: boolean;
129
- level?: LogLevel;
130
- timestamp?: boolean;
131
- colors?: boolean;
132
- context?: Record<string, unknown>;
133
- transports?: LogTransport[];
134
- formatters?: LogFormatter[];
135
- }
136
-
137
- export declare type LogLevel = 'debug' | 'info' | 'warn' | 'error';
138
-
139
- export declare type LogLevelValue = 0 | 1 | 2 | 3;
140
-
141
- export declare interface LogTransport {
142
- name: string;
143
- log(entry: LogEntry): void | Promise<void>;
144
- }
145
-
146
- export declare class MemoryTransport implements LogTransport {
147
- readonly name = "memory";
148
- private readonly logs;
149
- private readonly maxSize;
150
- constructor(options?: MemoryTransportOptions);
151
- log(entry: LogEntry): void;
152
- getLogs(): ReadonlyArray<LogEntry>;
153
- clear(): void;
154
- getLogsByLevel(level: LogEntry['level']): ReadonlyArray<LogEntry>;
155
- getLogsAfter(timestamp: Date): ReadonlyArray<LogEntry>;
156
- getLogsBefore(timestamp: Date): ReadonlyArray<LogEntry>;
157
- getLogsBetween(start: Date, end: Date): ReadonlyArray<LogEntry>;
158
- search(query: string | RegExp): ReadonlyArray<LogEntry>;
159
- toJSON(): string;
160
- toCSV(): string;
161
- }
162
-
163
- export declare interface MemoryTransportOptions {
164
- maxSize?: number;
165
- }
166
-
167
- export { }
@@ -1,4 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=Object.freeze({debug:0,info:1,warn:2,error:3}),u=Object.freeze({0:"debug",1:"info",2:"warn",3:"error"});class m{name="console";colorMap={info:"color: #007bff;",warn:"color: #ffc107;",error:"color: #dc3545;",debug:"color: #28a745;"};emojiMap={info:"📘",warn:"âš ī¸",error:"❌",debug:"🐛"};constructor(e={}){}log(e){const t=this.createStackTrace(),r=this.emojiMap[e.level],o=this.colorMap[e.level],i=e.prefix?`%c[${e.prefix}] ${r} ${e.message}`:`%c${r} ${e.message}`,c=[o];try{if(this.supportsGroupedLogging()){const n=console;n.groupCollapsed(i,...c);const l=this.getConsoleMethod(e.level);l(`Origin: ${t}`),l("Arguments: ",...e.args??[]),n.groupEnd()}else{const n=e.prefix?`[${e.prefix}] ${r} ${e.message}`:`${r} ${e.message}`;this.getConsoleMethod(e.level)(n,...e.args??[])}}catch{try{const n=e.prefix?`[${e.prefix}] ${e.level.toUpperCase()}: ${e.message}`:`${e.level.toUpperCase()}: ${e.message}`;console.log(n,...e.args??[])}catch{}}}createStackTrace(){const e=new Error().stack;if(!e)return"unknown location";const r=e.split(`
2
- `).find(o=>!o.includes("console-transport.ts")&&!o.includes("logger.ts")&&o.includes("at"));return r?r.trim().replace(/^at\s+/,""):"unknown location"}getConsoleMethod(e){switch(e){case"debug":return console.log;case"info":return console.info;case"warn":return console.warn;case"error":return console.error;default:return console.log}}supportsGroupedLogging(){try{return this.isTestEnvironment()?!1:typeof console.groupCollapsed=="function"&&typeof console.groupEnd=="function"}catch{return!1}}isTestEnvironment(){return typeof window<"u"&&(window.__WTR_CONFIG__!==void 0||window.__karma__!==void 0)?!0:typeof process<"u"&&process.env?process.env.NODE_ENV==="test"||process.env.JEST_WORKER_ID!==void 0||process.env.VITEST==="true":!1}}class f{name="memory";logs=[];maxSize;constructor(e={}){this.maxSize=e.maxSize??1e3}log(e){this.logs.push({...e}),this.logs.length>this.maxSize&&this.logs.shift()}getLogs(){return[...this.logs]}clear(){this.logs.length=0}getLogsByLevel(e){return this.logs.filter(t=>t.level===e)}getLogsAfter(e){return this.logs.filter(t=>t.timestamp>e)}getLogsBefore(e){return this.logs.filter(t=>t.timestamp<e)}getLogsBetween(e,t){return this.logs.filter(r=>r.timestamp>=e&&r.timestamp<=t)}search(e){const t=typeof e=="string"?new RegExp(e,"i"):e;return this.logs.filter(r=>t.test(r.message))}toJSON(){return JSON.stringify(this.logs,null,2)}toCSV(){const e=["timestamp","level","prefix","message","context"],t=this.logs.map(r=>[r.timestamp.toISOString(),r.level,r.prefix??"",r.message,JSON.stringify(r.context??{})]);return[e.join(","),...t.map(r=>r.map(o=>`"${o}"`).join(","))].join(`
3
- `)}}const p=Object.freeze(Object.defineProperty({__proto__:null,ConsoleTransport:m,MemoryTransport:f},Symbol.toStringTag,{value:"Module"}));class s{static instance;static mute=!1;prefix;enabled;level;context;transports;formatters;isRoot;constructor(e={},t=!0){if(this.prefix=e.prefix,this.enabled=e.enabled??!0,this.level=e.level??"info",this.context=e.context??{},this.transports=new Map,this.formatters=new Map,this.isRoot=t,this.isRoot){const r=new m({colors:e.colors??!0,timestamp:e.timestamp??!1});this.addTransport(r)}e.transports?.forEach(r=>this.addTransport(r)),e.formatters?.forEach(r=>this.addFormatter(r))}static getInstance(e){return s.instance??=new s(e),s.instance}static setMute(e){s.mute=e}static isMuted(){return s.mute}static exportLogs(){return s.getInstance().exportLogs()}static exportLogsCSV(){return s.getInstance().exportLogsCSV()}static getRecentErrors(e){return s.getInstance().getRecentErrors(e)}static searchLogs(e){return s.getInstance().searchLogs(e)}static clearLogs(){s.getInstance().clearLogs()}static enableMemoryLogging(e){return s.getInstance().enableMemoryLogging(e)}debug(e,...t){this.log("debug",e,...t)}info(e,...t){this.log("info",e,...t)}warn(e,...t){this.log("warn",e,...t)}error(e,...t){this.log("error",e,...t)}child(e={}){const t={prefix:e.prefix??this.prefix,enabled:e.enabled??this.enabled,level:e.level??this.level,context:{...this.context,...e.context},transports:Array.from(this.transports.values()),formatters:Array.from(this.formatters.values())};return new s(t,!1)}setLevel(e){this.level=e}getLevel(){return this.level}isEnabled(){return this.enabled&&!s.mute}setEnabled(e){this.enabled=e}addTransport(e){this.transports.set(e.name,e)}removeTransport(e){this.transports.delete(e)}addFormatter(e){this.formatters.set(e.name,e)}removeFormatter(e){this.formatters.delete(e)}getTransport(e){return this.transports.get(e)}getFormatter(e){return this.formatters.get(e)}exportLogs(){const e=this.getMemoryTransport();return e?e.toJSON():JSON.stringify({error:"No memory transport found. Logs are not being stored."})}exportLogsCSV(){const e=this.getMemoryTransport();return e?e.toCSV():"Error: No memory transport found. Logs are not being stored."}getRecentErrors(e=30){const t=this.getMemoryTransport();if(!t)return[];const r=new Date(Date.now()-e*60*1e3);return[...t.getLogsAfter(r).filter(o=>o.level==="error")]}searchLogs(e){const t=this.getMemoryTransport();return t?[...t.search(e)]:[]}clearLogs(){const e=this.getMemoryTransport();e?(e.clear(),console.log("đŸ—‘ī¸ Logger memory cleared")):console.log("â„šī¸ No memory transport found to clear")}enableMemoryLogging(e=1e3){return Promise.resolve().then(()=>p).then(({MemoryTransport:t})=>{const r=new t({maxSize:e});this.addTransport(r),console.log(`📝 Memory logging enabled (max ${e} entries)`),console.log("💡 Use logger.exportLogs() to get logs as JSON"),console.log("💡 Use logger.exportLogsCSV() to get logs as CSV"),console.log("💡 Use logger.getRecentErrors() to get recent errors"),console.log("💡 Use logger.clearLogs() to clear stored logs")})}getMemoryTransport(){return this.transports.get("memory")}log(e,t,...r){if(!this.shouldLog(e))return;let o={level:e,message:t,timestamp:new Date,context:this.context,args:r,prefix:this.prefix};for(const i of this.formatters.values())o=i.format(o);for(const i of this.transports.values())try{i.log(o)}catch(c){this.isRoot&&console.error("Logger transport error:",c)}}shouldLog(e){if(!this.isEnabled())return!1;const t=g[this.level];return g[e]>=t}}class h{name="json";seen=new WeakSet;format(e){this.seen=new WeakSet;const t={...e,timestamp:e.timestamp.toISOString(),message:this.sanitizeMessage(e.message)};return e.context&&(t.context=this.sanitizeObject(e.context)),e.args&&(t.args=e.args.map(r=>this.sanitizeValue(r))),{...e,message:JSON.stringify(t)}}sanitizeMessage(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}sanitizeValue(e){return e===void 0||e===null?null:typeof e=="function"?"[Function]":typeof e=="symbol"?e.toString():e instanceof Error?{name:e.name,message:e.message,stack:e.stack}:typeof e=="object"?this.sanitizeObject(e):e}sanitizeObject(e){if(this.seen.has(e))return{"[Circular]":!0};this.seen.add(e);const t={};for(const[r,o]of Object.entries(e))try{t[r]=this.sanitizeValue(o)}catch{t[r]="[Unserializable]"}return t}}class d{name="context";includeContext;contextPrefix;constructor(e={}){this.includeContext=e.includeContext??!0,this.contextPrefix=e.contextPrefix??" "}format(e){if(!this.includeContext||!e.context||Object.keys(e.context).length===0)return e;const t=this.formatContext(e.context);return{...e,message:`${e.message}${this.contextPrefix}${t}`}}formatContext(e){return`{${Object.entries(e).map(([r,o])=>`${r}=${this.formatValue(o)}`).join(" ")}}`}formatValue(e){return e===null?"null":e===void 0?"undefined":typeof e=="string"?`"${e}"`:typeof e=="number"||typeof e=="boolean"?String(e):e instanceof Date?e.toISOString():e instanceof Error?`Error(${e.message})`:Array.isArray(e)?`[${e.length}]`:typeof e=="object"?"{...}":JSON.stringify(e)??"unknown"}}const x=s.getInstance(),b=s.enableMemoryLogging.bind(s);exports.ConsoleTransport=m;exports.ContextFormatter=d;exports.JSONFormatter=h;exports.LOG_LEVELS=g;exports.LOG_LEVEL_NAMES=u;exports.Logger=s;exports.MemoryTransport=f;exports.enableMemoryLogging=b;exports.logger=x;
4
- //# sourceMappingURL=virtualdisplay.logger.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"virtualdisplay.logger.cjs.js","sources":["../src/types.ts","../src/transports/console-transport.ts","../src/transports/memory-transport.ts","../src/logger.ts","../src/formatters/json-formatter.ts","../src/formatters/context-formatter.ts","../src/index.ts"],"sourcesContent":["export type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\nexport type LogLevelValue = 0 | 1 | 2 | 3;\n\nexport interface LoggerOptions {\n prefix?: string;\n enabled?: boolean;\n level?: LogLevel;\n timestamp?: boolean;\n colors?: boolean;\n context?: Record<string, unknown>;\n transports?: LogTransport[];\n formatters?: LogFormatter[];\n}\n\nexport interface LogEntry {\n level: LogLevel;\n message: string;\n timestamp: Date;\n context?: Record<string, unknown>;\n args?: unknown[];\n prefix?: string;\n}\n\nexport interface LogTransport {\n name: string;\n log(entry: LogEntry): void | Promise<void>;\n}\n\nexport interface LogFormatter {\n name: string;\n format(entry: LogEntry): LogEntry;\n}\n\nexport interface Logger {\n debug(message: string, ...args: unknown[]): void;\n info(message: string, ...args: unknown[]): void;\n warn(message: string, ...args: unknown[]): void;\n error(message: string, ...args: unknown[]): void;\n child(options?: Partial<LoggerOptions>): Logger;\n setLevel(level: LogLevel): void;\n getLevel(): LogLevel;\n isEnabled(): boolean;\n setEnabled(enabled: boolean): void;\n addTransport(transport: LogTransport): void;\n removeTransport(name: string): void;\n addFormatter(formatter: LogFormatter): void;\n removeFormatter(name: string): void;\n}\n\nexport const LOG_LEVELS: Record<LogLevel, LogLevelValue> = Object.freeze({\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n} as const);\n\nexport const LOG_LEVEL_NAMES: Record<LogLevelValue, LogLevel> = Object.freeze({\n 0: 'debug',\n 1: 'info',\n 2: 'warn',\n 3: 'error',\n} as const);\n","import type { LogTransport, LogEntry, LogLevel } from '../types';\n\nexport interface ConsoleTransportOptions {\n colors?: boolean;\n timestamp?: boolean;\n}\n\nexport class ConsoleTransport implements LogTransport {\n public readonly name = 'console';\n\n private readonly colorMap: Record<LogLevel, string> = {\n info: 'color: #007bff;', // Blue (exactly like server logger)\n warn: 'color: #ffc107;', // Yellow\n error: 'color: #dc3545;', // Red\n debug: 'color: #28a745;', // Green\n };\n\n private readonly emojiMap: Record<LogLevel, string> = {\n info: '📘',\n warn: 'âš ī¸',\n error: '❌',\n debug: '🐛',\n };\n\n constructor(_options: ConsoleTransportOptions = {}) {\n // Options available for future use\n }\n\n public log(entry: LogEntry): void {\n const logOrigin = this.createStackTrace();\n const emoji = this.emojiMap[entry.level];\n const color = this.colorMap[entry.level];\n const formattedMessage = entry.prefix\n ? `%c[${entry.prefix}] ${emoji} ${entry.message}`\n : `%c${emoji} ${entry.message}`;\n const styles = [color];\n\n // Robust console logging with fallbacks (exactly like server logger)\n try {\n if (this.supportsGroupedLogging()) {\n // Type-safe access to console methods\n const consoleWithGrouping = console as Console & {\n groupCollapsed: (message: string, ...styles: string[]) => void;\n groupEnd: () => void;\n };\n consoleWithGrouping.groupCollapsed(formattedMessage, ...styles);\n const method = this.getConsoleMethod(entry.level);\n method(`Origin: ${logOrigin}`);\n method('Arguments: ', ...(entry.args ?? []));\n consoleWithGrouping.groupEnd();\n } else {\n // Fallback to simple logging with specific method routing\n const simpleMessage = entry.prefix\n ? `[${entry.prefix}] ${emoji} ${entry.message}`\n : `${emoji} ${entry.message}`;\n const method = this.getConsoleMethod(entry.level);\n method(simpleMessage, ...(entry.args ?? []));\n }\n } catch {\n // Ultimate fallback - basic console.log only\n try {\n const ultimateMessage = entry.prefix\n ? `[${entry.prefix}] ${entry.level.toUpperCase()}: ${entry.message}`\n : `${entry.level.toUpperCase()}: ${entry.message}`;\n console.log(ultimateMessage, ...(entry.args ?? []));\n } catch {\n // Silently fail if even console.log doesn't work\n }\n }\n }\n\n private createStackTrace(): string {\n const stack = new Error().stack;\n if (!stack) {\n return 'unknown location';\n }\n\n const stackLines = stack.split('\\n');\n const callerLine = stackLines.find(\n line =>\n !line.includes('console-transport.ts') && !line.includes('logger.ts') && line.includes('at')\n );\n\n return callerLine ? callerLine.trim().replace(/^at\\s+/, '') : 'unknown location';\n }\n\n private getConsoleMethod(level: LogLevel): (...args: unknown[]) => void {\n // Map log levels to console methods (same as server logger)\n switch (level) {\n case 'debug':\n return console.log; // Debug uses console.log like server logger\n case 'info':\n return console.info;\n case 'warn':\n return console.warn;\n case 'error':\n return console.error;\n default:\n return console.log;\n }\n }\n\n private supportsGroupedLogging(): boolean {\n try {\n // Disable grouped logging in test environments for simpler testing\n if (this.isTestEnvironment()) {\n return false;\n }\n return typeof console.groupCollapsed === 'function' && typeof console.groupEnd === 'function';\n } catch {\n return false;\n }\n }\n\n private isTestEnvironment(): boolean {\n // Check for common test runners\n if (typeof window !== 'undefined') {\n // Web Test Runner\n if ((window as unknown as { __WTR_CONFIG__?: unknown }).__WTR_CONFIG__ !== undefined) {\n return true;\n }\n // Karma\n if ((window as unknown as { __karma__?: unknown }).__karma__ !== undefined) {\n return true;\n }\n }\n\n // Node.js test environments\n if (typeof process !== 'undefined' && process.env) {\n return (\n process.env.NODE_ENV === 'test' ||\n process.env.JEST_WORKER_ID !== undefined ||\n process.env.VITEST === 'true'\n );\n }\n\n return false;\n }\n}\n","import type { LogTransport, LogEntry } from '../types';\n\nexport interface MemoryTransportOptions {\n maxSize?: number;\n}\n\nexport class MemoryTransport implements LogTransport {\n public readonly name = 'memory';\n private readonly logs: LogEntry[] = [];\n private readonly maxSize: number;\n\n constructor(options: MemoryTransportOptions = {}) {\n this.maxSize = options.maxSize ?? 1000;\n }\n\n public log(entry: LogEntry): void {\n this.logs.push({ ...entry });\n\n // Keep only the last maxSize entries\n if (this.logs.length > this.maxSize) {\n this.logs.shift();\n }\n }\n\n public getLogs(): ReadonlyArray<LogEntry> {\n return [...this.logs];\n }\n\n public clear(): void {\n this.logs.length = 0;\n }\n\n public getLogsByLevel(level: LogEntry['level']): ReadonlyArray<LogEntry> {\n return this.logs.filter(log => log.level === level);\n }\n\n public getLogsAfter(timestamp: Date): ReadonlyArray<LogEntry> {\n return this.logs.filter(log => log.timestamp > timestamp);\n }\n\n public getLogsBefore(timestamp: Date): ReadonlyArray<LogEntry> {\n return this.logs.filter(log => log.timestamp < timestamp);\n }\n\n public getLogsBetween(start: Date, end: Date): ReadonlyArray<LogEntry> {\n return this.logs.filter(log => log.timestamp >= start && log.timestamp <= end);\n }\n\n public search(query: string | RegExp): ReadonlyArray<LogEntry> {\n const regex = typeof query === 'string' ? new RegExp(query, 'i') : query;\n return this.logs.filter(log => regex.test(log.message));\n }\n\n public toJSON(): string {\n return JSON.stringify(this.logs, null, 2);\n }\n\n public toCSV(): string {\n const headers = ['timestamp', 'level', 'prefix', 'message', 'context'];\n const rows = this.logs.map(log => [\n log.timestamp.toISOString(),\n log.level,\n log.prefix ?? '',\n log.message,\n JSON.stringify(log.context ?? {}),\n ]);\n\n return [headers.join(','), ...rows.map(row => row.map(cell => `\"${cell}\"`).join(','))].join(\n '\\n'\n );\n }\n}\n","import type {\n Logger as ILogger,\n LoggerOptions,\n LogLevel,\n LogEntry,\n LogTransport,\n LogFormatter,\n} from './types';\nimport { LOG_LEVELS } from './types';\nimport { ConsoleTransport } from './transports';\n\nexport class Logger implements ILogger {\n private static instance: Logger | undefined;\n private static mute = false;\n\n private readonly prefix?: string;\n private enabled: boolean;\n private level: LogLevel;\n private readonly context: Record<string, unknown>;\n private readonly transports: Map<string, LogTransport>;\n private readonly formatters: Map<string, LogFormatter>;\n private readonly isRoot: boolean;\n\n constructor(options: LoggerOptions = {}, isRoot = true) {\n this.prefix = options.prefix;\n this.enabled = options.enabled ?? true;\n this.level = options.level ?? 'info';\n this.context = options.context ?? {};\n this.transports = new Map();\n this.formatters = new Map();\n this.isRoot = isRoot;\n\n // Initialize default transport for root logger (simplified like server logger)\n if (this.isRoot) {\n const consoleTransport = new ConsoleTransport({\n colors: options.colors ?? true,\n timestamp: options.timestamp ?? false,\n });\n this.addTransport(consoleTransport);\n }\n\n // Add custom transports and formatters\n options.transports?.forEach(transport => this.addTransport(transport));\n options.formatters?.forEach(formatter => this.addFormatter(formatter));\n }\n\n public static getInstance(options?: LoggerOptions): Logger {\n Logger.instance ??= new Logger(options);\n return Logger.instance;\n }\n\n public static setMute(mute: boolean): void {\n Logger.mute = mute;\n }\n\n public static isMuted(): boolean {\n return Logger.mute;\n }\n\n // Global debug commands - accessible as logger.exportLogs()\n public static exportLogs(): string {\n return Logger.getInstance().exportLogs();\n }\n\n public static exportLogsCSV(): string {\n return Logger.getInstance().exportLogsCSV();\n }\n\n public static getRecentErrors(minutes?: number): LogEntry[] {\n return Logger.getInstance().getRecentErrors(minutes);\n }\n\n public static searchLogs(query: string | RegExp): LogEntry[] {\n return Logger.getInstance().searchLogs(query);\n }\n\n public static clearLogs(): void {\n Logger.getInstance().clearLogs();\n }\n\n public static enableMemoryLogging(maxSize?: number): Promise<void> {\n return Logger.getInstance().enableMemoryLogging(maxSize);\n }\n\n public debug(message: string, ...args: unknown[]): void {\n this.log('debug', message, ...args);\n }\n\n public info(message: string, ...args: unknown[]): void {\n this.log('info', message, ...args);\n }\n\n public warn(message: string, ...args: unknown[]): void {\n this.log('warn', message, ...args);\n }\n\n public error(message: string, ...args: unknown[]): void {\n this.log('error', message, ...args);\n }\n\n public child(options: Partial<LoggerOptions> = {}): Logger {\n const childOptions: LoggerOptions = {\n prefix: options.prefix ?? this.prefix,\n enabled: options.enabled ?? this.enabled,\n level: options.level ?? this.level,\n context: { ...this.context, ...options.context },\n transports: Array.from(this.transports.values()),\n formatters: Array.from(this.formatters.values()),\n };\n\n return new Logger(childOptions, false);\n }\n\n public setLevel(level: LogLevel): void {\n this.level = level;\n }\n\n public getLevel(): LogLevel {\n return this.level;\n }\n\n public isEnabled(): boolean {\n return this.enabled && !Logger.mute;\n }\n\n public setEnabled(enabled: boolean): void {\n this.enabled = enabled;\n }\n\n public addTransport(transport: LogTransport): void {\n this.transports.set(transport.name, transport);\n }\n\n public removeTransport(name: string): void {\n this.transports.delete(name);\n }\n\n public addFormatter(formatter: LogFormatter): void {\n this.formatters.set(formatter.name, formatter);\n }\n\n public removeFormatter(name: string): void {\n this.formatters.delete(name);\n }\n\n public getTransport(name: string): LogTransport | undefined {\n return this.transports.get(name);\n }\n\n public getFormatter(name: string): LogFormatter | undefined {\n return this.formatters.get(name);\n }\n\n // Debug/Developer Commands - accessible via console\n public exportLogs(): string {\n const memoryTransport = this.getMemoryTransport();\n if (!memoryTransport) {\n return JSON.stringify({ error: 'No memory transport found. Logs are not being stored.' });\n }\n return memoryTransport.toJSON();\n }\n\n public exportLogsCSV(): string {\n const memoryTransport = this.getMemoryTransport();\n if (!memoryTransport) {\n return 'Error: No memory transport found. Logs are not being stored.';\n }\n return memoryTransport.toCSV();\n }\n\n public getRecentErrors(minutes = 30): LogEntry[] {\n const memoryTransport = this.getMemoryTransport();\n if (!memoryTransport) {\n return [];\n }\n const since = new Date(Date.now() - minutes * 60 * 1000);\n return [...memoryTransport.getLogsAfter(since).filter(log => log.level === 'error')];\n }\n\n public searchLogs(query: string | RegExp): LogEntry[] {\n const memoryTransport = this.getMemoryTransport();\n if (!memoryTransport) {\n return [];\n }\n return [...memoryTransport.search(query)];\n }\n\n public clearLogs(): void {\n const memoryTransport = this.getMemoryTransport();\n if (memoryTransport) {\n memoryTransport.clear();\n console.log('đŸ—‘ī¸ Logger memory cleared');\n } else {\n console.log('â„šī¸ No memory transport found to clear');\n }\n }\n\n public enableMemoryLogging(maxSize = 1000): Promise<void> {\n // Import dynamically to avoid circular dependency\n return import('./transports').then(({ MemoryTransport }) => {\n const memoryTransport = new MemoryTransport({ maxSize });\n this.addTransport(memoryTransport);\n console.log(`📝 Memory logging enabled (max ${maxSize} entries)`);\n console.log('💡 Use logger.exportLogs() to get logs as JSON');\n console.log('💡 Use logger.exportLogsCSV() to get logs as CSV');\n console.log('💡 Use logger.getRecentErrors() to get recent errors');\n console.log('💡 Use logger.clearLogs() to clear stored logs');\n });\n }\n\n private getMemoryTransport(): import('./transports').MemoryTransport | undefined {\n return this.transports.get('memory') as import('./transports').MemoryTransport | undefined;\n }\n\n private log(level: LogLevel, message: string, ...args: unknown[]): void {\n if (!this.shouldLog(level)) {\n return;\n }\n\n let entry: LogEntry = {\n level,\n message,\n timestamp: new Date(),\n context: this.context,\n args,\n prefix: this.prefix,\n };\n\n // Apply formatters\n for (const formatter of this.formatters.values()) {\n entry = formatter.format(entry);\n }\n\n // Send to transports\n for (const transport of this.transports.values()) {\n try {\n void transport.log(entry);\n } catch (error) {\n // Avoid infinite loop if transport fails\n if (this.isRoot) {\n console.error('Logger transport error:', error);\n }\n }\n }\n }\n\n private shouldLog(level: LogLevel): boolean {\n if (!this.isEnabled()) {\n return false;\n }\n\n // Simple log level check - if enabled, follow the configured level\n const currentLevelValue = LOG_LEVELS[this.level];\n const messageLevelValue = LOG_LEVELS[level];\n return messageLevelValue >= currentLevelValue;\n }\n}\n","import type { LogFormatter, LogEntry } from '../types';\n\nexport class JSONFormatter implements LogFormatter {\n public readonly name = 'json';\n private seen = new WeakSet();\n\n public format(entry: LogEntry): LogEntry {\n // Reset seen set for each format call\n this.seen = new WeakSet();\n // Create a clean JSON-serializable object\n const jsonEntry = {\n ...entry,\n timestamp: entry.timestamp.toISOString(),\n message: this.sanitizeMessage(entry.message),\n };\n\n // Ensure all values are JSON-serializable\n if (entry.context) {\n jsonEntry.context = this.sanitizeObject(entry.context);\n }\n\n if (entry.args) {\n jsonEntry.args = entry.args.map(arg => this.sanitizeValue(arg));\n }\n\n return {\n ...entry,\n message: JSON.stringify(jsonEntry),\n };\n }\n\n private sanitizeMessage(message: string): string {\n // Remove any ANSI color codes\n return message.replace(/\\x1b\\[[0-9;]*m/g, '');\n }\n\n private sanitizeValue(value: unknown): unknown {\n if (value === undefined) return null;\n if (value === null) return null;\n if (typeof value === 'function') return '[Function]';\n if (typeof value === 'symbol') return value.toString();\n if (value instanceof Error) {\n return {\n name: value.name,\n message: value.message,\n stack: value.stack,\n };\n }\n if (typeof value === 'object') {\n return this.sanitizeObject(value as Record<string, unknown>);\n }\n return value;\n }\n\n private sanitizeObject(obj: Record<string, unknown>): Record<string, unknown> {\n // Check for circular references\n if (this.seen.has(obj)) {\n return { '[Circular]': true };\n }\n this.seen.add(obj);\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n try {\n result[key] = this.sanitizeValue(value);\n } catch {\n result[key] = '[Unserializable]';\n }\n }\n\n return result;\n }\n}\n","import type { LogFormatter, LogEntry } from '../types';\n\nexport interface ContextFormatterOptions {\n includeContext?: boolean;\n contextPrefix?: string;\n}\n\nexport class ContextFormatter implements LogFormatter {\n public readonly name = 'context';\n private readonly includeContext: boolean;\n private readonly contextPrefix: string;\n\n constructor(options: ContextFormatterOptions = {}) {\n this.includeContext = options.includeContext ?? true;\n this.contextPrefix = options.contextPrefix ?? ' ';\n }\n\n public format(entry: LogEntry): LogEntry {\n if (!this.includeContext || !entry.context || Object.keys(entry.context).length === 0) {\n return entry;\n }\n\n const contextStr = this.formatContext(entry.context);\n return {\n ...entry,\n message: `${entry.message}${this.contextPrefix}${contextStr}`,\n };\n }\n\n private formatContext(context: Record<string, unknown>): string {\n const pairs = Object.entries(context)\n .map(([key, value]) => `${key}=${this.formatValue(value)}`)\n .join(' ');\n\n return `{${pairs}}`;\n }\n\n private formatValue(value: unknown): string {\n if (value === null) return 'null';\n if (value === undefined) return 'undefined';\n if (typeof value === 'string') return `\"${value}\"`;\n if (typeof value === 'number' || typeof value === 'boolean') return String(value);\n if (value instanceof Date) return value.toISOString();\n if (value instanceof Error) return `Error(${value.message})`;\n if (Array.isArray(value)) return `[${value.length}]`;\n if (typeof value === 'object') return '{...}';\n return JSON.stringify(value) ?? 'unknown';\n }\n}\n","export { Logger } from './logger';\nexport type {\n LogLevel,\n LogLevelValue,\n LoggerOptions,\n LogEntry,\n LogTransport,\n LogFormatter,\n Logger as ILogger,\n} from './types';\nexport { LOG_LEVELS, LOG_LEVEL_NAMES } from './types';\n\n// Export transports\nexport { ConsoleTransport, MemoryTransport } from './transports';\nexport type { ConsoleTransportOptions, MemoryTransportOptions } from './transports';\n\n// Export formatters\nexport { JSONFormatter, ContextFormatter } from './formatters';\nexport type { ContextFormatterOptions } from './formatters';\n\n// Create and export default logger instance\nimport { Logger } from './logger';\n\n// Create default logger instance without prefix for neutral library use\n// Users can create their own logger instances with their own prefix if needed\nexport const logger = Logger.getInstance();\n\n// Only export debug commands that developers might use from console\n// These are accessed via the logger instance: logger.exportLogs(), etc.\nexport const enableMemoryLogging = Logger.enableMemoryLogging.bind(Logger);\n"],"names":["LOG_LEVELS","LOG_LEVEL_NAMES","ConsoleTransport","_options","entry","logOrigin","emoji","color","formattedMessage","styles","consoleWithGrouping","method","simpleMessage","ultimateMessage","stack","callerLine","line","level","MemoryTransport","options","log","timestamp","start","end","query","regex","headers","rows","row","cell","Logger","isRoot","consoleTransport","transport","formatter","mute","minutes","maxSize","message","args","childOptions","enabled","name","memoryTransport","since","error","currentLevelValue","JSONFormatter","jsonEntry","arg","value","obj","result","key","ContextFormatter","contextStr","context","logger","enableMemoryLogging"],"mappings":"gFAkDa,MAAAA,EAA8C,OAAO,OAAO,CACvE,MAAO,EACP,KAAM,EACN,KAAM,EACN,MAAO,CACT,CAAU,EAEGC,EAAmD,OAAO,OAAO,CAC5E,EAAG,QACH,EAAG,OACH,EAAG,OACH,EAAG,OACL,CAAU,ECvDH,MAAMC,CAAyC,CACpC,KAAO,UAEN,SAAqC,CACpD,KAAM,kBACN,KAAM,kBACN,MAAO,kBACP,MAAO,iBACT,EAEiB,SAAqC,CACpD,KAAM,KACN,KAAM,KACN,MAAO,IACP,MAAO,IACT,EAEA,YAAYC,EAAoC,GAAI,CAAA,CAI7C,IAAIC,EAAuB,CAC1B,MAAAC,EAAY,KAAK,iBAAiB,EAClCC,EAAQ,KAAK,SAASF,EAAM,KAAK,EACjCG,EAAQ,KAAK,SAASH,EAAM,KAAK,EACjCI,EAAmBJ,EAAM,OAC3B,MAAMA,EAAM,MAAM,KAAKE,CAAK,IAAIF,EAAM,OAAO,GAC7C,KAAKE,CAAK,IAAIF,EAAM,OAAO,GACzBK,EAAS,CAACF,CAAK,EAGjB,GAAA,CACE,GAAA,KAAK,yBAA0B,CAEjC,MAAMG,EAAsB,QAIRA,EAAA,eAAeF,EAAkB,GAAGC,CAAM,EAC9D,MAAME,EAAS,KAAK,iBAAiBP,EAAM,KAAK,EACzCO,EAAA,WAAWN,CAAS,EAAE,EAC7BM,EAAO,cAAe,GAAIP,EAAM,MAAQ,CAAA,CAAG,EAC3CM,EAAoB,SAAS,CAAA,KACxB,CAEL,MAAME,EAAgBR,EAAM,OACxB,IAAIA,EAAM,MAAM,KAAKE,CAAK,IAAIF,EAAM,OAAO,GAC3C,GAAGE,CAAK,IAAIF,E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