@mks2508/better-logger 0.14.0-alpha.2 → 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 (138) hide show
  1. package/dist/chunks/{Logger-Crw1woqR.js → Logger-CTAaDeZi.js} +49 -16
  2. package/dist/chunks/{Logger-Crw1woqR.js.map → Logger-CTAaDeZi.js.map} +1 -1
  3. package/dist/chunks/{Logger-D_p3xnbq.js → Logger-D8pK7XXt.js} +2 -2
  4. package/dist/chunks/{Logger-D_p3xnbq.js.map → Logger-D8pK7XXt.js.map} +1 -1
  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 +11 -7
  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/index.d.ts +119 -4
  23. package/dist/types/index.d.ts.map +1 -1
  24. package/package.json +2 -1
  25. package/src/Logger.ts +99 -58
  26. package/src/index.ts +32 -25
  27. package/dist/.tsbuildinfo +0 -1
  28. package/dist/Logger.d.ts +0 -708
  29. package/dist/Logger.d.ts.map +0 -1
  30. package/dist/Logger.js +0 -1124
  31. package/dist/ScopedLogger.d.ts +0 -318
  32. package/dist/ScopedLogger.d.ts.map +0 -1
  33. package/dist/ScopedLogger.js +0 -426
  34. package/dist/cli/CommandProcessor.d.ts +0 -103
  35. package/dist/cli/CommandProcessor.d.ts.map +0 -1
  36. package/dist/cli/CommandProcessor.js +0 -184
  37. package/dist/cli/commands/ConfigCommand.d.ts +0 -17
  38. package/dist/cli/commands/ConfigCommand.d.ts.map +0 -1
  39. package/dist/cli/commands/ConfigCommand.js +0 -88
  40. package/dist/cli/commands/ExportCommand.d.ts +0 -51
  41. package/dist/cli/commands/ExportCommand.d.ts.map +0 -1
  42. package/dist/cli/commands/ExportCommand.js +0 -243
  43. package/dist/cli/commands/HistoryCommand.d.ts +0 -50
  44. package/dist/cli/commands/HistoryCommand.d.ts.map +0 -1
  45. package/dist/cli/commands/HistoryCommand.js +0 -96
  46. package/dist/cli/commands/StatusCommand.d.ts +0 -33
  47. package/dist/cli/commands/StatusCommand.d.ts.map +0 -1
  48. package/dist/cli/commands/StatusCommand.js +0 -93
  49. package/dist/cli/commands/ThemeCommand.d.ts +0 -33
  50. package/dist/cli/commands/ThemeCommand.d.ts.map +0 -1
  51. package/dist/cli/commands/ThemeCommand.js +0 -79
  52. package/dist/cli/help.d.ts +0 -15
  53. package/dist/cli/help.d.ts.map +0 -1
  54. package/dist/cli/help.js +0 -118
  55. package/dist/cli/index.d.ts +0 -15
  56. package/dist/cli/index.d.ts.map +0 -1
  57. package/dist/cli/index.js +0 -46
  58. package/dist/constants.d.ts +0 -122
  59. package/dist/constants.d.ts.map +0 -1
  60. package/dist/constants.js +0 -159
  61. package/dist/core.d.ts +0 -134
  62. package/dist/core.d.ts.map +0 -1
  63. package/dist/example.d.ts +0 -18
  64. package/dist/example.d.ts.map +0 -1
  65. package/dist/example.js +0 -154
  66. package/dist/exports-module.d.ts +0 -203
  67. package/dist/exports-module.d.ts.map +0 -1
  68. package/dist/exports-module.js +0 -260
  69. package/dist/handlers/AnalyticsLogHandler.d.ts +0 -11
  70. package/dist/handlers/AnalyticsLogHandler.d.ts.map +0 -1
  71. package/dist/handlers/AnalyticsLogHandler.js +0 -19
  72. package/dist/handlers/ExportLogHandler.d.ts +0 -103
  73. package/dist/handlers/ExportLogHandler.d.ts.map +0 -1
  74. package/dist/handlers/ExportLogHandler.js +0 -516
  75. package/dist/handlers/FileLogHandler.d.ts +0 -36
  76. package/dist/handlers/FileLogHandler.d.ts.map +0 -1
  77. package/dist/handlers/FileLogHandler.js +0 -156
  78. package/dist/handlers/RemoteLogHandler.d.ts +0 -14
  79. package/dist/handlers/RemoteLogHandler.d.ts.map +0 -1
  80. package/dist/handlers/RemoteLogHandler.js +0 -37
  81. package/dist/handlers/index.d.ts +0 -8
  82. package/dist/handlers/index.d.ts.map +0 -1
  83. package/dist/handlers/index.js +0 -7
  84. package/dist/index.d.ts +0 -157
  85. package/dist/index.d.ts.map +0 -1
  86. package/dist/main.d.ts +0 -2
  87. package/dist/main.d.ts.map +0 -1
  88. package/dist/main.js +0 -139
  89. package/dist/styling/LogStyleBuilder.d.ts +0 -149
  90. package/dist/styling/LogStyleBuilder.d.ts.map +0 -1
  91. package/dist/styling/LogStyleBuilder.js +0 -289
  92. package/dist/styling/SemanticStyles.d.ts +0 -181
  93. package/dist/styling/SemanticStyles.d.ts.map +0 -1
  94. package/dist/styling/SemanticStyles.js +0 -339
  95. package/dist/styling/SmartPresets.d.ts +0 -25
  96. package/dist/styling/SmartPresets.d.ts.map +0 -1
  97. package/dist/styling/SmartPresets.js +0 -276
  98. package/dist/styling/StyleBuilder.d.ts +0 -140
  99. package/dist/styling/StyleBuilder.d.ts.map +0 -1
  100. package/dist/styling/StyleBuilder.js +0 -280
  101. package/dist/styling/banners.d.ts +0 -45
  102. package/dist/styling/banners.d.ts.map +0 -1
  103. package/dist/styling/banners.js +0 -155
  104. package/dist/styling/index.d.ts +0 -10
  105. package/dist/styling/index.d.ts.map +0 -1
  106. package/dist/styling/index.js +0 -9
  107. package/dist/styling/themes.d.ts +0 -10
  108. package/dist/styling/themes.d.ts.map +0 -1
  109. package/dist/styling/themes.js +0 -231
  110. package/dist/styling-module.d.ts +0 -185
  111. package/dist/styling-module.d.ts.map +0 -1
  112. package/dist/styling-module.js +0 -199
  113. package/dist/types/core.js +0 -28
  114. package/dist/types/handlers.d.ts +0 -88
  115. package/dist/types/handlers.d.ts.map +0 -1
  116. package/dist/types/handlers.js +0 -4
  117. package/dist/types/index.js +0 -4
  118. package/dist/utils/environment.d.ts +0 -47
  119. package/dist/utils/environment.d.ts.map +0 -1
  120. package/dist/utils/environment.js +0 -85
  121. package/dist/utils/formatting.d.ts +0 -40
  122. package/dist/utils/formatting.d.ts.map +0 -1
  123. package/dist/utils/formatting.js +0 -117
  124. package/dist/utils/index.d.ts +0 -7
  125. package/dist/utils/index.d.ts.map +0 -1
  126. package/dist/utils/index.js +0 -6
  127. package/dist/utils/opentui-detection.d.ts +0 -34
  128. package/dist/utils/opentui-detection.d.ts.map +0 -1
  129. package/dist/utils/opentui-detection.js +0 -116
  130. package/dist/utils/output.d.ts +0 -44
  131. package/dist/utils/output.d.ts.map +0 -1
  132. package/dist/utils/output.js +0 -150
  133. package/dist/utils/stackTrace.d.ts +0 -9
  134. package/dist/utils/stackTrace.d.ts.map +0 -1
  135. package/dist/utils/stackTrace.js +0 -81
  136. package/dist/utils/timestamps.d.ts +0 -20
  137. package/dist/utils/timestamps.d.ts.map +0 -1
  138. package/dist/utils/timestamps.js +0 -71
package/dist/constants.js DELETED
@@ -1,159 +0,0 @@
1
- /**
2
- * @fileoverview Global constants for Advanced Logger
3
- */
4
- /**
5
- * Default configuration values
6
- */
7
- export const DEFAULT_CONFIG = {
8
- verbosity: 'info',
9
- enableColors: true,
10
- enableTimestamps: true,
11
- enableStackTrace: true,
12
- theme: 'default',
13
- bannerType: 'simple',
14
- bufferSize: 1000,
15
- autoDetectTheme: true,
16
- };
17
- /**
18
- * Basic level styles for core module (minimal CSS styling)
19
- */
20
- export const LEVEL_STYLES = {
21
- debug: {
22
- emoji: '🔍',
23
- label: 'DEBUG',
24
- background: 'linear-gradient(90deg, #6c757d, #495057)',
25
- color: '#ffffff',
26
- border: '1px solid #6c757d',
27
- shadow: '0 2px 4px rgba(108, 117, 125, 0.3)'
28
- },
29
- info: {
30
- emoji: 'ℹ️',
31
- label: 'INFO',
32
- background: 'linear-gradient(90deg, #007bff, #0056b3)',
33
- color: '#ffffff',
34
- border: '1px solid #007bff',
35
- shadow: '0 2px 4px rgba(0, 123, 255, 0.3)'
36
- },
37
- warn: {
38
- emoji: '⚠️',
39
- label: 'WARN',
40
- background: 'linear-gradient(90deg, #ffc107, #e0a800)',
41
- color: '#000000',
42
- border: '1px solid #ffc107',
43
- shadow: '0 2px 4px rgba(255, 193, 7, 0.3)'
44
- },
45
- error: {
46
- emoji: '❌',
47
- label: 'ERROR',
48
- background: 'linear-gradient(90deg, #dc3545, #c82333)',
49
- color: '#ffffff',
50
- border: '1px solid #dc3545',
51
- shadow: '0 2px 4px rgba(220, 53, 69, 0.3)'
52
- },
53
- critical: {
54
- emoji: '🚨',
55
- label: 'CRITICAL',
56
- background: 'linear-gradient(90deg, #8B0000, #FF0000)',
57
- color: '#ffffff',
58
- border: '2px solid #FF0000',
59
- shadow: '0 4px 8px rgba(255, 0, 0, 0.4)'
60
- },
61
- success: {
62
- emoji: '✅',
63
- label: 'SUCCESS',
64
- background: 'linear-gradient(90deg, #28a745, #1e7e34)',
65
- color: '#ffffff',
66
- border: '1px solid #28a745',
67
- shadow: '0 2px 4px rgba(40, 167, 69, 0.3)'
68
- }
69
- };
70
- /**
71
- * Maximum allowed buffer sizes for performance
72
- */
73
- export const BUFFER_LIMITS = {
74
- MIN_SIZE: 50,
75
- DEFAULT_SIZE: 1000,
76
- MAX_SIZE: 10000,
77
- };
78
- /**
79
- * Export format definitions with extensions
80
- */
81
- export const EXPORT_FORMATS = {
82
- json: { extension: '.json', mimeType: 'application/json' },
83
- csv: { extension: '.csv', mimeType: 'text/csv' },
84
- markdown: { extension: '.md', mimeType: 'text/markdown' },
85
- plain: { extension: '.txt', mimeType: 'text/plain' },
86
- html: { extension: '.html', mimeType: 'text/html' },
87
- };
88
- /**
89
- * CLI command definitions
90
- */
91
- export const CLI_COMMANDS = {
92
- config: 'config',
93
- help: 'help',
94
- themes: 'themes',
95
- banners: 'banners',
96
- banner: 'banner',
97
- status: 'status',
98
- reset: 'reset',
99
- demo: 'demo',
100
- export: 'export',
101
- copy: 'copy',
102
- 'buffer-size': 'buffer-size',
103
- 'clear-buffer': 'clear-buffer',
104
- 'buffer-info': 'buffer-info',
105
- };
106
- /**
107
- * Time parsing constants for relative time filters
108
- */
109
- export const TIME_UNITS = {
110
- ms: 1,
111
- s: 1000,
112
- m: 60 * 1000,
113
- h: 60 * 60 * 1000,
114
- d: 24 * 60 * 60 * 1000,
115
- };
116
- /**
117
- * Default styling values
118
- */
119
- export const STYLE_DEFAULTS = {
120
- FONT_FAMILY: 'Monaco, Consolas, monospace',
121
- FONT_SIZE: '12px',
122
- BORDER_RADIUS: '4px',
123
- PADDING: '4px 8px',
124
- };
125
- /**
126
- * Level priority mapping for filtering
127
- */
128
- export const LEVEL_PRIORITIES = {
129
- debug: 0,
130
- info: 1,
131
- warn: 2,
132
- error: 3,
133
- critical: 4,
134
- };
135
- /**
136
- * Adaptive color configurations for DevTools theme compatibility
137
- */
138
- export const ADAPTIVE_COLORS = {
139
- timestamp: {
140
- light: '#666666',
141
- dark: '#a0a0a0',
142
- },
143
- messageText: {
144
- light: '#2d3748',
145
- dark: '#f7fafc',
146
- },
147
- prefix: {
148
- light: '#2d3748',
149
- dark: '#e2e8f0',
150
- },
151
- prefixBackground: {
152
- light: '#2d3748',
153
- dark: '#4a5568',
154
- },
155
- location: {
156
- light: '#718096',
157
- dark: '#a0aec0',
158
- },
159
- };
package/dist/core.d.ts DELETED
@@ -1,134 +0,0 @@
1
- /**
2
- * @fileoverview Core Logger Module - Minimal logging without advanced features
3
- * @version 0.0.1
4
- *
5
- * This module provides the essential logging functionality without visual enhancements,
6
- * SVG support, or advanced styling. Perfect for lightweight applications or server-side usage.
7
- */
8
- import type { Verbosity, LoggerConfig, ILogHandler } from './types/index.js';
9
- /**
10
- * Minimal Logger class with core functionality only
11
- *
12
- * @example
13
- * ```typescript
14
- * import { CoreLogger } from '@mks2508/better-logger/core';
15
- *
16
- * const logger = new CoreLogger();
17
- * logger.info('Hello world');
18
- * logger.error('Something went wrong', error);
19
- * ```
20
- */
21
- export declare class CoreLogger {
22
- private config;
23
- private scopedPrefix?;
24
- private handlers;
25
- private timers;
26
- private groupDepth;
27
- /**
28
- * Creates a new CoreLogger instance
29
- * @param config - Optional configuration
30
- */
31
- constructor(config?: Partial<LoggerConfig>);
32
- /**
33
- * Get current configuration
34
- */
35
- getConfig(): LoggerConfig;
36
- /**
37
- * Sets the global prefix for all log messages
38
- */
39
- setGlobalPrefix(prefix: string): void;
40
- /**
41
- * Sets the verbosity level for filtering log output
42
- */
43
- setVerbosity(level: Verbosity): void;
44
- /**
45
- * Creates a scoped logger with a specific prefix
46
- */
47
- scope(prefix: string): CoreLogger;
48
- /**
49
- * Adds a custom log handler for extensibility
50
- */
51
- addHandler(handler: ILogHandler): void;
52
- /**
53
- * Checks if a log level should be output based on current verbosity
54
- */
55
- private shouldLog;
56
- /**
57
- * Gets the effective prefix (global + scoped)
58
- */
59
- private getEffectivePrefix;
60
- /**
61
- * Core logging method with universal formatting
62
- */
63
- private log;
64
- /**
65
- * Logs debug information (lowest priority)
66
- */
67
- debug(...args: any[]): void;
68
- /**
69
- * Logs informational messages
70
- */
71
- info(...args: any[]): void;
72
- /**
73
- * Logs warning messages
74
- */
75
- warn(...args: any[]): void;
76
- /**
77
- * Logs error messages
78
- */
79
- error(...args: any[]): void;
80
- /**
81
- * Logs critical errors (highest priority)
82
- */
83
- critical(...args: any[]): void;
84
- /**
85
- * Logs trace information (detailed debugging)
86
- */
87
- trace(...args: any[]): void;
88
- /**
89
- * Displays data in a table format
90
- */
91
- table(data: any, columns?: string[]): void;
92
- /**
93
- * Starts a collapsible group in the console
94
- */
95
- group(label: string, collapsed?: boolean): void;
96
- /**
97
- * Ends the current console group
98
- */
99
- groupEnd(): void;
100
- /**
101
- * Starts a timer with the given label
102
- */
103
- time(label: string): void;
104
- /**
105
- * Ends a timer and logs the elapsed time
106
- */
107
- timeEnd(label: string): void;
108
- /**
109
- * Gets performance.now() or fallback for older environments
110
- */
111
- private getPerformanceNow;
112
- }
113
- declare const coreLogger: CoreLogger;
114
- /**
115
- * Export individual methods for convenience (with proper binding)
116
- */
117
- export declare const debug: (...args: any[]) => void;
118
- export declare const info: (...args: any[]) => void;
119
- export declare const warn: (...args: any[]) => void;
120
- export declare const error: (...args: any[]) => void;
121
- export declare const critical: (...args: any[]) => void;
122
- export declare const trace: (...args: any[]) => void;
123
- export declare const table: (data: any, columns?: string[]) => void;
124
- export declare const group: (label: string, collapsed?: boolean) => void;
125
- export declare const groupEnd: () => void;
126
- export declare const time: (label: string) => void;
127
- export declare const timeEnd: (label: string) => void;
128
- export declare const setGlobalPrefix: (prefix: string) => void;
129
- export declare const scope: (prefix: string) => CoreLogger;
130
- export declare const setVerbosity: (level: Verbosity) => void;
131
- export declare const addHandler: (handler: ILogHandler) => void;
132
- export default coreLogger;
133
- export type { LogLevel, Verbosity, LoggerConfig, ILogHandler, LogMetadata } from './types/index.js';
134
- //# sourceMappingURL=core.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAER,SAAS,EACT,YAAY,EACZ,WAAW,EAGd,MAAM,kBAAkB,CAAC;AA8B1B;;;;;;;;;;;GAWG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,UAAU,CAAa;IAE/B;;;OAGG;gBACS,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM;IAc9C;;OAEG;IACH,SAAS,IAAI,YAAY;IAIzB;;OAEG;IACH,eAAe,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AAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAA8B,CAAC;AACnE,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,GAAG,EAAE,SAA6B,CAAC;AACjE,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,GAAG,EAAE,SAA6B,CAAC;AACjE,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAA8B,CAAC;AACnE,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,GAAG,EAAE,SAAiC,CAAC;AACzE,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAA8B,CAAC;AACnE,eAAO,MAAM,KAAK,GAAI,MAAM,GAAG,EAAE,UAAU,MAAM,EAAE,SAAoC,CAAC;AACxF,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,YAAY,OAAO,SAAuC,CAAC;AAChG,eAAO,MAAM,QAAQ,YAA8B,CAAC;AACpD,eAAO,MAAM,IAAI,GAAI,OAAO,MAAM,SAA2B,CAAC;AAC9D,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,SAA8B,CAAC;AACpE,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,SAAuC,CAAC;AACtF,eAAO,MAAM,KAAK,GAAI,QAAQ,MAAM,eAA6B,CAAC;AAClE,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,SAAmC,CAAC;AACjF,eAAO,MAAM,UAAU,GAAI,SAAS,WAAW,SAAmC,CAAC;AAGnF,eAAe,UAAU,CAAC;AAG1B,YAAY,EACR,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,EACd,MAAM,kBAAkB,CAAC"}
package/dist/example.d.ts DELETED
@@ -1,18 +0,0 @@
1
- /**
2
- * @fileoverview Comprehensive examples and demonstrations of Better Logger
3
- */
4
- export declare function demonstrateBanners(): void;
5
- export declare function demonstrateThemes(): void;
6
- export declare function demonstrateSVG(): void;
7
- export declare function demonstrateAnimations(): void;
8
- export declare function demonstrateCLI(): void;
9
- export declare function demonstrateExports(): void;
10
- export declare function demonstrateBasicLogging(): void;
11
- export declare function demonstrateTable(): void;
12
- export declare function demonstrateGrouping(): void;
13
- export declare function demonstrateTiming(): void;
14
- export declare function demonstrateScopedLogger(): void;
15
- export declare function demonstrateTrace(): void;
16
- export declare function demonstrateCustomStyles(): void;
17
- export declare function demonstrateAllFeatures(): void;
18
- //# sourceMappingURL=example.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAAA;;GAEG;AA0BH,wBAAgB,kBAAkB,SAQjC;AAED,wBAAgB,iBAAiB,SAUhC;AAED,wBAAgB,cAAc,SAW7B;AAED,wBAAgB,qBAAqB,SAGpC;AAED,wBAAgB,cAAc,SAgB7B;AAED,wBAAgB,kBAAkB,SAWjC;AAGD,wBAAgB,uBAAuB,SAUtC;AAED,wBAAgB,gBAAgB,SAS/B;AAED,wBAAgB,mBAAmB,SAgBlC;AAED,wBAAgB,iBAAiB,SAShC;AAED,wBAAgB,uBAAuB,SAWtC;AAED,wBAAgB,gBAAgB,SAQ/B;AAED,wBAAgB,uBAAuB,SActC;AAGD,wBAAgB,sBAAsB,SAcrC"}
package/dist/example.js DELETED
@@ -1,154 +0,0 @@
1
- /**
2
- * @fileoverview Comprehensive examples and demonstrations of Better Logger
3
- */
4
- import logger, { debug, info, warn, error, success, critical, scope, setGlobalPrefix, setVerbosity, setTheme, showBanner, logWithSVG, logAnimated, cli, createStyle, stylePresets } from './index.js';
5
- // Visual features demonstrations
6
- export function demonstrateBanners() {
7
- info('🎨 Banner System Demo');
8
- showBanner('simple');
9
- setTimeout(() => showBanner('ascii'), 1000);
10
- setTimeout(() => showBanner('unicode'), 2000);
11
- setTimeout(() => showBanner('svg'), 3000);
12
- setTimeout(() => showBanner('animated'), 4000);
13
- }
14
- export function demonstrateThemes() {
15
- info('🌈 Theme System Demo');
16
- const themes = ['default', 'dark', 'neon', 'cyberpunk', 'retro'];
17
- themes.forEach((theme, index) => {
18
- setTimeout(() => {
19
- setTheme(theme);
20
- info(`Theme switched to: ${theme}`);
21
- }, index * 1500);
22
- });
23
- }
24
- export function demonstrateSVG() {
25
- const logoSVG = `<svg width="100" height="50" viewBox="0 0 100 50">
26
- <rect width="100" height="50" fill="#667eea"/>
27
- <text x="50" y="30" font-family="Arial" font-size="12" fill="white" text-anchor="middle">LOGO</text>
28
- </svg>`;
29
- logWithSVG('🖼️ Custom SVG Background', logoSVG, {
30
- width: 300,
31
- height: 60,
32
- padding: '20px 100px'
33
- });
34
- }
35
- export function demonstrateAnimations() {
36
- logAnimated('✨ Loading animation...', 3);
37
- setTimeout(() => logAnimated('🚀 Animation complete!', 2), 3500);
38
- }
39
- export function demonstrateCLI() {
40
- info('💻 CLI Commands Demo');
41
- const commands = [
42
- '/config theme:neon',
43
- '/banner ascii',
44
- '/verbose debug',
45
- '/prefix DEMO'
46
- ];
47
- commands.forEach((cmd, index) => {
48
- setTimeout(() => {
49
- info(`Executing: ${cmd}`);
50
- cli(cmd);
51
- }, index * 1500);
52
- });
53
- }
54
- export function demonstrateExports() {
55
- info('📤 Export functionality would be demonstrated here');
56
- info('Note: Export features require ExportLogger from /exports module');
57
- const sampleData = [
58
- { timestamp: new Date().toISOString(), level: 'info', message: 'Sample log 1' },
59
- { timestamp: new Date().toISOString(), level: 'error', message: 'Sample log 2' },
60
- { timestamp: new Date().toISOString(), level: 'warn', message: 'Sample log 3' }
61
- ];
62
- logger.table(sampleData, ['timestamp', 'level', 'message']);
63
- }
64
- // Core features demonstrations
65
- export function demonstrateBasicLogging() {
66
- setGlobalPrefix('DEMO');
67
- setVerbosity('debug');
68
- debug('🐞 Debug information', { config: { mode: 'development' } });
69
- info('ℹ️ Application started successfully');
70
- warn('⚠️ This is a warning message');
71
- error('❌ An error occurred', new Error('Sample error'));
72
- success('✅ User authentication successful');
73
- critical('🔥 Critical system failure detected');
74
- }
75
- export function demonstrateTable() {
76
- const userData = [
77
- { id: 1, name: 'John Doe', email: 'john@example.com', status: 'active' },
78
- { id: 2, name: 'Jane Smith', email: 'jane@example.com', status: 'inactive' },
79
- { id: 3, name: 'Bob Johnson', email: 'bob@example.com', status: 'active' }
80
- ];
81
- logger.table(userData);
82
- logger.table(userData, ['name', 'email']);
83
- }
84
- export function demonstrateGrouping() {
85
- logger.group('🔍 User Analysis');
86
- info('Analyzing user data...');
87
- logger.group('📊 Statistics', false);
88
- info('Total users: 150');
89
- info('Active users: 120');
90
- info('New this month: 25');
91
- logger.groupEnd();
92
- logger.group('🎯 Top Users');
93
- success('Premium user: Alice Johnson');
94
- success('Most active: Bob Smith');
95
- logger.groupEnd();
96
- logger.groupEnd();
97
- }
98
- export function demonstrateTiming() {
99
- logger.time('api-request');
100
- info('🌐 Making API request...');
101
- setTimeout(() => {
102
- logger.timeEnd('api-request');
103
- success('✅ API request completed');
104
- }, Math.random() * 2000 + 500);
105
- }
106
- export function demonstrateScopedLogger() {
107
- const apiLogger = scope('API');
108
- const dbLogger = scope('DB');
109
- const authLogger = scope('AUTH');
110
- apiLogger.info('🌐 Fetching user data', { endpoint: '/api/users' });
111
- dbLogger.debug('💾 Database query executed', { query: 'SELECT * FROM users LIMIT 10' });
112
- authLogger.success('🔐 User authentication successful', { userId: 12345 });
113
- apiLogger.warn('⚠️ Rate limit approaching', { remaining: 10 });
114
- dbLogger.error('❌ Connection timeout', { timeout: '5s' });
115
- }
116
- export function demonstrateTrace() {
117
- function deepFunction() {
118
- function deeperFunction() {
119
- logger.trace('🔍 Deep trace call with full stack');
120
- }
121
- deeperFunction();
122
- }
123
- deepFunction();
124
- }
125
- export function demonstrateCustomStyles() {
126
- const customStyle = createStyle()
127
- .bg('linear-gradient(135deg, #ff6b6b 0%, #feca57 100%)')
128
- .color('white')
129
- .padding('12px 20px')
130
- .rounded('10px')
131
- .shadow('0 4px 15px rgba(0,0,0,0.3)')
132
- .bold()
133
- .build();
134
- console.log('%c🎨 Custom Styled Message', customStyle);
135
- console.log('%c✅ Success Style', stylePresets.success);
136
- console.log('%c❌ Error Style', stylePresets.error);
137
- console.log('%c⚠️ Warning Style', stylePresets.warning);
138
- }
139
- // Comprehensive demonstration
140
- export function demonstrateAllFeatures() {
141
- info('🌟 Starting comprehensive Better Logger demonstration...');
142
- setTimeout(() => demonstrateBanners(), 500);
143
- setTimeout(() => demonstrateBasicLogging(), 6000);
144
- setTimeout(() => demonstrateCustomStyles(), 8000);
145
- setTimeout(() => demonstrateGrouping(), 10000);
146
- setTimeout(() => demonstrateTiming(), 13000);
147
- setTimeout(() => demonstrateScopedLogger(), 16000);
148
- setTimeout(() => demonstrateThemes(), 18000);
149
- setTimeout(() => {
150
- success('🎉 Demonstration complete! Check your console for all the styled outputs.');
151
- }, 25000);
152
- }
153
- // Auto-run basic demo on import
154
- demonstrateBasicLogging();
@@ -1,203 +0,0 @@
1
- /**
2
- * @fileoverview Exports Module - Export and remote logging capabilities
3
- * @version 0.0.1
4
- *
5
- * This module provides export functionality for logs including CSV, JSON, XML formats
6
- * and remote logging capabilities for sending logs to external services.
7
- */
8
- import { Logger } from './Logger.js';
9
- import type { LogLevel, Verbosity, ILogHandler } from './types/index.js';
10
- /**
11
- * Logger with export and remote capabilities
12
- *
13
- * @example
14
- * ```typescript
15
- * import { ExportLogger } from '@mks2508/better-logger/exports';
16
- *
17
- * const logger = new ExportLogger({ bufferSize: 1000 });
18
- *
19
- * // Log some data
20
- * logger.info('User logged in', { userId: 123 });
21
- * logger.error('Failed to process', { error: 'timeout' });
22
- *
23
- * // Export logs
24
- * const csvData = await logger.exportLogs('csv');
25
- * const jsonData = await logger.exportLogs('json');
26
- *
27
- * // Setup remote logging
28
- * logger.addRemoteHandler('https://api.myapp.com/logs', 'api-key');
29
- * ```
30
- */
31
- export declare class ExportLogger extends Logger {
32
- private exportLogHandler?;
33
- private remoteHandlers;
34
- constructor(config?: {
35
- bufferSize?: number;
36
- } & any);
37
- /**
38
- * Export logs in specified format
39
- *
40
- * @param format - Export format (csv, json, xml)
41
- * @param options - Export options
42
- * @returns Promise resolving to exported data
43
- *
44
- * @example
45
- * ```typescript
46
- * const csvData = await logger.exportLogs('csv');
47
- * const jsonData = await logger.exportLogs('json', {
48
- * filter: { level: 'error' },
49
- * limit: 100
50
- * });
51
- * ```
52
- */
53
- exportLogs(format: 'csv' | 'json' | 'xml', options?: {
54
- filter?: {
55
- level?: LogLevel;
56
- from?: Date;
57
- to?: Date;
58
- };
59
- limit?: number;
60
- }): Promise<string>;
61
- /**
62
- * Get current log buffer
63
- *
64
- * @returns Array of log entries
65
- *
66
- * @example
67
- * ```typescript
68
- * const logs = logger.getLogs();
69
- * console.log(`Buffered ${logs.length} log entries`);
70
- * ```
71
- */
72
- getLogs(): any[];
73
- /**
74
- * Clear the log buffer
75
- *
76
- * @example
77
- * ```typescript
78
- * logger.clearLogs();
79
- * ```
80
- */
81
- clearLogs(): void;
82
- /**
83
- * Get log statistics
84
- *
85
- * @returns Statistics object with counts by level
86
- *
87
- * @example
88
- * ```typescript
89
- * const stats = logger.getLogStats();
90
- * console.log(`Errors: ${stats.error}, Warnings: ${stats.warn}`);
91
- * ```
92
- */
93
- getLogStats(): Record<string, number>;
94
- /**
95
- * Add remote logging handler
96
- *
97
- * @param endpoint - Remote endpoint URL
98
- * @param apiKey - Optional API key for authentication
99
- *
100
- * @example
101
- * ```typescript
102
- * logger.addRemoteHandler('https://logs.myservice.com/api', 'secret-key');
103
- * ```
104
- */
105
- addRemoteHandler(endpoint: string, apiKey?: string): void;
106
- /**
107
- * Remove all remote handlers
108
- *
109
- * @example
110
- * ```typescript
111
- * logger.clearRemoteHandlers();
112
- * ```
113
- */
114
- clearRemoteHandlers(): void;
115
- /**
116
- * Flush all remote handlers (force send pending logs)
117
- *
118
- * @example
119
- * ```typescript
120
- * await logger.flushRemoteHandlers();
121
- * ```
122
- */
123
- flushRemoteHandlers(): Promise<void>;
124
- }
125
- declare const exportLogger: ExportLogger;
126
- /**
127
- * Export management utilities
128
- */
129
- export declare const exportUtils: {
130
- /**
131
- * Export current logs as CSV
132
- */
133
- exportCSV(options?: any): Promise<string>;
134
- /**
135
- * Export current logs as JSON
136
- */
137
- exportJSON(options?: any): Promise<string>;
138
- /**
139
- * Export current logs as XML
140
- */
141
- exportXML(options?: any): Promise<string>;
142
- /**
143
- * Get log statistics
144
- */
145
- getStats(): Record<string, number>;
146
- /**
147
- * Clear all logs
148
- */
149
- clear(): void;
150
- };
151
- /**
152
- * Remote logging utilities
153
- */
154
- export declare const remoteUtils: {
155
- /**
156
- * Add remote logging endpoint
157
- */
158
- addEndpoint(url: string, apiKey?: string): void;
159
- /**
160
- * Clear all remote endpoints
161
- */
162
- clearEndpoints(): void;
163
- /**
164
- * Flush all remote logs
165
- */
166
- flush(): Promise<void>;
167
- };
168
- /**
169
- * Export individual logging methods with export capabilities
170
- */
171
- export declare const debug: (...args: any[]) => void;
172
- export declare const info: (...args: any[]) => void;
173
- export declare const warn: (...args: any[]) => void;
174
- export declare const error: (...args: any[]) => void;
175
- export declare const success: (...args: any[]) => void;
176
- export declare const critical: (...args: any[]) => void;
177
- export declare const trace: (...args: any[]) => void;
178
- export declare const table: (data: any, columns?: string[]) => void;
179
- export declare const group: (label: string, collapsed?: boolean) => void;
180
- export declare const groupEnd: () => void;
181
- export declare const time: (label: string) => void;
182
- export declare const timeEnd: (label: string) => void;
183
- export declare const setGlobalPrefix: (prefix: string) => void;
184
- export declare const scope: (prefix: string) => any;
185
- export declare const setVerbosity: (level: Verbosity) => void;
186
- export declare const addHandler: (handler: ILogHandler) => void;
187
- /**
188
- * Export functionality
189
- */
190
- export declare const exportLogs: (format: "csv" | "json" | "xml", options?: any) => Promise<string>;
191
- export declare const getLogs: () => any[];
192
- export declare const clearLogs: () => void;
193
- export declare const getLogStats: () => Record<string, number>;
194
- /**
195
- * Remote logging functionality
196
- */
197
- export declare const addRemoteHandler: (endpoint: string, apiKey?: string) => void;
198
- export declare const clearRemoteHandlers: () => void;
199
- export declare const flushRemoteHandlers: () => Promise<void>;
200
- export default exportLogger;
201
- export { ExportLogHandler, RemoteLogHandler } from './handlers/index.js';
202
- export type { ILogHandler } from './types/index.js';
203
- //# sourceMappingURL=exports-module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exports-module.d.ts","sourceRoot":"","sources":["../src/exports-module.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EACR,QAAQ,EACR,SAAS,EACT,WAAW,EACd,MAAM,kBAAkB,CAAC;AAQ1B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAa,SAAQ,MAAM;IACpC,OAAO,CAAC,gBAAgB,CAAC,CAAmB;IAC5C,OAAO,CAAC,cAAc,CAA0B;gBAEpC,MAAM,GAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,GAAQ;IAUtD;;;;;;;;;;;;;;;OAeG;IACG,UAAU,CACZ,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,EAC9B,OAAO,CAAC,EAAE;QACN,MAAM,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,QAAQ,CAAC;YAAC,IAAI,CAAC,EAAE,IAAI,CAAC;YAAC,EAAE,CAAC,EAAE,IAAI,CAAA;SAAE,CAAC;QACtD,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,GACF,OAAO,CAAC,MAAM,CAAC;IASlB;;;;;;;;;;OAUG;IACH,OAAO,IAAI,GAAG,EAAE;IAShB;;;;;;;OAOG;IACH,SAAS,IAAI,IAAI;IAMjB;;;;;;;;;;OAUG;IACH,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IASrC;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAMzD;;;;;;;OAOG;IACH,mBAAmB,IAAI,IAAI;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