@mks2508/better-logger 1.0.0 → 1.2.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.
- package/.claude/settings.local.json +5 -3
- package/CHANGELOG.md +63 -0
- package/bun.lock +10 -0
- package/dist/Logger.d.ts.map +1 -0
- package/dist/ScopedLogger.d.ts.map +1 -0
- package/dist/chunks/{Logger-CTAaDeZi.js → Logger-BynuRJQf.js} +12 -6
- package/dist/chunks/Logger-BynuRJQf.js.map +1 -0
- package/dist/chunks/{Logger-D8pK7XXt.js → Logger-DMjlVQWi.js} +2 -2
- package/dist/chunks/Logger-DMjlVQWi.js.map +1 -0
- package/dist/chunks/{ScopedLogger-hS0qSkZD.js → ScopedLogger-Bl56WovH.js} +2 -2
- package/dist/chunks/{ScopedLogger-hS0qSkZD.js.map → ScopedLogger-Bl56WovH.js.map} +1 -1
- package/dist/chunks/{ScopedLogger-D-7q8uVP.js → ScopedLogger-D2HzayKH.js} +2 -2
- package/dist/chunks/{ScopedLogger-D-7q8uVP.js.map → ScopedLogger-D2HzayKH.js.map} +1 -1
- package/dist/chunks/environment--eaTrhRu.js +4 -0
- package/dist/chunks/environment--eaTrhRu.js.map +1 -0
- package/dist/chunks/environment-BanAyF-K.js +1172 -0
- package/dist/chunks/environment-BanAyF-K.js.map +1 -0
- package/dist/chunks/formatting-BSNvAxLK.js +2 -0
- package/dist/chunks/formatting-BSNvAxLK.js.map +1 -0
- package/dist/chunks/formatting-CgQSWgXR.js +380 -0
- package/dist/chunks/formatting-CgQSWgXR.js.map +1 -0
- package/dist/cli/CommandProcessor.d.ts.map +1 -0
- package/dist/cli/commands/ConfigCommand.d.ts.map +1 -0
- package/dist/cli/commands/ExportCommand.d.ts.map +1 -0
- package/dist/cli/commands/HistoryCommand.d.ts.map +1 -0
- package/dist/cli/commands/StatusCommand.d.ts.map +1 -0
- package/dist/cli/commands/ThemeCommand.d.ts.map +1 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/{types/constants.d.ts → constants.d.ts} +108 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +127 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +6 -5
- package/dist/core.js.map +1 -1
- package/dist/example.d.ts.map +1 -0
- package/dist/exports-module.d.ts.map +1 -0
- package/dist/exports.cjs +1 -1
- package/dist/exports.js +2 -2
- package/dist/handlers/AnalyticsLogHandler.d.ts.map +1 -0
- package/dist/handlers/ExportLogHandler.d.ts.map +1 -0
- package/dist/handlers/FileLogHandler.d.ts.map +1 -0
- package/dist/handlers/RemoteLogHandler.d.ts.map +1 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +124 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -5
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -0
- package/dist/styling/LogStyleBuilder.d.ts.map +1 -0
- package/dist/styling/SemanticStyles.d.ts.map +1 -0
- package/dist/styling/SmartPresets.d.ts.map +1 -0
- package/dist/styling/StyleBuilder.d.ts.map +1 -0
- package/dist/styling/banners.d.ts.map +1 -0
- package/dist/styling/index.d.ts.map +1 -0
- package/dist/styling/themes.d.ts.map +1 -0
- package/dist/styling-module.d.ts.map +1 -0
- package/dist/styling.cjs +1 -1
- package/dist/styling.js +3 -3
- package/dist/terminal/terminal-renderer.d.ts +63 -0
- package/dist/terminal/terminal-renderer.d.ts.map +1 -0
- package/dist/types/core.d.ts +229 -122
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/handlers.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -119
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/adapter.d.ts +48 -0
- package/dist/utils/adapter.d.ts.map +1 -0
- package/dist/utils/ansi-colors.d.ts +156 -0
- package/dist/utils/ansi-colors.d.ts.map +1 -0
- package/dist/utils/environment-detector.d.ts +35 -0
- package/dist/utils/environment-detector.d.ts.map +1 -0
- package/dist/{types/utils → utils}/environment.d.ts +1 -1
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/{types/utils → utils}/formatting.d.ts +22 -1
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/{types/utils → utils}/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/opentui-detection.d.ts.map +1 -0
- package/dist/{types/utils → utils}/output.d.ts +7 -2
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/stackTrace.d.ts.map +1 -0
- package/dist/utils/timestamps.d.ts.map +1 -0
- package/package.json +10 -2
- package/src/Logger.ts +24 -19
- package/src/constants.ts +131 -1
- package/src/core.ts +11 -7
- package/src/handlers/ExportLogHandler.ts +2 -1
- package/src/index.ts +30 -2
- package/src/styling/SemanticStyles.ts +1 -1
- package/src/terminal/terminal-renderer.ts +339 -0
- package/src/types/core.ts +15 -1
- package/src/types/index.ts +1 -0
- package/src/utils/adapter.ts +291 -0
- package/src/utils/ansi-colors.ts +333 -0
- package/src/utils/environment-detector.ts +148 -0
- package/src/utils/formatting.ts +196 -6
- package/src/utils/index.ts +23 -11
- package/src/utils/output.ts +43 -1
- package/vite.config.ts +1 -1
- package/dist/chunks/Logger-CTAaDeZi.js.map +0 -1
- package/dist/chunks/Logger-D8pK7XXt.js.map +0 -1
- package/dist/chunks/environment-Bxbnw4pd.js +0 -544
- package/dist/chunks/environment-Bxbnw4pd.js.map +0 -1
- package/dist/chunks/environment-Dm66zOML.js +0 -4
- package/dist/chunks/environment-Dm66zOML.js.map +0 -1
- package/dist/chunks/formatting-C0riPC5_.js +0 -95
- package/dist/chunks/formatting-C0riPC5_.js.map +0 -1
- package/dist/chunks/formatting-DNCAV66-.js +0 -2
- package/dist/chunks/formatting-DNCAV66-.js.map +0 -1
- package/dist/types/Logger.d.ts.map +0 -1
- package/dist/types/ScopedLogger.d.ts.map +0 -1
- package/dist/types/cli/CommandProcessor.d.ts.map +0 -1
- package/dist/types/cli/commands/ConfigCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/ExportCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/HistoryCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/StatusCommand.d.ts.map +0 -1
- package/dist/types/cli/commands/ThemeCommand.d.ts.map +0 -1
- package/dist/types/cli/help.d.ts.map +0 -1
- package/dist/types/cli/index.d.ts.map +0 -1
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/example.d.ts.map +0 -1
- package/dist/types/exports-module.d.ts.map +0 -1
- package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/ExportLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/FileLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/RemoteLogHandler.d.ts.map +0 -1
- package/dist/types/handlers/index.d.ts.map +0 -1
- package/dist/types/main.d.ts.map +0 -1
- package/dist/types/styling/LogStyleBuilder.d.ts.map +0 -1
- package/dist/types/styling/SemanticStyles.d.ts.map +0 -1
- package/dist/types/styling/SmartPresets.d.ts.map +0 -1
- package/dist/types/styling/StyleBuilder.d.ts.map +0 -1
- package/dist/types/styling/banners.d.ts.map +0 -1
- package/dist/types/styling/index.d.ts.map +0 -1
- package/dist/types/styling/themes.d.ts.map +0 -1
- package/dist/types/styling-module.d.ts.map +0 -1
- package/dist/types/types/core.d.ts +0 -221
- package/dist/types/types/core.d.ts.map +0 -1
- package/dist/types/types/handlers.d.ts.map +0 -1
- package/dist/types/types/index.d.ts +0 -7
- package/dist/types/types/index.d.ts.map +0 -1
- package/dist/types/utils/environment.d.ts.map +0 -1
- package/dist/types/utils/formatting.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/types/utils/opentui-detection.d.ts.map +0 -1
- package/dist/types/utils/output.d.ts.map +0 -1
- package/dist/types/utils/stackTrace.d.ts.map +0 -1
- package/dist/types/utils/timestamps.d.ts.map +0 -1
- /package/dist/{types/Logger.d.ts → Logger.d.ts} +0 -0
- /package/dist/{types/ScopedLogger.d.ts → ScopedLogger.d.ts} +0 -0
- /package/dist/{types/cli → cli}/CommandProcessor.d.ts +0 -0
- /package/dist/{types/cli → cli}/commands/ConfigCommand.d.ts +0 -0
- /package/dist/{types/cli → cli}/commands/ExportCommand.d.ts +0 -0
- /package/dist/{types/cli → cli}/commands/HistoryCommand.d.ts +0 -0
- /package/dist/{types/cli → cli}/commands/StatusCommand.d.ts +0 -0
- /package/dist/{types/cli → cli}/commands/ThemeCommand.d.ts +0 -0
- /package/dist/{types/cli → cli}/help.d.ts +0 -0
- /package/dist/{types/cli → cli}/index.d.ts +0 -0
- /package/dist/{types/example.d.ts → example.d.ts} +0 -0
- /package/dist/{types/exports-module.d.ts → exports-module.d.ts} +0 -0
- /package/dist/{types/handlers → handlers}/AnalyticsLogHandler.d.ts +0 -0
- /package/dist/{types/handlers → handlers}/ExportLogHandler.d.ts +0 -0
- /package/dist/{types/handlers → handlers}/FileLogHandler.d.ts +0 -0
- /package/dist/{types/handlers → handlers}/RemoteLogHandler.d.ts +0 -0
- /package/dist/{types/handlers → handlers}/index.d.ts +0 -0
- /package/dist/{types/main.d.ts → main.d.ts} +0 -0
- /package/dist/{types/styling → styling}/LogStyleBuilder.d.ts +0 -0
- /package/dist/{types/styling → styling}/SemanticStyles.d.ts +0 -0
- /package/dist/{types/styling → styling}/SmartPresets.d.ts +0 -0
- /package/dist/{types/styling → styling}/StyleBuilder.d.ts +0 -0
- /package/dist/{types/styling → styling}/banners.d.ts +0 -0
- /package/dist/{types/styling → styling}/index.d.ts +0 -0
- /package/dist/{types/styling → styling}/themes.d.ts +0 -0
- /package/dist/{types/styling-module.d.ts → styling-module.d.ts} +0 -0
- /package/dist/types/{types/handlers.d.ts → handlers.d.ts} +0 -0
- /package/dist/{types/utils → utils}/opentui-detection.d.ts +0 -0
- /package/dist/{types/utils → utils}/stackTrace.d.ts +0 -0
- /package/dist/{types/utils → utils}/timestamps.d.ts +0 -0
package/dist/types/core.d.ts
CHANGED
|
@@ -1,127 +1,234 @@
|
|
|
1
|
-
import { Verbosity, LoggerConfig, ILogHandler } from './types/index.js';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* @fileoverview Definiciones de tipos principales para Better Logger
|
|
3
|
+
* @version 0.3.0
|
|
4
|
+
* @since 2024
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Niveles de log soportados en orden jerárquico (debug < info < warn < error < critical)
|
|
8
|
+
*
|
|
9
|
+
* @constant {Object} LOG_LEVELS
|
|
10
|
+
* @property {number} debug - Nivel 0: Información de depuración detallada
|
|
11
|
+
* @property {number} info - Nivel 1: Mensajes informativos generales
|
|
12
|
+
* @property {number} warn - Nivel 2: Advertencias que no detienen la ejecución
|
|
13
|
+
* @property {number} error - Nivel 3: Errores que pueden afectar funcionalidad
|
|
14
|
+
* @property {number} critical - Nivel 4: Errores críticos que requieren atención inmediata
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Verificar si un nivel debe mostrarse
|
|
18
|
+
* if (LOG_LEVELS[currentLevel] >= LOG_LEVELS.warn) {
|
|
19
|
+
* // Mostrar solo warn, error y critical
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
export declare const LOG_LEVELS: {
|
|
23
|
+
readonly debug: 0;
|
|
24
|
+
readonly info: 1;
|
|
25
|
+
readonly warn: 2;
|
|
26
|
+
readonly error: 3;
|
|
27
|
+
readonly critical: 4;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Tipo de nivel de log derivado de las claves de LOG_LEVELS
|
|
31
|
+
* @typedef {'debug' | 'info' | 'warn' | 'error' | 'critical'} LogLevel
|
|
32
|
+
*/
|
|
33
|
+
export type LogLevel = keyof typeof LOG_LEVELS;
|
|
34
|
+
/**
|
|
35
|
+
* Tipo de nivel de verbosidad para filtrar logs
|
|
36
|
+
* @typedef {LogLevel | 'silent'} Verbosity
|
|
37
|
+
* @description 'silent' desactiva completamente todos los logs
|
|
38
|
+
*/
|
|
39
|
+
export type Verbosity = LogLevel | 'silent';
|
|
40
|
+
/**
|
|
41
|
+
* Variantes de tema para diferentes estilos visuales
|
|
42
|
+
* @typedef {'default' | 'dark' | 'light' | 'neon' | 'minimal' | 'cyberpunk'} ThemeVariant
|
|
43
|
+
*
|
|
44
|
+
* @description
|
|
45
|
+
* - default: Tema adaptativo automático (claro/oscuro)
|
|
46
|
+
* - dark: Tema oscuro con colores vibrantes
|
|
47
|
+
* - light: Tema claro con colores suaves
|
|
48
|
+
* - neon: Colores neón brillantes con efectos de resplandor
|
|
49
|
+
* - minimal: Diseño minimalista y limpio
|
|
50
|
+
* - cyberpunk: Estilo futurista con neón y efectos
|
|
51
|
+
*/
|
|
52
|
+
export type ThemeVariant = 'default' | 'dark' | 'light' | 'neon' | 'minimal' | 'cyberpunk';
|
|
53
|
+
/**
|
|
54
|
+
* Detección de tema de DevTools del navegador
|
|
55
|
+
* @typedef {'light' | 'dark'} DevToolsTheme
|
|
56
|
+
*/
|
|
57
|
+
export type DevToolsTheme = 'light' | 'dark';
|
|
58
|
+
/**
|
|
59
|
+
* Tipos de banner para diferentes enfoques visuales
|
|
60
|
+
* @typedef {'simple' | 'ascii' | 'unicode' | 'svg' | 'animated'} BannerType
|
|
61
|
+
*
|
|
62
|
+
* @description
|
|
63
|
+
* - simple: Texto simple sin decoración
|
|
64
|
+
* - ascii: Arte ASCII tradicional
|
|
65
|
+
* - unicode: Caracteres Unicode decorativos
|
|
66
|
+
* - svg: Gráfico SVG embebido
|
|
67
|
+
* - animated: Banner con animación CSS
|
|
68
|
+
*/
|
|
69
|
+
export type BannerType = 'simple' | 'ascii' | 'unicode' | 'svg' | 'animated';
|
|
70
|
+
/**
|
|
71
|
+
* Formatos de exportación para datos de log
|
|
72
|
+
* @typedef {'json' | 'csv' | 'markdown' | 'plain' | 'html'} ExportFormat
|
|
73
|
+
*
|
|
74
|
+
* @description
|
|
75
|
+
* - json: Formato JSON estructurado
|
|
76
|
+
* - csv: Valores separados por comas para Excel/Sheets
|
|
77
|
+
* - markdown: Formato Markdown para documentación
|
|
78
|
+
* - plain: Texto plano sin formato
|
|
79
|
+
* - html: HTML con estilos para visualización web
|
|
80
|
+
*/
|
|
81
|
+
export type ExportFormat = 'json' | 'csv' | 'markdown' | 'plain' | 'html';
|
|
82
|
+
/**
|
|
83
|
+
* Formatos de salida para diferentes entornos
|
|
84
|
+
* @typedef {'auto' | 'plain' | 'ansi' | 'build' | 'ci'} OutputFormat
|
|
85
|
+
*
|
|
86
|
+
* @description
|
|
87
|
+
* - auto: Detección automática basada en entorno (recomendado)
|
|
88
|
+
* - plain: Texto plano sin colores (máxima compatibilidad)
|
|
89
|
+
* - ansi: Colores ANSI para terminales modernos
|
|
90
|
+
* - build: Formato optimizado para builds (Next.js, webpack, etc.)
|
|
91
|
+
* - ci: Formato optimizado para CI/CD (sin emojis, texto simple)
|
|
92
|
+
*/
|
|
93
|
+
export type OutputFormat = 'auto' | 'plain' | 'ansi' | 'build' | 'ci';
|
|
94
|
+
/**
|
|
95
|
+
* Interfaz de configuración para instancias del logger
|
|
96
|
+
*
|
|
97
|
+
* @interface LoggerConfig
|
|
98
|
+
* @since 0.3.0
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* const config: LoggerConfig = {
|
|
102
|
+
* globalPrefix: 'MiApp',
|
|
103
|
+
* verbosity: 'info',
|
|
104
|
+
* enableColors: true,
|
|
105
|
+
* enableTimestamps: true,
|
|
106
|
+
* enableStackTrace: false,
|
|
107
|
+
* theme: 'cyberpunk',
|
|
108
|
+
* bannerType: 'animated',
|
|
109
|
+
* bufferSize: 500,
|
|
110
|
+
* autoDetectTheme: true
|
|
111
|
+
* };
|
|
112
|
+
*/
|
|
113
|
+
export interface LoggerConfig {
|
|
114
|
+
globalPrefix?: string;
|
|
115
|
+
verbosity: Verbosity;
|
|
116
|
+
enableColors: boolean;
|
|
117
|
+
enableTimestamps: boolean;
|
|
118
|
+
enableStackTrace: boolean;
|
|
119
|
+
theme?: ThemeVariant;
|
|
120
|
+
bannerType?: BannerType;
|
|
121
|
+
bufferSize?: number;
|
|
122
|
+
autoDetectTheme?: boolean;
|
|
123
|
+
outputFormat?: OutputFormat;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Información parseada del stack trace
|
|
127
|
+
*
|
|
128
|
+
* @interface StackInfo
|
|
129
|
+
* @description Contiene la ubicación exacta donde se originó el log
|
|
130
|
+
*/
|
|
131
|
+
export interface StackInfo {
|
|
132
|
+
file: string;
|
|
133
|
+
line: number;
|
|
134
|
+
column: number;
|
|
135
|
+
function?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Entrada de temporizador para medición de rendimiento
|
|
139
|
+
*
|
|
140
|
+
* @interface TimerEntry
|
|
141
|
+
* @description Usado internamente para rastrear temporizadores activos
|
|
142
|
+
*/
|
|
143
|
+
export interface TimerEntry {
|
|
144
|
+
label: string;
|
|
145
|
+
startTime: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Opciones para estilizar componentes
|
|
149
|
+
*
|
|
150
|
+
* @interface StyleOptions
|
|
151
|
+
* @description Configuración de dimensiones y espaciado para elementos visuales
|
|
152
|
+
*/
|
|
153
|
+
export interface StyleOptions {
|
|
154
|
+
width?: number;
|
|
155
|
+
height?: number;
|
|
156
|
+
padding?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Configuración de colores adaptativos para temas claro/oscuro
|
|
160
|
+
*
|
|
161
|
+
* @interface AdaptiveColors
|
|
162
|
+
* @description Define colores que se ajustan automáticamente al tema del navegador
|
|
163
|
+
*/
|
|
164
|
+
export interface AdaptiveColors {
|
|
165
|
+
light: string;
|
|
166
|
+
dark: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Configuración de espaciado para elementos del log
|
|
170
|
+
* @typedef {'compact' | 'normal' | 'spacious'} SpacingType
|
|
171
|
+
*
|
|
172
|
+
* @description
|
|
173
|
+
* - compact: Espaciado mínimo para más densidad
|
|
174
|
+
* - normal: Espaciado estándar balanceado
|
|
175
|
+
* - spacious: Espaciado amplio para mejor legibilidad
|
|
176
|
+
*/
|
|
177
|
+
export type SpacingType = 'compact' | 'normal' | 'spacious';
|
|
178
|
+
/**
|
|
179
|
+
* Configuración de layout para la estructura del log
|
|
180
|
+
*
|
|
181
|
+
* @interface LogLayout
|
|
182
|
+
* @description Define cómo se organizan visualmente los elementos del log
|
|
183
|
+
*/
|
|
184
|
+
export interface LogLayout {
|
|
185
|
+
spacing: SpacingType;
|
|
186
|
+
innerPadding?: string;
|
|
187
|
+
outerMargin?: string;
|
|
188
|
+
separator?: string;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Configuración para partes individuales del log
|
|
192
|
+
*
|
|
193
|
+
* @interface LogPartConfig
|
|
194
|
+
* @description Permite personalizar cada elemento del log por separado
|
|
4
195
|
*
|
|
5
196
|
* @example
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* Adds a custom log handler for extensibility
|
|
43
|
-
*/
|
|
44
|
-
addHandler(handler: ILogHandler): void;
|
|
45
|
-
/**
|
|
46
|
-
* Checks if a log level should be output based on current verbosity
|
|
47
|
-
*/
|
|
48
|
-
private shouldLog;
|
|
49
|
-
/**
|
|
50
|
-
* Gets the effective prefix (global + scoped)
|
|
51
|
-
*/
|
|
52
|
-
private getEffectivePrefix;
|
|
53
|
-
/**
|
|
54
|
-
* Core logging method with universal formatting
|
|
55
|
-
*/
|
|
56
|
-
private log;
|
|
57
|
-
/**
|
|
58
|
-
* Logs debug information (lowest priority)
|
|
59
|
-
*/
|
|
60
|
-
debug(...args: any[]): void;
|
|
61
|
-
/**
|
|
62
|
-
* Logs informational messages
|
|
63
|
-
*/
|
|
64
|
-
info(...args: any[]): void;
|
|
65
|
-
/**
|
|
66
|
-
* Logs warning messages
|
|
67
|
-
*/
|
|
68
|
-
warn(...args: any[]): void;
|
|
69
|
-
/**
|
|
70
|
-
* Logs error messages
|
|
71
|
-
*/
|
|
72
|
-
error(...args: any[]): void;
|
|
73
|
-
/**
|
|
74
|
-
* Logs critical errors (highest priority)
|
|
75
|
-
*/
|
|
76
|
-
critical(...args: any[]): void;
|
|
77
|
-
/**
|
|
78
|
-
* Logs trace information (detailed debugging)
|
|
79
|
-
*/
|
|
80
|
-
trace(...args: any[]): void;
|
|
81
|
-
/**
|
|
82
|
-
* Displays data in a table format
|
|
83
|
-
*/
|
|
84
|
-
table(data: any, columns?: string[]): void;
|
|
85
|
-
/**
|
|
86
|
-
* Starts a collapsible group in the console
|
|
87
|
-
*/
|
|
88
|
-
group(label: string, collapsed?: boolean): void;
|
|
89
|
-
/**
|
|
90
|
-
* Ends the current console group
|
|
91
|
-
*/
|
|
92
|
-
groupEnd(): void;
|
|
93
|
-
/**
|
|
94
|
-
* Starts a timer with the given label
|
|
95
|
-
*/
|
|
96
|
-
time(label: string): void;
|
|
97
|
-
/**
|
|
98
|
-
* Ends a timer and logs the elapsed time
|
|
99
|
-
*/
|
|
100
|
-
timeEnd(label: string): void;
|
|
101
|
-
/**
|
|
102
|
-
* Gets performance.now() or fallback for older environments
|
|
103
|
-
*/
|
|
104
|
-
private getPerformanceNow;
|
|
197
|
+
* const timestampConfig: LogPartConfig = {
|
|
198
|
+
* show: true,
|
|
199
|
+
* color: '#888',
|
|
200
|
+
* font: 'Monaco',
|
|
201
|
+
* size: '11px'
|
|
202
|
+
* };
|
|
203
|
+
*/
|
|
204
|
+
export interface LogPartConfig {
|
|
205
|
+
show?: boolean;
|
|
206
|
+
style?: string;
|
|
207
|
+
font?: string;
|
|
208
|
+
size?: string;
|
|
209
|
+
color?: string;
|
|
210
|
+
background?: string;
|
|
211
|
+
padding?: string;
|
|
212
|
+
margin?: string;
|
|
213
|
+
border?: string;
|
|
214
|
+
shadow?: string;
|
|
215
|
+
uppercase?: boolean;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Configuración completa de estilos del log
|
|
219
|
+
*
|
|
220
|
+
* @interface LogStyles
|
|
221
|
+
* @description Agrupa todas las opciones de estilo en una sola configuración
|
|
222
|
+
* @since 0.3.0
|
|
223
|
+
*/
|
|
224
|
+
export interface LogStyles {
|
|
225
|
+
layout?: LogLayout;
|
|
226
|
+
timestamp?: LogPartConfig;
|
|
227
|
+
level?: LogPartConfig;
|
|
228
|
+
prefix?: LogPartConfig;
|
|
229
|
+
message?: LogPartConfig;
|
|
230
|
+
location?: LogPartConfig;
|
|
231
|
+
backdrop?: string;
|
|
232
|
+
transparency?: number;
|
|
105
233
|
}
|
|
106
|
-
declare const coreLogger: CoreLogger;
|
|
107
|
-
/**
|
|
108
|
-
* Export individual methods for convenience (with proper binding)
|
|
109
|
-
*/
|
|
110
|
-
export declare const debug: (...args: any[]) => void;
|
|
111
|
-
export declare const info: (...args: any[]) => void;
|
|
112
|
-
export declare const warn: (...args: any[]) => void;
|
|
113
|
-
export declare const error: (...args: any[]) => void;
|
|
114
|
-
export declare const critical: (...args: any[]) => void;
|
|
115
|
-
export declare const trace: (...args: any[]) => void;
|
|
116
|
-
export declare const table: (data: any, columns?: string[]) => void;
|
|
117
|
-
export declare const group: (label: string, collapsed?: boolean) => void;
|
|
118
|
-
export declare const groupEnd: () => void;
|
|
119
|
-
export declare const time: (label: string) => void;
|
|
120
|
-
export declare const timeEnd: (label: string) => void;
|
|
121
|
-
export declare const setGlobalPrefix: (prefix: string) => void;
|
|
122
|
-
export declare const scope: (prefix: string) => CoreLogger;
|
|
123
|
-
export declare const setVerbosity: (level: Verbosity) => void;
|
|
124
|
-
export declare const addHandler: (handler: ILogHandler) => void;
|
|
125
|
-
export default coreLogger;
|
|
126
|
-
export type { LogLevel, Verbosity, LoggerConfig, ILogHandler, LogMetadata } from './types/index.js';
|
|
127
234
|
//# sourceMappingURL=core.d.ts.map
|
package/dist/types/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU;;;;;;CAMb,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,CAAC;AAE3F;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,GAAG,UAAU,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,GAAG,OAAO,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AAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QACN,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,aAAa,CAAC;QACxB,OAAO,CAAC,EAAE,aAAa,CAAC;KAC3B,CAAC;CACL;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;CACzC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,122 +1,7 @@
|
|
|
1
|
-
import { Logger } from './Logger.js';
|
|
2
|
-
import { Verbosity, ThemeVariant, BannerType, StyleOptions, ILogHandler } from './types/index.js';
|
|
3
|
-
import { StyleBuilder } from './styling/index.js';
|
|
4
1
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* // Importación y uso básico
|
|
9
|
-
* import { Logger } from '@mks2508/better-logger';
|
|
10
|
-
*
|
|
11
|
-
* const logger = new Logger();
|
|
12
|
-
* logger.preset('cyberpunk'); // Aplicar preset completo
|
|
13
|
-
* logger.info('¡Hola mundo!');
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* // Logger con scope para componentes
|
|
17
|
-
* const auth = logger.component('Auth');
|
|
18
|
-
* auth.info('Usuario autenticando...');
|
|
19
|
-
* auth.success('Login exitoso');
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // Logger para APIs con badges
|
|
23
|
-
* const api = logger.api('GraphQL');
|
|
24
|
-
* api.badges(['v2', 'cached']).info('Query ejecutada');
|
|
25
|
-
*
|
|
26
|
-
* @since 0.3.0
|
|
2
|
+
* @fileoverview Type definitions exports for Advanced Logger
|
|
27
3
|
*/
|
|
28
|
-
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* @default
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* // Uso directo sin crear instancia
|
|
35
|
-
* import logger from '@mks2508/better-logger';
|
|
36
|
-
*
|
|
37
|
-
* logger.info('Aplicación iniciada');
|
|
38
|
-
* logger.success('Conexión establecida');
|
|
39
|
-
* logger.warn('Memoria al 80%');
|
|
40
|
-
* logger.error('Fallo en conexión');
|
|
41
|
-
*/
|
|
42
|
-
declare const _default: Logger;
|
|
43
|
-
export default _default;
|
|
44
|
-
/**
|
|
45
|
-
* Métodos de logging individuales (enlazados al singleton)
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* // Importar solo los métodos necesarios
|
|
49
|
-
* import { info, error, success } from '@mks2508/better-logger';
|
|
50
|
-
*
|
|
51
|
-
* info('Proceso iniciado');
|
|
52
|
-
* success('✓ Completado exitosamente');
|
|
53
|
-
* error('Error:', errorDetails);
|
|
54
|
-
*
|
|
55
|
-
* @since 0.3.0
|
|
56
|
-
*/
|
|
57
|
-
export declare const debug: (...args: any[]) => void;
|
|
58
|
-
export declare const info: (...args: any[]) => void;
|
|
59
|
-
export declare const warn: (...args: any[]) => void;
|
|
60
|
-
export declare const error: (...args: any[]) => void;
|
|
61
|
-
export declare const success: (...args: any[]) => void;
|
|
62
|
-
export declare const critical: (...args: any[]) => void;
|
|
63
|
-
export declare const trace: (...args: any[]) => void;
|
|
64
|
-
export declare const table: (data: any, columns?: string[]) => void;
|
|
65
|
-
export declare const group: (label: string, collapsed?: boolean) => void;
|
|
66
|
-
export declare const groupEnd: () => void;
|
|
67
|
-
export declare const time: (label: string) => void;
|
|
68
|
-
export declare const timeEnd: (label: string) => void;
|
|
69
|
-
export declare const setGlobalPrefix: (prefix: string) => void;
|
|
70
|
-
export declare const scope: (prefix: string) => any;
|
|
71
|
-
export declare const setVerbosity: (level: Verbosity) => void;
|
|
72
|
-
export declare const addHandler: (handler: ILogHandler) => void;
|
|
73
|
-
export declare const setTheme: (theme: ThemeVariant) => void;
|
|
74
|
-
export declare const setBannerType: (bannerType: BannerType) => void;
|
|
75
|
-
export declare const showBanner: (bannerType?: BannerType) => void;
|
|
76
|
-
export declare const logWithSVG: (message: string, svgContent?: string, options?: StyleOptions) => void;
|
|
77
|
-
export declare const logAnimated: (message: string, duration?: number) => void;
|
|
78
|
-
export declare const cli: (command: string) => Promise<void>;
|
|
79
|
-
export type { LogLevel, Verbosity, ThemeVariant, BannerType, StyleOptions, ILogHandler, LoggerConfig, LogMetadata, StackInfo, TimerEntry } from './types/index.js';
|
|
80
|
-
export { StyleBuilder, StylePresets, THEME_PRESETS, THEME_BANNERS, BANNER_VARIANTS } from './styling/index.js';
|
|
81
|
-
export { FileLogHandler, RemoteLogHandler, AnalyticsLogHandler } from './handlers/index.js';
|
|
82
|
-
export { DEFAULT_CONFIG } from './constants.js';
|
|
83
|
-
export { parseStackTrace, formatTimestamp } from './utils/index.js';
|
|
84
|
-
/**
|
|
85
|
-
* Crea una nueva instancia de StyleBuilder para estilos personalizados de consola
|
|
86
|
-
*
|
|
87
|
-
* @returns {StyleBuilder} Constructor de estilos encadenable
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* const estilo = createStyle()
|
|
91
|
-
* .gradient('#667eea', '#764ba2')
|
|
92
|
-
* .color('white')
|
|
93
|
-
* .padding('8px 16px')
|
|
94
|
-
* .rounded('4px')
|
|
95
|
-
* .shadow('0 2px 4px rgba(0,0,0,0.2)')
|
|
96
|
-
* .build();
|
|
97
|
-
*
|
|
98
|
-
* @since 0.3.0
|
|
99
|
-
*/
|
|
100
|
-
export declare const createStyle: () => StyleBuilder;
|
|
101
|
-
/**
|
|
102
|
-
* Presets de estilo predefinidos para casos de uso comunes
|
|
103
|
-
*
|
|
104
|
-
* @constant {Object} stylePresets
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* console.log('%cOperación exitosa', stylePresets.success);
|
|
108
|
-
* console.log('%cAdvertencia', stylePresets.warning);
|
|
109
|
-
* console.log('%cError crítico', stylePresets.error);
|
|
110
|
-
* console.log('%cInformación', stylePresets.info);
|
|
111
|
-
* console.log('%cDestacado', stylePresets.accent);
|
|
112
|
-
*
|
|
113
|
-
* @since 0.3.0
|
|
114
|
-
*/
|
|
115
|
-
export declare const stylePresets: {
|
|
116
|
-
success: string;
|
|
117
|
-
error: string;
|
|
118
|
-
warning: string;
|
|
119
|
-
info: string;
|
|
120
|
-
accent: string;
|
|
121
|
-
};
|
|
4
|
+
export type { LogLevel, Verbosity, ThemeVariant, DevToolsTheme, BannerType, ExportFormat, OutputFormat, LoggerConfig, StackInfo, TimerEntry, StyleOptions, AdaptiveColors, SpacingType, LogLayout, LogPartConfig, LogStyles, } from './core.js';
|
|
5
|
+
export { LOG_LEVELS } from './core.js';
|
|
6
|
+
export type { LogMetadata, ILogHandler, LogEntry, ExportFilters, ExportOptions, ExportResult, BufferStats, } from './handlers.js';
|
|
122
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACR,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,EACT,aAAa,EACb,SAAS,GACZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,YAAY,EACR,WAAW,EACX,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,GACd,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { LogStyles, LogLevel } from '../types/index.js';
|
|
2
|
+
import { ANSIStyle, TerminalRenderer } from '../terminal/terminal-renderer.js';
|
|
3
|
+
export declare class CSS2ANSIAdapter {
|
|
4
|
+
private renderer;
|
|
5
|
+
constructor();
|
|
6
|
+
/**
|
|
7
|
+
* Convert LogStyles to ANSIStyle for terminal rendering
|
|
8
|
+
*/
|
|
9
|
+
adaptStyles(level: LogLevel, message: string, timestamp?: string, prefix?: string, location?: string, styles?: LogStyles, presetName?: string): ANSIStyle;
|
|
10
|
+
/**
|
|
11
|
+
* Adapt production preset for terminal
|
|
12
|
+
*/
|
|
13
|
+
private adaptProductionStyles;
|
|
14
|
+
/**
|
|
15
|
+
* Adapt debug preset for terminal
|
|
16
|
+
*/
|
|
17
|
+
private adaptDebugStyles;
|
|
18
|
+
/**
|
|
19
|
+
* Adapt glassmorphism preset for terminal
|
|
20
|
+
*/
|
|
21
|
+
private adaptGlassmorphismStyles;
|
|
22
|
+
/**
|
|
23
|
+
* Convert CSS color values to ANSI-friendly colors
|
|
24
|
+
*/
|
|
25
|
+
adaptColor(cssColor: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Extract primary color from CSS gradient
|
|
28
|
+
*/
|
|
29
|
+
private extractColorFromGradient;
|
|
30
|
+
/**
|
|
31
|
+
* Convert CSS color names to ANSI-compatible names
|
|
32
|
+
*/
|
|
33
|
+
private cssNameToANSI;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a style should be rendered in terminal
|
|
36
|
+
*/
|
|
37
|
+
shouldRenderStyle(styleType: string, styles?: LogStyles): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Get renderer instance for advanced usage
|
|
40
|
+
*/
|
|
41
|
+
getRenderer(): TerminalRenderer;
|
|
42
|
+
}
|
|
43
|
+
export declare const css2ansiAdapter: CSS2ANSIAdapter;
|
|
44
|
+
/**
|
|
45
|
+
* Convenience function for quick style adaptation
|
|
46
|
+
*/
|
|
47
|
+
export declare function adaptToTerminal(level: LogLevel, message: string, timestamp?: string, prefix?: string, location?: string, styles?: LogStyles, presetName?: string): ANSIStyle;
|
|
48
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/utils/adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,qBAAa,eAAe;IACxB,OAAO,CAAC,QAAQ,CAAmB;;IAOnC;;OAEG;IACH,WAAW,CACP,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,SAAS,EAClB,UAAU,CAAC,EAAE,MAAM,GACpB,SAAS;IAqBZ;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA0C7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAqDxB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAyChC;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAoBp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