@mks2508/better-logger 0.0.1 → 0.0.2-alpha.2
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 +10 -1
- package/.github/workflows/ci.yml +319 -0
- package/.github/workflows/release.yml +269 -0
- package/.npmrc.bak +1 -0
- package/README.md +577 -0
- package/demo.html +840 -0
- package/dist/chunks/Logger-BQhMKy_T.js +2 -0
- package/dist/chunks/Logger-BQhMKy_T.js.map +1 -0
- package/dist/chunks/Logger-BrFKFZcD.js +978 -0
- package/dist/chunks/Logger-BrFKFZcD.js.map +1 -0
- package/dist/chunks/core-2opW4Pi3.js +194 -0
- package/dist/chunks/core-2opW4Pi3.js.map +1 -0
- package/dist/chunks/core-DyugwSYZ.js +4 -0
- package/dist/chunks/core-DyugwSYZ.js.map +1 -0
- package/dist/chunks/exports-BNP3R7dp.js +421 -0
- package/dist/chunks/exports-BNP3R7dp.js.map +1 -0
- package/dist/chunks/exports-U1xLBXrY.js +2 -0
- package/dist/chunks/exports-U1xLBXrY.js.map +1 -0
- package/dist/chunks/styling-DhUDzwlE.js +654 -0
- package/dist/chunks/styling-DhUDzwlE.js.map +1 -0
- package/dist/chunks/styling-tmRDI28D.js +2 -0
- package/dist/chunks/styling-tmRDI28D.js.map +1 -0
- package/dist/core.cjs +2 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.js +244 -0
- package/dist/core.js.map +1 -0
- package/dist/exports.cjs +2 -0
- package/dist/exports.cjs.map +1 -0
- package/dist/exports.js +237 -0
- package/dist/exports.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/dist/styling.cjs +2 -0
- package/dist/styling.cjs.map +1 -0
- package/dist/styling.js +146 -0
- package/dist/styling.js.map +1 -0
- package/dist/types/core.d.ts +211 -0
- package/dist/types/exports.d.ts +600 -0
- package/dist/types/index.d.ts +675 -0
- package/dist/types/styling.d.ts +751 -0
- package/docs/CORE.md +264 -0
- package/docs/EXPORTS.md +467 -0
- package/docs/STYLING.md +405 -0
- package/index.html +28 -4
- package/package.json +37 -4
- package/src/Logger.ts +28 -8
- package/src/cli/CommandProcessor.ts +2 -2
- package/src/cli/commands/ExportCommand.ts +5 -0
- package/src/cli/commands/StatusCommand.ts +11 -10
- package/src/core.ts +320 -0
- package/src/example.ts +184 -62
- package/src/exports-module.ts +311 -0
- package/src/handlers/ExportLogHandler.ts +34 -13
- package/src/index.ts +97 -79
- package/src/main.ts +77 -7
- package/src/styling-module.ts +244 -0
- package/src/utils/stackTrace.ts +39 -10
- package/src/utils/timestamps.ts +1 -1
- package/tsconfig.json +40 -14
- package/vite.config.ts +84 -0
- package/dist/assets/index-DxvJByYN.js +0 -183
- package/dist/index.html +0 -334
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
export declare const addHandler: (handler: ILogHandler) => void;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Banner types for different visual approaches
|
|
5
|
+
*/
|
|
6
|
+
declare type BannerType = 'simple' | 'ascii' | 'unicode' | 'svg' | 'animated';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Minimal Logger class with core functionality only
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { CoreLogger } from '@mks2508/better-logger/core';
|
|
14
|
+
*
|
|
15
|
+
* const logger = new CoreLogger();
|
|
16
|
+
* logger.info('Hello world');
|
|
17
|
+
* logger.error('Something went wrong', error);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class CoreLogger {
|
|
21
|
+
private config;
|
|
22
|
+
private scopedPrefix?;
|
|
23
|
+
private handlers;
|
|
24
|
+
private timers;
|
|
25
|
+
private groupDepth;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new CoreLogger instance
|
|
28
|
+
* @param config - Optional configuration
|
|
29
|
+
*/
|
|
30
|
+
constructor(config?: Partial<LoggerConfig>);
|
|
31
|
+
/**
|
|
32
|
+
* Get current configuration
|
|
33
|
+
*/
|
|
34
|
+
getConfig(): LoggerConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Sets the global prefix for all log messages
|
|
37
|
+
*/
|
|
38
|
+
setGlobalPrefix(prefix: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Sets the verbosity level for filtering log output
|
|
41
|
+
*/
|
|
42
|
+
setVerbosity(level: Verbosity): void;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a scoped logger with a specific prefix
|
|
45
|
+
*/
|
|
46
|
+
createScopedLogger(prefix: string): CoreLogger;
|
|
47
|
+
/**
|
|
48
|
+
* Adds a custom log handler for extensibility
|
|
49
|
+
*/
|
|
50
|
+
addHandler(handler: ILogHandler): void;
|
|
51
|
+
/**
|
|
52
|
+
* Checks if a log level should be output based on current verbosity
|
|
53
|
+
*/
|
|
54
|
+
private shouldLog;
|
|
55
|
+
/**
|
|
56
|
+
* Gets the effective prefix (global + scoped)
|
|
57
|
+
*/
|
|
58
|
+
private getEffectivePrefix;
|
|
59
|
+
/**
|
|
60
|
+
* Core logging method with minimal formatting
|
|
61
|
+
*/
|
|
62
|
+
private log;
|
|
63
|
+
/**
|
|
64
|
+
* Logs debug information (lowest priority)
|
|
65
|
+
*/
|
|
66
|
+
debug(...args: any[]): void;
|
|
67
|
+
/**
|
|
68
|
+
* Logs informational messages
|
|
69
|
+
*/
|
|
70
|
+
info(...args: any[]): void;
|
|
71
|
+
/**
|
|
72
|
+
* Logs warning messages
|
|
73
|
+
*/
|
|
74
|
+
warn(...args: any[]): void;
|
|
75
|
+
/**
|
|
76
|
+
* Logs error messages
|
|
77
|
+
*/
|
|
78
|
+
error(...args: any[]): void;
|
|
79
|
+
/**
|
|
80
|
+
* Logs critical errors (highest priority)
|
|
81
|
+
*/
|
|
82
|
+
critical(...args: any[]): void;
|
|
83
|
+
/**
|
|
84
|
+
* Logs trace information (detailed debugging)
|
|
85
|
+
*/
|
|
86
|
+
trace(...args: any[]): void;
|
|
87
|
+
/**
|
|
88
|
+
* Displays data in a table format
|
|
89
|
+
*/
|
|
90
|
+
table(data: any, columns?: string[]): void;
|
|
91
|
+
/**
|
|
92
|
+
* Starts a collapsible group in the console
|
|
93
|
+
*/
|
|
94
|
+
group(label: string, collapsed?: boolean): void;
|
|
95
|
+
/**
|
|
96
|
+
* Ends the current console group
|
|
97
|
+
*/
|
|
98
|
+
groupEnd(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Starts a timer with the given label
|
|
101
|
+
*/
|
|
102
|
+
time(label: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* Ends a timer and logs the elapsed time
|
|
105
|
+
*/
|
|
106
|
+
timeEnd(label: string): void;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare const coreLogger: CoreLogger;
|
|
110
|
+
export default coreLogger;
|
|
111
|
+
|
|
112
|
+
export declare const createScopedLogger: (prefix: string) => CoreLogger;
|
|
113
|
+
|
|
114
|
+
export declare const critical: (...args: any[]) => void;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Export individual methods for convenience (with proper binding)
|
|
118
|
+
*/
|
|
119
|
+
export declare const debug: (...args: any[]) => void;
|
|
120
|
+
|
|
121
|
+
export declare const error: (...args: any[]) => void;
|
|
122
|
+
|
|
123
|
+
export declare const group: (label: string, collapsed?: boolean) => void;
|
|
124
|
+
|
|
125
|
+
export declare const groupEnd: () => void;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Interface for custom log handlers (extensibility)
|
|
129
|
+
*/
|
|
130
|
+
export declare interface ILogHandler {
|
|
131
|
+
handle(level: LogLevel, message: string, args: any[], metadata: LogMetadata): void;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export declare const info: (...args: any[]) => void;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Supported log levels in hierarchical order (debug < info < warn < error < critical)
|
|
138
|
+
*/
|
|
139
|
+
declare const LOG_LEVELS: {
|
|
140
|
+
readonly debug: 0;
|
|
141
|
+
readonly info: 1;
|
|
142
|
+
readonly warn: 2;
|
|
143
|
+
readonly error: 3;
|
|
144
|
+
readonly critical: 4;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Configuration interface for logger instances
|
|
149
|
+
*/
|
|
150
|
+
export declare interface LoggerConfig {
|
|
151
|
+
globalPrefix?: string;
|
|
152
|
+
verbosity: Verbosity;
|
|
153
|
+
enableColors: boolean;
|
|
154
|
+
enableTimestamps: boolean;
|
|
155
|
+
enableStackTrace: boolean;
|
|
156
|
+
theme?: ThemeVariant;
|
|
157
|
+
bannerType?: BannerType;
|
|
158
|
+
bufferSize?: number;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Log level type derived from LOG_LEVELS keys
|
|
163
|
+
*/
|
|
164
|
+
export declare type LogLevel = keyof typeof LOG_LEVELS;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Metadata associated with each log entry
|
|
168
|
+
*/
|
|
169
|
+
export declare interface LogMetadata {
|
|
170
|
+
timestamp: string;
|
|
171
|
+
level: LogLevel;
|
|
172
|
+
prefix?: string;
|
|
173
|
+
stackInfo?: StackInfo;
|
|
174
|
+
group?: string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export declare const setGlobalPrefix: (prefix: string) => void;
|
|
178
|
+
|
|
179
|
+
export declare const setVerbosity: (level: Verbosity) => void;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Parsed stack trace information
|
|
183
|
+
*/
|
|
184
|
+
declare interface StackInfo {
|
|
185
|
+
file: string;
|
|
186
|
+
line: number;
|
|
187
|
+
column: number;
|
|
188
|
+
function?: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export declare const table: (data: any, columns?: string[]) => void;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Theme variants for different visual styles
|
|
195
|
+
*/
|
|
196
|
+
declare type ThemeVariant = 'default' | 'dark' | 'light' | 'neon' | 'minimal' | 'cyberpunk';
|
|
197
|
+
|
|
198
|
+
export declare const time: (label: string) => void;
|
|
199
|
+
|
|
200
|
+
export declare const timeEnd: (label: string) => void;
|
|
201
|
+
|
|
202
|
+
export declare const trace: (...args: any[]) => void;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Verbosity level type for filtering logs
|
|
206
|
+
*/
|
|
207
|
+
export declare type Verbosity = LogLevel | 'silent';
|
|
208
|
+
|
|
209
|
+
export declare const warn: (...args: any[]) => void;
|
|
210
|
+
|
|
211
|
+
export { }
|