@mks2508/better-logger 0.14.0-alpha.1 → 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.
Files changed (145) hide show
  1. package/dist/chunks/{Logger-BW-kn5_7.js → Logger-CTAaDeZi.js} +49 -366
  2. package/dist/chunks/Logger-CTAaDeZi.js.map +1 -0
  3. package/dist/chunks/Logger-D8pK7XXt.js +2 -0
  4. package/dist/chunks/Logger-D8pK7XXt.js.map +1 -0
  5. package/dist/chunks/ScopedLogger-D-7q8uVP.js +2 -0
  6. package/dist/chunks/ScopedLogger-D-7q8uVP.js.map +1 -0
  7. package/dist/chunks/ScopedLogger-hS0qSkZD.js +361 -0
  8. package/dist/chunks/ScopedLogger-hS0qSkZD.js.map +1 -0
  9. package/dist/core.js +280 -307
  10. package/dist/exports.cjs +1 -1
  11. package/dist/exports.js +1 -1
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.js +226 -159
  15. package/dist/index.js.map +1 -1
  16. package/dist/styling.cjs +1 -1
  17. package/dist/styling.js +2 -2
  18. package/dist/types/Logger.d.ts +17 -15
  19. package/dist/types/Logger.d.ts.map +1 -1
  20. package/dist/types/core.d.ts +122 -216
  21. package/dist/types/core.d.ts.map +1 -1
  22. package/dist/types/exports-module.d.ts +1 -1
  23. package/dist/types/exports-module.d.ts.map +1 -1
  24. package/dist/types/index.d.ts +119 -4
  25. package/dist/types/index.d.ts.map +1 -1
  26. package/dist/types/styling-module.d.ts +1 -1
  27. package/dist/types/styling-module.d.ts.map +1 -1
  28. package/package.json +2 -1
  29. package/src/Logger.ts +105 -58
  30. package/src/index.ts +32 -25
  31. package/dist/.tsbuildinfo +0 -1
  32. package/dist/Logger.d.ts +0 -710
  33. package/dist/Logger.d.ts.map +0 -1
  34. package/dist/Logger.js +0 -1118
  35. package/dist/ScopedLogger.d.ts +0 -318
  36. package/dist/ScopedLogger.d.ts.map +0 -1
  37. package/dist/ScopedLogger.js +0 -426
  38. package/dist/chunks/Logger-BW-kn5_7.js.map +0 -1
  39. package/dist/chunks/Logger-BpeuYIxR.js +0 -2
  40. package/dist/chunks/Logger-BpeuYIxR.js.map +0 -1
  41. package/dist/cli/CommandProcessor.d.ts +0 -103
  42. package/dist/cli/CommandProcessor.d.ts.map +0 -1
  43. package/dist/cli/CommandProcessor.js +0 -184
  44. package/dist/cli/commands/ConfigCommand.d.ts +0 -17
  45. package/dist/cli/commands/ConfigCommand.d.ts.map +0 -1
  46. package/dist/cli/commands/ConfigCommand.js +0 -88
  47. package/dist/cli/commands/ExportCommand.d.ts +0 -51
  48. package/dist/cli/commands/ExportCommand.d.ts.map +0 -1
  49. package/dist/cli/commands/ExportCommand.js +0 -243
  50. package/dist/cli/commands/HistoryCommand.d.ts +0 -50
  51. package/dist/cli/commands/HistoryCommand.d.ts.map +0 -1
  52. package/dist/cli/commands/HistoryCommand.js +0 -96
  53. package/dist/cli/commands/StatusCommand.d.ts +0 -33
  54. package/dist/cli/commands/StatusCommand.d.ts.map +0 -1
  55. package/dist/cli/commands/StatusCommand.js +0 -93
  56. package/dist/cli/commands/ThemeCommand.d.ts +0 -33
  57. package/dist/cli/commands/ThemeCommand.d.ts.map +0 -1
  58. package/dist/cli/commands/ThemeCommand.js +0 -79
  59. package/dist/cli/help.d.ts +0 -15
  60. package/dist/cli/help.d.ts.map +0 -1
  61. package/dist/cli/help.js +0 -118
  62. package/dist/cli/index.d.ts +0 -15
  63. package/dist/cli/index.d.ts.map +0 -1
  64. package/dist/cli/index.js +0 -46
  65. package/dist/constants.d.ts +0 -122
  66. package/dist/constants.d.ts.map +0 -1
  67. package/dist/constants.js +0 -159
  68. package/dist/core.d.ts +0 -134
  69. package/dist/core.d.ts.map +0 -1
  70. package/dist/example.d.ts +0 -18
  71. package/dist/example.d.ts.map +0 -1
  72. package/dist/example.js +0 -154
  73. package/dist/exports-module.d.ts +0 -203
  74. package/dist/exports-module.d.ts.map +0 -1
  75. package/dist/exports-module.js +0 -260
  76. package/dist/handlers/AnalyticsLogHandler.d.ts +0 -11
  77. package/dist/handlers/AnalyticsLogHandler.d.ts.map +0 -1
  78. package/dist/handlers/AnalyticsLogHandler.js +0 -19
  79. package/dist/handlers/ExportLogHandler.d.ts +0 -103
  80. package/dist/handlers/ExportLogHandler.d.ts.map +0 -1
  81. package/dist/handlers/ExportLogHandler.js +0 -516
  82. package/dist/handlers/FileLogHandler.d.ts +0 -36
  83. package/dist/handlers/FileLogHandler.d.ts.map +0 -1
  84. package/dist/handlers/FileLogHandler.js +0 -156
  85. package/dist/handlers/RemoteLogHandler.d.ts +0 -14
  86. package/dist/handlers/RemoteLogHandler.d.ts.map +0 -1
  87. package/dist/handlers/RemoteLogHandler.js +0 -37
  88. package/dist/handlers/index.d.ts +0 -8
  89. package/dist/handlers/index.d.ts.map +0 -1
  90. package/dist/handlers/index.js +0 -7
  91. package/dist/index.d.ts +0 -157
  92. package/dist/index.d.ts.map +0 -1
  93. package/dist/main.d.ts +0 -2
  94. package/dist/main.d.ts.map +0 -1
  95. package/dist/main.js +0 -139
  96. package/dist/styling/LogStyleBuilder.d.ts +0 -149
  97. package/dist/styling/LogStyleBuilder.d.ts.map +0 -1
  98. package/dist/styling/LogStyleBuilder.js +0 -289
  99. package/dist/styling/SemanticStyles.d.ts +0 -181
  100. package/dist/styling/SemanticStyles.d.ts.map +0 -1
  101. package/dist/styling/SemanticStyles.js +0 -339
  102. package/dist/styling/SmartPresets.d.ts +0 -25
  103. package/dist/styling/SmartPresets.d.ts.map +0 -1
  104. package/dist/styling/SmartPresets.js +0 -276
  105. package/dist/styling/StyleBuilder.d.ts +0 -140
  106. package/dist/styling/StyleBuilder.d.ts.map +0 -1
  107. package/dist/styling/StyleBuilder.js +0 -280
  108. package/dist/styling/banners.d.ts +0 -45
  109. package/dist/styling/banners.d.ts.map +0 -1
  110. package/dist/styling/banners.js +0 -155
  111. package/dist/styling/index.d.ts +0 -10
  112. package/dist/styling/index.d.ts.map +0 -1
  113. package/dist/styling/index.js +0 -9
  114. package/dist/styling/themes.d.ts +0 -10
  115. package/dist/styling/themes.d.ts.map +0 -1
  116. package/dist/styling/themes.js +0 -231
  117. package/dist/styling-module.d.ts +0 -185
  118. package/dist/styling-module.d.ts.map +0 -1
  119. package/dist/styling-module.js +0 -199
  120. package/dist/types/core.js +0 -28
  121. package/dist/types/handlers.d.ts +0 -88
  122. package/dist/types/handlers.d.ts.map +0 -1
  123. package/dist/types/handlers.js +0 -4
  124. package/dist/types/index.js +0 -4
  125. package/dist/utils/environment.d.ts +0 -47
  126. package/dist/utils/environment.d.ts.map +0 -1
  127. package/dist/utils/environment.js +0 -85
  128. package/dist/utils/formatting.d.ts +0 -40
  129. package/dist/utils/formatting.d.ts.map +0 -1
  130. package/dist/utils/formatting.js +0 -117
  131. package/dist/utils/index.d.ts +0 -7
  132. package/dist/utils/index.d.ts.map +0 -1
  133. package/dist/utils/index.js +0 -6
  134. package/dist/utils/opentui-detection.d.ts +0 -34
  135. package/dist/utils/opentui-detection.d.ts.map +0 -1
  136. package/dist/utils/opentui-detection.js +0 -116
  137. package/dist/utils/output.d.ts +0 -44
  138. package/dist/utils/output.d.ts.map +0 -1
  139. package/dist/utils/output.js +0 -150
  140. package/dist/utils/stackTrace.d.ts +0 -9
  141. package/dist/utils/stackTrace.d.ts.map +0 -1
  142. package/dist/utils/stackTrace.js +0 -81
  143. package/dist/utils/timestamps.d.ts +0 -20
  144. package/dist/utils/timestamps.d.ts.map +0 -1
  145. package/dist/utils/timestamps.js +0 -71
package/dist/Logger.js DELETED
@@ -1,1118 +0,0 @@
1
- /**
2
- * @fileoverview Logger avanzado con arquitectura modular y API simplificada
3
- * @version 0.3.0
4
- * @since 2024
5
- *
6
- * Sistema de logging profesional con estilos CSS avanzados, temas adaptativos,
7
- * badges automáticos, contextos temporales y exportación de datos.
8
- */
9
- // Utility imports
10
- import { parseStackTrace, formatTimestamp, createStyledOutput, setupThemeChangeListener } from './utils/index.js';
11
- // Styling imports
12
- import { THEME_PRESETS, THEME_BANNERS, displayInitBanner, StylePresets, StyleBuilder } from './styling/index.js';
13
- // Smart presets and scoped loggers
14
- import { getSmartPreset, getAvailablePresets, hasPreset } from './styling/SmartPresets.js';
15
- import { ScopedLogger, APILogger, ComponentLogger } from './ScopedLogger.js';
16
- import { createLogStyleBuilder } from './styling/LogStyleBuilder.js';
17
- // Handler imports
18
- import { ExportLogHandler } from './handlers/index.js';
19
- // CLI imports
20
- import { createDefaultCLI } from './cli/index.js';
21
- // Constants
22
- import { DEFAULT_CONFIG } from './constants.js';
23
- /**
24
- * Estilos del tema activo actual
25
- * @private
26
- */
27
- let LEVEL_STYLES = THEME_PRESETS.default;
28
- /**
29
- * Clase principal Logger con capacidades avanzadas de logging
30
- *
31
- * @class Logger
32
- * @description Sistema completo de logging con temas, badges, contextos y exportación.
33
- * Detecta automáticamente el tema claro/oscuro del navegador.
34
- *
35
- * @example
36
- * // Uso básico sin configuración
37
- * import logger from '@mks2508/better-logger';
38
- * logger.info('Aplicación iniciada');
39
- * logger.success('Conexión establecida');
40
- *
41
- * @example
42
- * // Aplicar un preset temático
43
- * logger.preset('cyberpunk');
44
- * logger.warn('Advertencia con estilo neón');
45
- *
46
- * @example
47
- * // Logger con scope para componentes
48
- * const auth = logger.component('Autenticación');
49
- * auth.info('Usuario intentando login');
50
- * auth.success('Login exitoso');
51
- *
52
- * @since 0.3.0
53
- */
54
- export class Logger {
55
- config;
56
- scopedPrefix;
57
- handlers = [];
58
- timers = new Map();
59
- groupDepth = 0;
60
- exportHandler;
61
- cliProcessor;
62
- themeChangeListener;
63
- displaySettings = {
64
- showTimestamp: true,
65
- showLocation: true,
66
- showBadges: true
67
- };
68
- /**
69
- * Crea una nueva instancia del Logger
70
- *
71
- * @param {Partial<LoggerConfig>} config - Configuración opcional del logger
72
- *
73
- * @example
74
- * // Logger con configuración personalizada
75
- * const logger = new Logger({
76
- * theme: 'neon',
77
- * globalPrefix: 'MiApp',
78
- * verbosity: 'debug',
79
- * bufferSize: 1000
80
- * });
81
- */
82
- constructor(config = {}) {
83
- this.config = {
84
- ...DEFAULT_CONFIG,
85
- ...config,
86
- };
87
- // Initialize export handler if buffer size is specified
88
- if (this.config.bufferSize) {
89
- this.exportHandler = new ExportLogHandler(this.config.bufferSize);
90
- this.handlers.push(this.exportHandler);
91
- }
92
- // Initialize CLI processor
93
- this.cliProcessor = createDefaultCLI();
94
- // Set up theme change listener if auto-detection is enabled
95
- if (this.config.autoDetectTheme) {
96
- this.setupAutoThemeDetection();
97
- }
98
- }
99
- // ===== PRIVATE HELPER METHODS =====
100
- /**
101
- * Configura la detección automática de tema con listener de cambios
102
- * @private
103
- * @description Detecta automáticamente si el navegador está en modo claro u oscuro
104
- */
105
- setupAutoThemeDetection() {
106
- // Clean up existing listener if any
107
- if (this.themeChangeListener) {
108
- this.themeChangeListener();
109
- this.themeChangeListener = null;
110
- }
111
- // Set up new listener
112
- this.themeChangeListener = setupThemeChangeListener((theme) => {
113
- // Theme changed - logs will automatically use new colors on next call
114
- // No need to update anything as colors are resolved dynamically
115
- this.debug(`DevTools theme changed to: ${theme}`);
116
- });
117
- }
118
- // ===== CONFIGURATION METHODS =====
119
- /**
120
- * Obtiene la configuración actual del logger
121
- *
122
- * @returns {LoggerConfig} Configuración completa actual
123
- *
124
- * @example
125
- * const config = logger.getConfig();
126
- * console.log('Verbosidad actual:', config.verbosity);
127
- * console.log('Tema actual:', config.theme);
128
- *
129
- * @since 0.3.0
130
- */
131
- getConfig() {
132
- return { ...this.config };
133
- }
134
- /**
135
- * Actualiza la configuración del logger
136
- *
137
- * @param {Partial<LoggerConfig>} updates - Propiedades a actualizar
138
- *
139
- * @example
140
- * logger.updateConfig({
141
- * verbosity: 'debug',
142
- * enableTimestamps: false,
143
- * theme: 'cyberpunk'
144
- * });
145
- *
146
- * @since 0.3.0
147
- */
148
- updateConfig(updates) {
149
- const previousAutoDetect = this.config.autoDetectTheme;
150
- this.config = { ...this.config, ...updates };
151
- // Handle auto-detection changes
152
- if (updates.autoDetectTheme !== undefined && updates.autoDetectTheme !== previousAutoDetect) {
153
- if (updates.autoDetectTheme) {
154
- this.setupAutoThemeDetection();
155
- }
156
- else if (this.themeChangeListener) {
157
- this.themeChangeListener();
158
- this.themeChangeListener = null;
159
- }
160
- }
161
- }
162
- /**
163
- * Establece el prefijo global para todos los mensajes de log
164
- *
165
- * @param {string} prefix - Prefijo a usar
166
- *
167
- * @example
168
- * logger.setGlobalPrefix('MiApp');
169
- * logger.info('Iniciado'); // [MiApp] Iniciado
170
- *
171
- * @since 0.3.0
172
- */
173
- setGlobalPrefix(prefix) {
174
- this.config.globalPrefix = prefix;
175
- }
176
- /**
177
- * Establece el nivel de verbosidad para filtrar la salida de logs
178
- *
179
- * @param {Verbosity} level - Nivel mínimo a mostrar ('debug' | 'info' | 'warn' | 'error' | 'critical' | 'silent')
180
- *
181
- * @example
182
- * logger.setVerbosity('warn'); // Solo muestra warn, error y critical
183
- * logger.setVerbosity('debug'); // Muestra todos los niveles
184
- * logger.setVerbosity('silent'); // No muestra nada
185
- *
186
- * @since 0.3.0
187
- */
188
- setVerbosity(level) {
189
- this.config.verbosity = level;
190
- }
191
- /**
192
- * Establece el tema del logger
193
- *
194
- * @param {ThemeVariant} theme - Tema a aplicar ('default' | 'dark' | 'light' | 'neon' | 'minimal' | 'cyberpunk')
195
- *
196
- * @example
197
- * logger.setTheme('neon'); // Tema con colores neón
198
- * logger.setTheme('minimal'); // Tema minimalista
199
- * logger.setTheme('cyberpunk'); // Tema cyberpunk con efectos
200
- *
201
- * @since 0.3.0
202
- */
203
- setTheme(theme) {
204
- // First check if it's a smart preset
205
- if (hasPreset(theme)) {
206
- this.preset(theme);
207
- return;
208
- }
209
- // Fallback to old theme system
210
- if (theme in THEME_PRESETS) {
211
- LEVEL_STYLES = THEME_PRESETS[theme];
212
- this.config.theme = theme;
213
- // Show theme-specific banner
214
- if (theme in THEME_BANNERS) {
215
- const themeBanner = THEME_BANNERS[theme];
216
- console.log(`%c${themeBanner.simple}`, themeBanner.style);
217
- }
218
- this.success(`Theme changed to: ${theme}`);
219
- }
220
- else {
221
- this.error(`Invalid theme: ${theme}. Available:`, [...getAvailablePresets(), ...Object.keys(THEME_PRESETS)]);
222
- }
223
- }
224
- /**
225
- * Establece el tipo de banner para mostrar en la inicialización
226
- *
227
- * @param {BannerType} bannerType - Tipo de banner ('simple' | 'ascii' | 'unicode' | 'svg' | 'animated')
228
- *
229
- * @example
230
- * logger.setBannerType('ascii'); // Banner con arte ASCII
231
- * logger.setBannerType('unicode'); // Banner con caracteres Unicode
232
- * logger.setBannerType('animated'); // Banner con animación
233
- *
234
- * @since 0.3.0
235
- */
236
- setBannerType(bannerType) {
237
- this.config.bannerType = bannerType;
238
- this.success(`Banner type changed to: ${bannerType}`);
239
- }
240
- /**
241
- * Reinicia el logger a la configuración por defecto
242
- *
243
- * @example
244
- * logger.resetConfig();
245
- * // Todo vuelve a la configuración inicial
246
- *
247
- * @since 0.3.0
248
- */
249
- resetConfig() {
250
- // Clean up theme listener
251
- if (this.themeChangeListener) {
252
- this.themeChangeListener();
253
- this.themeChangeListener = null;
254
- }
255
- this.config = { ...DEFAULT_CONFIG };
256
- LEVEL_STYLES = THEME_PRESETS.default;
257
- // Re-setup auto theme detection if enabled in default config
258
- if (this.config.autoDetectTheme) {
259
- this.setupAutoThemeDetection();
260
- }
261
- this.success('Logger configuration reset to defaults');
262
- }
263
- /**
264
- * Método de limpieza para eliminar listeners y liberar recursos
265
- *
266
- * @example
267
- * // Antes de cerrar la aplicación
268
- * logger.cleanup();
269
- *
270
- * @since 0.3.0
271
- */
272
- cleanup() {
273
- if (this.themeChangeListener) {
274
- this.themeChangeListener();
275
- this.themeChangeListener = null;
276
- }
277
- }
278
- // ===== SIMPLIFIED API =====
279
- /**
280
- * Aplica un preset inteligente - funciona perfectamente sin configuración
281
- *
282
- * @param {string} name - Nombre del preset a aplicar
283
- *
284
- * @example
285
- * // Presets disponibles
286
- * logger.preset('default'); // Limpio y adaptativo
287
- * logger.preset('cyberpunk'); // Colores neón, efectos brillantes
288
- * logger.preset('glassmorphism'); // Efectos de blur modernos
289
- * logger.preset('minimal'); // Minimalista y elegante
290
- * logger.preset('debug'); // Modo desarrollo detallado
291
- * logger.preset('production'); // Optimizado para producción
292
- *
293
- * @since 0.3.0
294
- */
295
- preset(name) {
296
- if (!hasPreset(name)) {
297
- this.error(`Unknown preset: ${name}. Available presets:`, getAvailablePresets());
298
- return;
299
- }
300
- const presetConfig = getSmartPreset(name);
301
- if (presetConfig) {
302
- // Apply the smart preset configuration
303
- this.displaySettings.showTimestamp = presetConfig.timestamp?.show ?? true;
304
- this.displaySettings.showLocation = presetConfig.location?.show ?? true;
305
- // Store the preset config for use in createStyledOutput
306
- this._activePreset = presetConfig;
307
- this._activePresetName = name;
308
- this.success(`Applied preset: ${name}`);
309
- }
310
- }
311
- /**
312
- * Lista todos los presets disponibles
313
- *
314
- * @returns {string[]} Array con nombres de presets disponibles
315
- *
316
- * @example
317
- * const disponibles = logger.presets();
318
- * console.log(disponibles); // ['default', 'cyberpunk', 'glassmorphism', ...]
319
- *
320
- * @since 0.3.0
321
- */
322
- presets() {
323
- return getAvailablePresets();
324
- }
325
- // ===== TOGGLE METHODS =====
326
- /**
327
- * Oculta el timestamp en los logs
328
- *
329
- * @example
330
- * logger.hideTimestamp();
331
- * logger.info('Sin marca de tiempo'); // Sin timestamp visible
332
- *
333
- * @since 0.3.0
334
- */
335
- hideTimestamp() {
336
- this.displaySettings.showTimestamp = false;
337
- this.success('Timestamp hidden');
338
- }
339
- /**
340
- * Muestra el timestamp en los logs
341
- *
342
- * @example
343
- * logger.showTimestamp();
344
- * logger.info('Con marca de tiempo'); // [2024-01-15 10:30:45] Con marca de tiempo
345
- *
346
- * @since 0.3.0
347
- */
348
- showTimestamp() {
349
- this.displaySettings.showTimestamp = true;
350
- this.success('Timestamp shown');
351
- }
352
- /**
353
- * Oculta la información de ubicación (archivo:línea) en los logs
354
- *
355
- * @example
356
- * logger.hideLocation();
357
- * logger.debug('Sin ubicación'); // Sin mostrar archivo:línea
358
- *
359
- * @since 0.3.0
360
- */
361
- hideLocation() {
362
- this.displaySettings.showLocation = false;
363
- this.success('Location info hidden');
364
- }
365
- /**
366
- * Muestra la información de ubicación (archivo:línea) en los logs
367
- *
368
- * @example
369
- * logger.showLocation();
370
- * logger.debug('Con ubicación'); // app.js:42 Con ubicación
371
- *
372
- * @since 0.3.0
373
- */
374
- showLocation() {
375
- this.displaySettings.showLocation = true;
376
- this.success('Location info shown');
377
- }
378
- /**
379
- * Oculta los badges en los logs
380
- *
381
- * @example
382
- * logger.hideBadges();
383
- * const api = logger.api('REST');
384
- * api.info('Sin badges'); // Sin mostrar [API] [REST]
385
- *
386
- * @since 0.3.0
387
- */
388
- hideBadges() {
389
- this.displaySettings.showBadges = false;
390
- this.success('Badges hidden');
391
- }
392
- /**
393
- * Muestra los badges en los logs
394
- *
395
- * @example
396
- * logger.showBadges();
397
- * const api = logger.api('GraphQL');
398
- * api.info('Con badges'); // [API] [GraphQL] Con badges
399
- *
400
- * @since 0.3.0
401
- */
402
- showBadges() {
403
- this.displaySettings.showBadges = true;
404
- this.success('Badges shown');
405
- }
406
- // ===== SCOPED LOGGERS =====
407
- /**
408
- * Crea un logger para componentes con estilo automático
409
- *
410
- * @param {string} name - Nombre del componente
411
- * @returns {ComponentLogger} Logger con scope de componente
412
- *
413
- * @example
414
- * const authLogger = logger.component('Autenticación');
415
- * authLogger.info('Validando credenciales');
416
- * // [COMPONENT] [Autenticación] Validando credenciales
417
- *
418
- * authLogger.success('Usuario autenticado');
419
- * // [COMPONENT] [Autenticación] ✓ Usuario autenticado
420
- *
421
- * @since 0.3.0
422
- */
423
- component(name) {
424
- return new ComponentLogger(this, name);
425
- }
426
- /**
427
- * Crea un logger para APIs con badges automáticos
428
- *
429
- * @param {string} name - Nombre de la API o endpoint
430
- * @returns {APILogger} Logger con scope de API
431
- *
432
- * @example
433
- * const api = logger.api('REST');
434
- * api.info('GET /users');
435
- * // [API] [REST] GET /users
436
- *
437
- * // Con badges adicionales
438
- * api.badges(['v2', 'cached']).info('Respuesta desde caché');
439
- * // [API] [v2] [cached] [REST] Respuesta desde caché
440
- *
441
- * @since 0.3.0
442
- */
443
- api(name) {
444
- return new APILogger(this, name);
445
- }
446
- /**
447
- * Crea un logger con scope general y soporte de badges
448
- *
449
- * @param {string} name - Nombre del scope
450
- * @returns {ScopedLogger} Logger con scope personalizado
451
- *
452
- * @example
453
- * const dbLogger = logger.scope('Database');
454
- * dbLogger.info('Conectando a MongoDB');
455
- * // [Database] Conectando a MongoDB
456
- *
457
- * // Con badges personalizados
458
- * dbLogger.badge('SLOW').warn('Query tardó 5s');
459
- * // [SLOW] [Database] Query tardó 5s
460
- *
461
- * @since 0.3.0
462
- */
463
- scope(name) {
464
- return new ScopedLogger(this, name);
465
- }
466
- // ===== SIMPLE CUSTOMIZATION =====
467
- /**
468
- * Personalización simple con configuración mínima
469
- *
470
- * @param {Object} overrides - Opciones de personalización
471
- * @param {Object} overrides.message - Configuración del mensaje
472
- * @param {Object} overrides.timestamp - Configuración del timestamp
473
- * @param {Object} overrides.location - Configuración de ubicación
474
- * @param {Object} overrides.level - Configuración del nivel
475
- * @param {Object} overrides.prefix - Configuración del prefijo
476
- * @param {string} overrides.spacing - Espaciado: 'compact' | 'normal' | 'spacious'
477
- *
478
- * @example
479
- * logger.customize({
480
- * message: { color: '#00ff00', size: '16px' },
481
- * timestamp: { show: false },
482
- * spacing: 'compact'
483
- * });
484
- *
485
- * @since 0.3.0
486
- */
487
- customize(overrides) {
488
- // Apply simple overrides
489
- if (overrides.timestamp?.show !== undefined) {
490
- this.displaySettings.showTimestamp = overrides.timestamp.show;
491
- }
492
- if (overrides.location?.show !== undefined) {
493
- this.displaySettings.showLocation = overrides.location.show;
494
- }
495
- if (overrides.prefix?.show !== undefined) {
496
- // Will be handled when we integrate with preset system
497
- }
498
- // Store customization for use in createStyledOutput
499
- this._customization = overrides;
500
- this.success('Customization applied');
501
- }
502
- /**
503
- * Access advanced styling API (for power users)
504
- */
505
- styles() {
506
- return createLogStyleBuilder(this);
507
- }
508
- // ===== HANDLER MANAGEMENT =====
509
- /**
510
- * Añade un handler personalizado para extender funcionalidad
511
- *
512
- * @param {ILogHandler} handler - Handler que implementa ILogHandler
513
- *
514
- * @example
515
- * // Handler personalizado para enviar logs a servidor
516
- * const remoteHandler = new RemoteLogHandler('https://api.ejemplo.com/logs');
517
- * logger.addHandler(remoteHandler);
518
- *
519
- * @example
520
- * // Handler para guardar en archivo
521
- * const fileHandler = new FileLogHandler('./app.log');
522
- * logger.addHandler(fileHandler);
523
- *
524
- * @since 0.3.0
525
- */
526
- addHandler(handler) {
527
- this.handlers.push(handler);
528
- }
529
- /**
530
- * Obtiene todos los handlers registrados
531
- *
532
- * @returns {ILogHandler[]} Array de handlers activos
533
- * @since 0.3.0
534
- */
535
- getHandlers() {
536
- return [...this.handlers];
537
- }
538
- /**
539
- * Obtiene el handler de exportación si está disponible
540
- *
541
- * @returns {ExportLogHandler | undefined} Handler de exportación o undefined
542
- * @since 0.3.0
543
- */
544
- getExportHandler() {
545
- return this.exportHandler;
546
- }
547
- // ===== CORE LOGGING METHODS =====
548
- /**
549
- * Verifica si un nivel de log debe mostrarse según la verbosidad actual
550
- * @private
551
- * @param {LogLevel} level - Nivel de log a verificar
552
- * @returns {boolean} True si debe mostrarse, false si no
553
- */
554
- shouldLog(level) {
555
- if (this.config.verbosity === 'silent')
556
- return false;
557
- const levels = { debug: 0, info: 1, warn: 2, error: 3, critical: 4 };
558
- return levels[level] >= levels[this.config.verbosity];
559
- }
560
- /**
561
- * Obtiene el prefijo efectivo (global + scope)
562
- * @private
563
- * @returns {string | undefined} Prefijo combinado o undefined
564
- */
565
- getEffectivePrefix() {
566
- const parts = [this.config.globalPrefix, this.scopedPrefix].filter(Boolean);
567
- return parts.length > 0 ? parts.join(':') : undefined;
568
- }
569
- /**
570
- * Método central de logging que maneja estilos y formato
571
- * @protected
572
- * @param {LogLevel} level - Nivel del log
573
- * @param {...any} args - Argumentos a loggear
574
- */
575
- log(level, ...args) {
576
- if (!this.shouldLog(level))
577
- return;
578
- const stackInfo = this.config.enableStackTrace ? parseStackTrace() : null;
579
- const prefix = this.getEffectivePrefix();
580
- const message = args.length > 0 ? String(args[0]) : '';
581
- const additionalArgs = args.slice(1);
582
- // Create styled output with theme detection and display settings
583
- const [format, ...styles] = createStyledOutput(level, LEVEL_STYLES, prefix, message, this.displaySettings.showLocation ? stackInfo : null, this.config.autoDetectTheme);
584
- // Add group indentation
585
- const groupIndent = ' '.repeat(this.groupDepth);
586
- const finalFormat = groupIndent + format;
587
- // Output to console
588
- if (additionalArgs.length > 0) {
589
- console.log(finalFormat, ...styles, ...additionalArgs);
590
- }
591
- else {
592
- console.log(finalFormat, ...styles);
593
- }
594
- // Update export handler group info
595
- if (this.exportHandler) {
596
- this.exportHandler.setGroupInfo(this.groupDepth);
597
- }
598
- // Call custom handlers
599
- const metadata = {
600
- timestamp: formatTimestamp(),
601
- level,
602
- prefix,
603
- stackInfo: stackInfo ? stackInfo : undefined,
604
- };
605
- this.handlers.forEach(handler => {
606
- try {
607
- handler.handle(level, message, args, metadata);
608
- }
609
- catch (error) {
610
- console.error('Log handler failed:', error);
611
- }
612
- });
613
- }
614
- /**
615
- * Registra información de debug (prioridad más baja)
616
- *
617
- * @param {...any} args - Mensajes y datos a loggear
618
- *
619
- * @example
620
- * logger.debug('Variable estado:', { usuario: 'Juan', activo: true });
621
- * logger.debug('Iniciando proceso de validación');
622
- *
623
- * @since 0.3.0
624
- */
625
- debug(...args) {
626
- this.log('debug', ...args);
627
- }
628
- /**
629
- * Registra mensajes informativos
630
- *
631
- * @param {...any} args - Mensajes y datos informativos
632
- *
633
- * @example
634
- * logger.info('Servidor iniciado en puerto 3000');
635
- * logger.info('Usuario conectado:', userId);
636
- * logger.info('Procesando', totalItems, 'elementos');
637
- *
638
- * @since 0.3.0
639
- */
640
- info(...args) {
641
- this.log('info', ...args);
642
- }
643
- /**
644
- * Registra mensajes de advertencia
645
- *
646
- * @param {...any} args - Mensajes de advertencia
647
- *
648
- * @example
649
- * logger.warn('Memoria al 85% de capacidad');
650
- * logger.warn('API deprecada, usar v2');
651
- * logger.warn('Reintentos agotados:', maxRetries);
652
- *
653
- * @since 0.3.0
654
- */
655
- warn(...args) {
656
- this.log('warn', ...args);
657
- }
658
- /**
659
- * Registra mensajes de error
660
- *
661
- * @param {...any} args - Mensajes de error y stack traces
662
- *
663
- * @example
664
- * logger.error('Fallo en conexión a base de datos');
665
- * logger.error('Error al procesar:', error.message, error.stack);
666
- * logger.error('Código de error:', errorCode);
667
- *
668
- * @since 0.3.0
669
- */
670
- error(...args) {
671
- this.log('error', ...args);
672
- }
673
- /**
674
- * Registra mensajes de éxito (nivel info especial)
675
- *
676
- * @param {...any} args - Mensajes de operaciones exitosas
677
- *
678
- * @example
679
- * logger.success('Base de datos conectada');
680
- * logger.success('Usuario creado con ID:', userId);
681
- * logger.success('✓ Tests pasados: 42/42');
682
- *
683
- * @since 0.3.0
684
- */
685
- success(...args) {
686
- if (!this.shouldLog('info'))
687
- return;
688
- const stackInfo = this.config.enableStackTrace ? parseStackTrace() : null;
689
- const prefix = this.getEffectivePrefix();
690
- const message = args.length > 0 ? String(args[0]) : '';
691
- const additionalArgs = args.slice(1);
692
- // Handle success as special case - use info level with success styling
693
- const [format, ...styles] = createStyledOutput('info', LEVEL_STYLES, prefix, message, this.displaySettings.showLocation ? stackInfo : null, this.config.autoDetectTheme);
694
- // Override with success styling
695
- const successStyle = LEVEL_STYLES.success;
696
- let emoji = '✅';
697
- let label = 'SUCCESS';
698
- if (successStyle) {
699
- if (successStyle.emoji) {
700
- emoji = successStyle.emoji;
701
- }
702
- if (successStyle.label) {
703
- label = successStyle.label;
704
- }
705
- }
706
- const successFormat = format.replace(/ℹ️ INFO/, `${emoji} ${label}`);
707
- const groupIndent = ' '.repeat(this.groupDepth);
708
- const finalFormat = groupIndent + successFormat;
709
- if (additionalArgs.length > 0) {
710
- console.log(finalFormat, ...styles, ...additionalArgs);
711
- }
712
- else {
713
- console.log(finalFormat, ...styles);
714
- }
715
- // Call handlers
716
- const metadata = {
717
- timestamp: formatTimestamp(),
718
- level: 'info',
719
- prefix,
720
- stackInfo: stackInfo ? stackInfo : undefined,
721
- };
722
- this.handlers.forEach(handler => {
723
- try {
724
- handler.handle('info', message, args, metadata);
725
- }
726
- catch (error) {
727
- console.error('Log handler failed:', error);
728
- }
729
- });
730
- }
731
- /**
732
- * Registra información de trace (debugging detallado)
733
- *
734
- * @param {...any} args - Datos detallados para debugging
735
- *
736
- * @example
737
- * logger.trace('Entrando en función processData');
738
- * logger.trace('Stack completo:', new Error().stack);
739
- *
740
- * @since 0.3.0
741
- */
742
- trace(...args) {
743
- this.log('debug', ...args);
744
- if (this.shouldLog('debug')) {
745
- console.trace(...args);
746
- }
747
- }
748
- /**
749
- * Registra errores críticos (prioridad más alta)
750
- *
751
- * @param {...any} args - Errores críticos del sistema
752
- *
753
- * @example
754
- * logger.critical('Sistema caído - reinicio inmediato requerido');
755
- * logger.critical('Pérdida de datos detectada');
756
- * logger.critical('Brecha de seguridad:', securityError);
757
- *
758
- * @since 0.3.0
759
- */
760
- critical(...args) {
761
- this.log('critical', ...args);
762
- }
763
- // ===== ADVANCED LOGGING FEATURES =====
764
- /**
765
- * Muestra datos en formato de tabla
766
- *
767
- * @param {any} data - Datos a mostrar (array de objetos o matriz)
768
- * @param {string[]} columns - Columnas específicas a mostrar (opcional)
769
- *
770
- * @example
771
- * const usuarios = [
772
- * { id: 1, nombre: 'Juan', edad: 30 },
773
- * { id: 2, nombre: 'María', edad: 25 }
774
- * ];
775
- * logger.table(usuarios);
776
- * logger.table(usuarios, ['nombre', 'edad']); // Solo estas columnas
777
- *
778
- * @since 0.3.0
779
- */
780
- table(data, columns) {
781
- if (!this.shouldLog('info'))
782
- return;
783
- const prefix = this.getEffectivePrefix();
784
- const tableStyle = StylePresets.accent().build();
785
- const format = `%c📊 TABLE${prefix ? ` [${prefix}]` : ''}`;
786
- console.log(format, tableStyle);
787
- if (columns) {
788
- console.table(data, columns);
789
- }
790
- else {
791
- console.table(data);
792
- }
793
- }
794
- /**
795
- * Inicia un grupo colapsable en la consola
796
- *
797
- * @param {string} label - Etiqueta del grupo
798
- * @param {boolean} collapsed - Si el grupo inicia colapsado (default: false)
799
- *
800
- * @example
801
- * logger.group('Procesando usuarios');
802
- * logger.info('Usuario 1 procesado');
803
- * logger.info('Usuario 2 procesado');
804
- * logger.groupEnd();
805
- *
806
- * @example
807
- * // Grupo colapsado por defecto
808
- * logger.group('Detalles adicionales', true);
809
- * logger.debug('Información detallada aquí');
810
- * logger.groupEnd();
811
- *
812
- * @since 0.3.0
813
- */
814
- group(label, collapsed = false) {
815
- const groupStyle = new StyleBuilder()
816
- .bg('linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%)')
817
- .color('#1565c0')
818
- .border('1px solid #90caf9')
819
- .padding('4px 12px')
820
- .rounded('6px')
821
- .bold()
822
- .build();
823
- const format = `%c📁 ${label}`;
824
- if (collapsed) {
825
- console.groupCollapsed(format, groupStyle);
826
- }
827
- else {
828
- console.group(format, groupStyle);
829
- }
830
- this.groupDepth++;
831
- }
832
- /**
833
- * Finaliza el grupo actual de la consola
834
- *
835
- * @example
836
- * logger.group('Operaciones');
837
- * logger.info('Operación 1');
838
- * logger.info('Operación 2');
839
- * logger.groupEnd(); // Cierra el grupo
840
- *
841
- * @since 0.3.0
842
- */
843
- groupEnd() {
844
- if (this.groupDepth > 0) {
845
- console.groupEnd();
846
- this.groupDepth--;
847
- }
848
- }
849
- // ===== PERFORMANCE TIMING =====
850
- /**
851
- * Inicia un temporizador con la etiqueta dada
852
- *
853
- * @param {string} label - Etiqueta identificadora del temporizador
854
- *
855
- * @example
856
- * logger.time('proceso-datos');
857
- * // ... operación costosa ...
858
- * logger.timeEnd('proceso-datos'); // ⏱️ Timer ended: proceso-datos - 1523.45ms
859
- *
860
- * @since 0.3.0
861
- */
862
- time(label) {
863
- const timer = {
864
- label,
865
- startTime: performance.now(),
866
- };
867
- this.timers.set(label, timer);
868
- const timerStyle = StylePresets.warning().build();
869
- console.log(`%c⏱️ Timer started: ${label}`, timerStyle);
870
- }
871
- /**
872
- * Finaliza un temporizador y muestra el tiempo transcurrido
873
- *
874
- * @param {string} label - Etiqueta del temporizador a finalizar
875
- *
876
- * @example
877
- * logger.time('consulta-db');
878
- * await consultarBaseDatos();
879
- * logger.timeEnd('consulta-db'); // ⏱️ Timer ended: consulta-db - 234.56ms
880
- *
881
- * @since 0.3.0
882
- */
883
- timeEnd(label) {
884
- const timer = this.timers.get(label);
885
- if (!timer) {
886
- this.warn(`Timer '${label}' does not exist`);
887
- return;
888
- }
889
- const elapsed = performance.now() - timer.startTime;
890
- this.timers.delete(label);
891
- const timerStyle = StylePresets.success().build();
892
- console.log(`%c⏱️ Timer ended: ${label} - ${elapsed.toFixed(2)}ms`, timerStyle);
893
- }
894
- // ===== ADVANCED VISUAL FEATURES =====
895
- /**
896
- * Muestra un banner con el tipo especificado o configurado
897
- *
898
- * @param {BannerType} bannerType - Tipo de banner (opcional)
899
- *
900
- * @example
901
- * logger.showBanner('ascii'); // Banner ASCII art
902
- * logger.showBanner('unicode'); // Banner con caracteres Unicode
903
- * logger.showBanner('svg'); // Banner con gráfico SVG
904
- * logger.showBanner(); // Usa el tipo configurado
905
- *
906
- * @since 0.3.0
907
- */
908
- showBanner(bannerType) {
909
- const effectiveBannerType = bannerType ? bannerType : this.config.bannerType;
910
- displayInitBanner(effectiveBannerType);
911
- }
912
- /**
913
- * Registra mensaje con imagen SVG de fondo
914
- *
915
- * @param {string} message - Mensaje a mostrar
916
- * @param {string} svgContent - Contenido SVG personalizado (opcional)
917
- * @param {StyleOptions} options - Opciones de estilo (ancho, alto, padding)
918
- *
919
- * @example
920
- * // SVG automático con gradiente
921
- * logger.logWithSVG('🎆 Bienvenido a Better Logger');
922
- *
923
- * @example
924
- * // SVG personalizado
925
- * const customSVG = '<svg>...</svg>';
926
- * logger.logWithSVG('Logo', customSVG, { width: 400, height: 100 });
927
- *
928
- * @since 0.3.0
929
- */
930
- logWithSVG(message, svgContent, options = {}) {
931
- const { width = 300, height = 60, padding = '30px 150px' } = options;
932
- let svgDataUri = '';
933
- if (svgContent) {
934
- const encodedSVG = encodeURIComponent(svgContent);
935
- svgDataUri = `data:image/svg+xml,${encodedSVG}`;
936
- }
937
- else {
938
- const defaultSVG = `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${width} ${height}'><defs><linearGradient id='grad' x1='0%' y1='0%' x2='100%' y2='0%'><stop offset='0%' style='stop-color:%23667eea'/><stop offset='100%' style='stop-color:%23764ba2'/></linearGradient></defs><rect width='100%' height='100%' fill='url(%23grad)' rx='4'/><text x='${width / 2}' y='${height / 2 + 5}' text-anchor='middle' fill='white' font-family='monospace' font-size='14' font-weight='bold'>${message}</text></svg>`;
939
- svgDataUri = `data:image/svg+xml,${encodeURIComponent(defaultSVG)}`;
940
- }
941
- const svgStyle = new StyleBuilder()
942
- .bg(`url("${svgDataUri}") no-repeat center center`)
943
- .padding(padding)
944
- .color('transparent')
945
- .rounded('4px')
946
- .build();
947
- console.log(`%c${message}`, svgStyle);
948
- }
949
- /**
950
- * Registra mensaje con gradiente animado de fondo
951
- *
952
- * @param {string} message - Mensaje a animar
953
- * @param {number} duration - Duración de la animación en segundos (default: 3)
954
- *
955
- * @example
956
- * logger.logAnimated('🌈 Animación en progreso');
957
- * logger.logAnimated('Cargando...', 5); // Animación de 5 segundos
958
- *
959
- * @since 0.3.0
960
- */
961
- logAnimated(message, duration = 3) {
962
- // Inject CSS animation if not already present
963
- if (!document.getElementById('logger-animations')) {
964
- const style = document.createElement('style');
965
- style.id = 'logger-animations';
966
- style.textContent = `
967
- @keyframes loggerGradient {
968
- 0% { background-position: 0% 50%; }
969
- 50% { background-position: 100% 50%; }
970
- 100% { background-position: 0% 50%; }
971
- }
972
- `;
973
- document.head.appendChild(style);
974
- }
975
- const animatedStyle = new StyleBuilder()
976
- .bg('linear-gradient(-45deg, #667eea, #764ba2, #667eea, #764ba2)')
977
- .css('background-size', '400% 400%')
978
- .color('#ffffff')
979
- .padding('12px 20px')
980
- .rounded('8px')
981
- .bold()
982
- .font('Monaco, Consolas, monospace')
983
- .animation(`loggerGradient ${duration}s ease infinite`)
984
- .display('inline-block')
985
- .build();
986
- console.log(`%c${message}`, animatedStyle);
987
- }
988
- /**
989
- * Agrupa logs por una propiedad específica usando Object.groupBy (cuando esté disponible)
990
- *
991
- * @param {T[]} items - Array de elementos a agrupar
992
- * @param {Function} groupBy - Función que retorna la clave de agrupación
993
- *
994
- * @example
995
- * const ventas = [
996
- * { producto: 'Laptop', categoria: 'Electrónica', precio: 1200 },
997
- * { producto: 'Mouse', categoria: 'Electrónica', precio: 25 },
998
- * { producto: 'Libro', categoria: 'Literatura', precio: 15 }
999
- * ];
1000
- * logger.logGrouped(ventas, item => item.categoria);
1001
- *
1002
- * @since 0.3.0
1003
- */
1004
- logGrouped(items, groupBy) {
1005
- try {
1006
- // Use Object.groupBy if available (ES2024), otherwise fallback to reduce
1007
- let grouped;
1008
- if (Object.groupBy) {
1009
- grouped = Object.groupBy(items, groupBy);
1010
- }
1011
- else {
1012
- grouped = items.reduce((acc, item) => {
1013
- const key = groupBy(item);
1014
- if (!acc[key]) {
1015
- acc[key] = [];
1016
- }
1017
- acc[key].push(item);
1018
- return acc;
1019
- }, {});
1020
- }
1021
- Object.entries(grouped).forEach(([group, groupItems]) => {
1022
- this.group(`Group: ${group}`);
1023
- this.table(groupItems);
1024
- this.groupEnd();
1025
- });
1026
- }
1027
- catch {
1028
- this.info('Grouped data:', items);
1029
- }
1030
- }
1031
- // ===== CLI SYSTEM =====
1032
- /**
1033
- * Procesador de comandos CLI para configuración y exportación del logger
1034
- *
1035
- * @param {string} command - Comando CLI a ejecutar
1036
- * @returns {Promise<void>}
1037
- *
1038
- * @example
1039
- * // Comandos disponibles
1040
- * await logger.cli('export json'); // Exporta logs en JSON
1041
- * await logger.cli('export csv'); // Exporta logs en CSV
1042
- * await logger.cli('theme list'); // Lista temas disponibles
1043
- * await logger.cli('theme set neon'); // Cambia al tema neon
1044
- * await logger.cli('config show'); // Muestra configuración actual
1045
- * await logger.cli('history clear'); // Limpia historial de logs
1046
- * await logger.cli('status'); // Muestra estado del logger
1047
- * await logger.cli('help'); // Muestra ayuda de comandos
1048
- *
1049
- * @since 0.3.0
1050
- */
1051
- async cli(command) {
1052
- if (!this.cliProcessor) {
1053
- this.error('CLI processor not initialized');
1054
- return;
1055
- }
1056
- await this.cliProcessor.processCommand(command, this);
1057
- }
1058
- }
1059
- /**
1060
- * Instancia singleton del logger con configuración por defecto
1061
- * @constant {Logger}
1062
- */
1063
- const defaultLogger = new Logger({
1064
- verbosity: 'info',
1065
- enableColors: true,
1066
- enableTimestamps: true,
1067
- enableStackTrace: true,
1068
- bufferSize: 1000, // Enable export functionality by default
1069
- });
1070
- // Display initialization banner
1071
- displayInitBanner();
1072
- // Export the singleton instance as default
1073
- export default defaultLogger;
1074
- /**
1075
- * Métodos individuales exportados para conveniencia
1076
- * @description Todos los métodos están correctamente enlazados al singleton
1077
- * @since 0.3.0
1078
- */
1079
- export const debug = (...args) => defaultLogger.debug(...args);
1080
- export const info = (...args) => defaultLogger.info(...args);
1081
- export const warn = (...args) => defaultLogger.warn(...args);
1082
- export const error = (...args) => defaultLogger.error(...args);
1083
- export const success = (...args) => defaultLogger.success(...args);
1084
- export const trace = (...args) => defaultLogger.trace(...args);
1085
- export const critical = (...args) => defaultLogger.critical(...args);
1086
- export const table = (data, columns) => defaultLogger.table(data, columns);
1087
- export const group = (label, collapsed) => defaultLogger.group(label, collapsed);
1088
- export const groupEnd = () => defaultLogger.groupEnd();
1089
- export const time = (label) => defaultLogger.time(label);
1090
- export const timeEnd = (label) => defaultLogger.timeEnd(label);
1091
- export const setGlobalPrefix = (prefix) => defaultLogger.setGlobalPrefix(prefix);
1092
- export const setVerbosity = (level) => defaultLogger.setVerbosity(level);
1093
- export const addHandler = (handler) => defaultLogger.addHandler(handler);
1094
- export const setTheme = (theme) => defaultLogger.setTheme(theme);
1095
- export const setBannerType = (bannerType) => defaultLogger.setBannerType(bannerType);
1096
- export const showBanner = (bannerType) => defaultLogger.showBanner(bannerType);
1097
- export const logWithSVG = (message, svgContent, options) => defaultLogger.logWithSVG(message, svgContent, options);
1098
- export const logAnimated = (message, duration) => defaultLogger.logAnimated(message, duration);
1099
- export const cli = (command) => defaultLogger.cli(command);
1100
- export const cleanup = () => defaultLogger.cleanup();
1101
- // Simplified API exports
1102
- export const preset = (name) => defaultLogger.preset(name);
1103
- export const presets = () => defaultLogger.presets();
1104
- export const hideTimestamp = () => defaultLogger.hideTimestamp();
1105
- export const showTimestamp = () => defaultLogger.showTimestamp();
1106
- export const hideLocation = () => defaultLogger.hideLocation();
1107
- export const showLocation = () => defaultLogger.showLocation();
1108
- export const hideBadges = () => defaultLogger.hideBadges();
1109
- export const showBadges = () => defaultLogger.showBadges();
1110
- export const component = (name) => defaultLogger.component(name);
1111
- export const api = (name) => defaultLogger.api(name);
1112
- export const scope = (name) => defaultLogger.scope(name);
1113
- export const customize = (overrides) => defaultLogger.customize(overrides);
1114
- export const styles = () => defaultLogger.styles();
1115
- // Re-export handlers and utilities for backward compatibility
1116
- export { FileLogHandler, RemoteLogHandler, AnalyticsLogHandler, ExportLogHandler } from './handlers/index.js';
1117
- export { StyleBuilder, StylePresets as Styles } from './styling/index.js';
1118
- export { ScopedLogger, APILogger, ComponentLogger } from './ScopedLogger.js';