@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
@@ -1,156 +0,0 @@
1
- /**
2
- * @fileoverview File-based log handler for Advanced Logger
3
- */
4
- import { isNode, isBrowser } from '../utils/environment.js';
5
- import { safeSerialize } from '../utils/formatting.js';
6
- /**
7
- * Universal file-based log handler for persistent logging
8
- * Works in both Node.js (real files) and browser (localStorage)
9
- */
10
- export class FileLogHandler {
11
- filename;
12
- maxSize;
13
- fs; // Node.js fs module
14
- constructor(filename = 'app.log', maxSize) {
15
- this.filename = filename;
16
- this.maxSize = maxSize;
17
- // Load Node.js fs module if in Node environment
18
- if (isNode) {
19
- try {
20
- this.fs = require('fs');
21
- }
22
- catch (error) {
23
- console.warn('FileLogHandler: Unable to load fs module:', error);
24
- }
25
- }
26
- }
27
- handle(level, message, args, metadata) {
28
- const logEntry = {
29
- timestamp: metadata.timestamp,
30
- level: level.toUpperCase(),
31
- prefix: metadata.prefix,
32
- message,
33
- args: args.slice(1).map(arg => safeSerialize(arg)),
34
- location: metadata.stackInfo,
35
- };
36
- const logLine = this.formatLogLine(logEntry);
37
- if (isNode && this.fs) {
38
- this.writeToFileNode(logLine);
39
- }
40
- else if (isBrowser) {
41
- this.writeToFileLocal(logLine);
42
- }
43
- else {
44
- // Fallback - just console output
45
- console.log(`[FILE-LOG] ${logLine}`);
46
- }
47
- }
48
- /**
49
- * Format log entry as a single line for file storage
50
- */
51
- formatLogLine(entry) {
52
- const parts = [
53
- entry.timestamp,
54
- `[${entry.level}]`,
55
- entry.prefix ? `[${entry.prefix}]` : '',
56
- entry.message
57
- ].filter(Boolean);
58
- let line = parts.join(' ');
59
- if (entry.args && entry.args.length > 0) {
60
- line += ' ' + entry.args.map((arg) => typeof arg === 'object' ? JSON.stringify(arg) : String(arg)).join(' ');
61
- }
62
- if (entry.location) {
63
- line += ` (${entry.location.file}:${entry.location.line}:${entry.location.column})`;
64
- }
65
- return line;
66
- }
67
- /**
68
- * Write to actual file in Node.js environment
69
- */
70
- writeToFileNode(logLine) {
71
- if (!this.fs)
72
- return;
73
- try {
74
- // Check file size if maxSize is set
75
- if (this.maxSize) {
76
- try {
77
- const stats = this.fs.statSync(this.filename);
78
- if (stats.size > this.maxSize) {
79
- // Simple rotation: backup current file and start fresh
80
- const backupName = `${this.filename}.bak`;
81
- this.fs.renameSync(this.filename, backupName);
82
- }
83
- }
84
- catch (error) {
85
- // File doesn't exist yet, that's fine
86
- }
87
- }
88
- // Append to file
89
- this.fs.appendFileSync(this.filename, logLine + '\n', 'utf8');
90
- }
91
- catch (error) {
92
- console.error('FileLogHandler: Failed to write to file:', error);
93
- }
94
- }
95
- /**
96
- * Write to localStorage in browser environment
97
- */
98
- writeToFileLocal(logLine) {
99
- try {
100
- const storageKey = `logger_${this.filename}`;
101
- const existingLogs = localStorage.getItem(storageKey) || '';
102
- let newLogs = existingLogs;
103
- if (existingLogs.length > 0) {
104
- newLogs += '\n';
105
- }
106
- newLogs += logLine;
107
- // Simple size management - keep last 1000 lines max
108
- if (this.maxSize || newLogs.split('\n').length > 1000) {
109
- const lines = newLogs.split('\n');
110
- const maxLines = this.maxSize ? Math.floor(this.maxSize / 100) : 1000;
111
- if (lines.length > maxLines) {
112
- newLogs = lines.slice(-maxLines).join('\n');
113
- }
114
- }
115
- localStorage.setItem(storageKey, newLogs);
116
- }
117
- catch (error) {
118
- console.error('FileLogHandler: Failed to write to localStorage:', error);
119
- }
120
- }
121
- /**
122
- * Get stored logs (useful for debugging)
123
- */
124
- getLogs() {
125
- if (isNode && this.fs) {
126
- try {
127
- return this.fs.readFileSync(this.filename, 'utf8');
128
- }
129
- catch (error) {
130
- return null;
131
- }
132
- }
133
- else if (isBrowser) {
134
- const storageKey = `logger_${this.filename}`;
135
- return localStorage.getItem(storageKey);
136
- }
137
- return null;
138
- }
139
- /**
140
- * Clear stored logs
141
- */
142
- clearLogs() {
143
- if (isNode && this.fs) {
144
- try {
145
- this.fs.writeFileSync(this.filename, '', 'utf8');
146
- }
147
- catch (error) {
148
- console.error('FileLogHandler: Failed to clear file:', error);
149
- }
150
- }
151
- else if (isBrowser) {
152
- const storageKey = `logger_${this.filename}`;
153
- localStorage.removeItem(storageKey);
154
- }
155
- }
156
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * @fileoverview Remote log handler for Advanced Logger
3
- */
4
- import type { ILogHandler, LogLevel, LogMetadata } from '../types/index.js';
5
- /**
6
- * Remote log handler for sending logs to external services
7
- */
8
- export declare class RemoteLogHandler implements ILogHandler {
9
- private endpoint;
10
- private apiKey?;
11
- constructor(endpoint: string, apiKey?: string);
12
- handle(level: LogLevel, message: string, args: any[], metadata: LogMetadata): Promise<void>;
13
- }
14
- //# sourceMappingURL=RemoteLogHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RemoteLogHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/RemoteLogHandler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5E;;GAEG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAChD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAC,CAAS;gBAEZ,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAKvC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAuBpG"}
@@ -1,37 +0,0 @@
1
- /**
2
- * @fileoverview Remote log handler for Advanced Logger
3
- */
4
- /**
5
- * Remote log handler for sending logs to external services
6
- */
7
- export class RemoteLogHandler {
8
- endpoint;
9
- apiKey;
10
- constructor(endpoint, apiKey) {
11
- this.endpoint = endpoint;
12
- this.apiKey = apiKey;
13
- }
14
- async handle(level, message, args, metadata) {
15
- try {
16
- const payload = {
17
- timestamp: metadata.timestamp,
18
- level,
19
- message,
20
- prefix: metadata.prefix,
21
- location: metadata.stackInfo,
22
- additional: args.slice(1),
23
- };
24
- await fetch(this.endpoint, {
25
- method: 'POST',
26
- headers: {
27
- 'Content-Type': 'application/json',
28
- ...(this.apiKey && { 'Authorization': `Bearer ${this.apiKey}` }),
29
- },
30
- body: JSON.stringify(payload),
31
- });
32
- }
33
- catch (error) {
34
- // Silently fail to avoid infinite logging loops
35
- }
36
- }
37
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * @fileoverview Log handlers exports for Advanced Logger
3
- */
4
- export { FileLogHandler } from './FileLogHandler.js';
5
- export { RemoteLogHandler } from './RemoteLogHandler.js';
6
- export { AnalyticsLogHandler } from './AnalyticsLogHandler.js';
7
- export { ExportLogHandler } from './ExportLogHandler.js';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * @fileoverview Log handlers exports for Advanced Logger
3
- */
4
- export { FileLogHandler } from './FileLogHandler.js';
5
- export { RemoteLogHandler } from './RemoteLogHandler.js';
6
- export { AnalyticsLogHandler } from './AnalyticsLogHandler.js';
7
- export { ExportLogHandler } from './ExportLogHandler.js';
package/dist/index.d.ts DELETED
@@ -1,157 +0,0 @@
1
- /**
2
- * @fileoverview Better Logger - Librería completa con todas las características
3
- * @version 0.3.0
4
- * @since 2024
5
- *
6
- * Punto de entrada principal que proporciona la experiencia completa de Better Logger
7
- * con características avanzadas incluyendo estilos CSS, soporte SVG, animaciones,
8
- * capacidades de exportación y logging remoto.
9
- *
10
- * @module @mks2508/better-logger
11
- */
12
- import { Logger } from './Logger.js';
13
- import type { Verbosity, ThemeVariant, BannerType, StyleOptions, ILogHandler } from './types/index.js';
14
- declare const logger: Logger;
15
- /**
16
- * Clase principal Logger con conjunto completo de características
17
- *
18
- * @example
19
- * // Importación y uso básico
20
- * import { Logger } from '@mks2508/better-logger';
21
- *
22
- * const logger = new Logger();
23
- * logger.preset('cyberpunk'); // Aplicar preset completo
24
- * logger.info('¡Hola mundo!');
25
- *
26
- * @example
27
- * // Logger con scope para componentes
28
- * const auth = logger.component('Auth');
29
- * auth.info('Usuario autenticando...');
30
- * auth.success('Login exitoso');
31
- *
32
- * @example
33
- * // Logger para APIs con badges
34
- * const api = logger.api('GraphQL');
35
- * api.badges(['v2', 'cached']).info('Query ejecutada');
36
- *
37
- * @since 0.3.0
38
- */
39
- export { Logger };
40
- /**
41
- * Instancia singleton del logger lista para usar
42
- * @default
43
- *
44
- * @example
45
- * // Uso directo sin crear instancia
46
- * import logger from '@mks2508/better-logger';
47
- *
48
- * logger.info('Aplicación iniciada');
49
- * logger.success('Conexión establecida');
50
- * logger.warn('Memoria al 80%');
51
- * logger.error('Fallo en conexión');
52
- */
53
- export default logger;
54
- /**
55
- * Métodos de logging individuales (enlazados al singleton)
56
- *
57
- * @example
58
- * // Importar solo los métodos necesarios
59
- * import { info, error, success } from '@mks2508/better-logger';
60
- *
61
- * info('Proceso iniciado');
62
- * success('✓ Completado exitosamente');
63
- * error('Error:', errorDetails);
64
- *
65
- * @since 0.3.0
66
- */
67
- export declare const debug: (...args: any[]) => void;
68
- export declare const info: (...args: any[]) => void;
69
- export declare const warn: (...args: any[]) => void;
70
- export declare const error: (...args: any[]) => void;
71
- export declare const success: (...args: any[]) => void;
72
- export declare const critical: (...args: any[]) => void;
73
- export declare const trace: (...args: any[]) => void;
74
- export declare const table: (data: any, columns?: string[]) => void;
75
- export declare const group: (label: string, collapsed?: boolean) => void;
76
- export declare const groupEnd: () => void;
77
- export declare const time: (label: string) => void;
78
- export declare const timeEnd: (label: string) => void;
79
- export declare const setGlobalPrefix: (prefix: string) => void;
80
- export declare const scope: (prefix: string) => any;
81
- export declare const setVerbosity: (level: Verbosity) => void;
82
- export declare const addHandler: (handler: ILogHandler) => void;
83
- export declare const setTheme: (theme: ThemeVariant) => void;
84
- export declare const setBannerType: (bannerType: BannerType) => void;
85
- export declare const showBanner: (bannerType?: BannerType) => void;
86
- export declare const logWithSVG: (message: string, svgContent?: string, options?: StyleOptions) => void;
87
- export declare const logAnimated: (message: string, duration?: number) => void;
88
- export declare const cli: (command: string) => Promise<void>;
89
- export type { LogLevel, Verbosity, ThemeVariant, BannerType, StyleOptions, ILogHandler, LoggerConfig, LogMetadata, StackInfo, TimerEntry } from './types/index.js';
90
- export { StyleBuilder, StylePresets, THEME_PRESETS, THEME_BANNERS, BANNER_VARIANTS } from './styling/index.js';
91
- export { FileLogHandler, RemoteLogHandler, AnalyticsLogHandler } from './handlers/index.js';
92
- export { DEFAULT_CONFIG } from './constants.js';
93
- export { parseStackTrace, formatTimestamp } from './utils/index.js';
94
- /**
95
- * Utilidades de estilo para crear estilos personalizados de consola
96
- *
97
- * @example
98
- * // Crear estilo personalizado
99
- * import { createStyle, stylePresets } from '@mks2508/better-logger';
100
- *
101
- * const miEstilo = createStyle()
102
- * .bg('linear-gradient(45deg, #ff6b6b, #feca57)')
103
- * .color('white')
104
- * .padding('10px')
105
- * .rounded('8px')
106
- * .bold()
107
- * .build();
108
- *
109
- * console.log('%cMensaje estilizado', miEstilo);
110
- *
111
- * @example
112
- * // Usar presets predefinidos
113
- * console.log('%cÉxito!', stylePresets.success);
114
- * console.log('%cError!', stylePresets.error);
115
- *
116
- * @since 0.3.0
117
- */
118
- import { StyleBuilder } from './styling/index.js';
119
- /**
120
- * Crea una nueva instancia de StyleBuilder para estilos personalizados de consola
121
- *
122
- * @returns {StyleBuilder} Constructor de estilos encadenable
123
- *
124
- * @example
125
- * const estilo = createStyle()
126
- * .gradient('#667eea', '#764ba2')
127
- * .color('white')
128
- * .padding('8px 16px')
129
- * .rounded('4px')
130
- * .shadow('0 2px 4px rgba(0,0,0,0.2)')
131
- * .build();
132
- *
133
- * @since 0.3.0
134
- */
135
- export declare const createStyle: () => StyleBuilder;
136
- /**
137
- * Presets de estilo predefinidos para casos de uso comunes
138
- *
139
- * @constant {Object} stylePresets
140
- *
141
- * @example
142
- * console.log('%cOperación exitosa', stylePresets.success);
143
- * console.log('%cAdvertencia', stylePresets.warning);
144
- * console.log('%cError crítico', stylePresets.error);
145
- * console.log('%cInformación', stylePresets.info);
146
- * console.log('%cDestacado', stylePresets.accent);
147
- *
148
- * @since 0.3.0
149
- */
150
- export declare const stylePresets: {
151
- success: string;
152
- error: string;
153
- warning: string;
154
- info: string;
155
- accent: string;
156
- };
157
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
package/dist/main.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=main.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":""}
package/dist/main.js DELETED
@@ -1,139 +0,0 @@
1
- import { debug, info, warn, error, success, critical, table, group, groupEnd, time, timeEnd, trace, scope, cli, setTheme, setBannerType, showBanner, logWithSVG, logAnimated, createStyle, stylePresets } from './index.js';
2
- import { demonstrateBanners, demonstrateThemes, demonstrateSVG, demonstrateAnimations, demonstrateCLI, demonstrateExports, demonstrateAllFeatures as demoAllFeatures } from './example.js';
3
- console.log('%cBetter Logger Demo Ready! 🚀', 'background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 10px 20px; border-radius: 8px; font-weight: bold; font-size: 14px;');
4
- console.log('📋 Available test functions: testDebug(), testBanners(), testThemes(), and more!');
5
- console.log('💻 CLI Available: cli("/help") for commands');
6
- function testDebug() {
7
- debug("This is a debug message.", { user: "test", id: 123 });
8
- }
9
- function testInfo() {
10
- info("This is an info message with an object.", { data: "payload" });
11
- }
12
- function testWarn() {
13
- warn("This is a warning message about a deprecated API.");
14
- }
15
- function testError() {
16
- error("This is an error message.", new Error("Failed to fetch resource."));
17
- }
18
- function testSuccess() {
19
- success("Operation completed successfully.");
20
- }
21
- function testCritical() {
22
- critical("This is a CRITICAL message. System integrity compromised!");
23
- }
24
- function testTable() {
25
- table([
26
- { feature: "Debug Log", status: "Implemented", priority: "Low" },
27
- { feature: "Info Log", status: "Implemented", priority: "Medium" },
28
- { feature: "Warning Log", status: "Implemented", priority: "High" },
29
- ]);
30
- }
31
- function testGrouping() {
32
- group("User Authentication Flow", true); // Start collapsed
33
- info("User 'testuser' attempting to log in...");
34
- warn("Password nearing expiration.");
35
- success("Login successful.");
36
- groupEnd();
37
- }
38
- function testTiming() {
39
- time("dataProcessing");
40
- setTimeout(() => {
41
- timeEnd("dataProcessing");
42
- }, 750); // Simulate a 750ms operation
43
- }
44
- function testScopedLogger() {
45
- info("Demonstrating scoped loggers...");
46
- const apiLogger = scope("API");
47
- apiLogger.info("Fetching user data...");
48
- const uiLogger = scope("UI");
49
- uiLogger.debug("Rendering user profile component.");
50
- apiLogger.success("User data fetched successfully.");
51
- apiLogger.error("Failed to update settings.");
52
- }
53
- function testTrace() {
54
- function innerFunction() {
55
- function deepFunction() {
56
- trace("Trace from a deeply nested function.");
57
- }
58
- deepFunction();
59
- }
60
- innerFunction();
61
- }
62
- // Visual feature tests
63
- function testBanners() {
64
- demonstrateBanners();
65
- }
66
- function testThemes() {
67
- demonstrateThemes();
68
- }
69
- function testSVG() {
70
- demonstrateSVG();
71
- }
72
- function testAnimations() {
73
- demonstrateAnimations();
74
- }
75
- function testCLI() {
76
- demonstrateCLI();
77
- }
78
- function testExports() {
79
- demonstrateExports();
80
- }
81
- function testAllFeatures() {
82
- group("🌟 Demonstrating Core Logger Features");
83
- testDebug();
84
- testInfo();
85
- testWarn();
86
- testError();
87
- testSuccess();
88
- testCritical();
89
- testTable();
90
- testGrouping();
91
- testTiming();
92
- testScopedLogger();
93
- testTrace();
94
- groupEnd();
95
- setTimeout(() => {
96
- info('🎨 Running visual features demo...');
97
- demoAllFeatures();
98
- }, 2000);
99
- }
100
- // Expose functions to global scope for onclick attributes in index.html
101
- if (typeof window !== 'undefined') {
102
- // Core logging tests
103
- window.testDebug = testDebug;
104
- window.testInfo = testInfo;
105
- window.testWarn = testWarn;
106
- window.testError = testError;
107
- window.testSuccess = testSuccess;
108
- window.testCritical = testCritical;
109
- window.testTable = testTable;
110
- window.testGrouping = testGrouping;
111
- window.testTiming = testTiming;
112
- window.testScopedLogger = testScopedLogger;
113
- window.testTrace = testTrace;
114
- window.testAllFeatures = testAllFeatures;
115
- // Visual feature tests
116
- window.testBanners = testBanners;
117
- window.testThemes = testThemes;
118
- window.testSVG = testSVG;
119
- window.testAnimations = testAnimations;
120
- window.testCLI = testCLI;
121
- window.testExports = testExports;
122
- // Direct access to library functions
123
- window.cli = cli;
124
- window.setTheme = setTheme;
125
- window.setBannerType = setBannerType;
126
- window.showBanner = showBanner;
127
- window.logWithSVG = logWithSVG;
128
- window.logAnimated = logAnimated;
129
- window.createStyle = createStyle;
130
- window.stylePresets = stylePresets;
131
- // Display welcome info
132
- setTimeout(() => {
133
- console.log('%c💡 Quick Start Guide', stylePresets.info);
134
- console.log('🎨 Visual: testBanners(), testThemes(), testSVG(), testAnimations()');
135
- console.log('📊 Core: testTable(), testGrouping(), testTiming(), testTrace()');
136
- console.log('💻 CLI: cli("/help") - Try commands like "/theme neon", "/banner ascii"');
137
- console.log('🌟 Full Demo: testAllFeatures()');
138
- }, 1000);
139
- }