1+ /**
2+ * Standard logger interface for vue-skuilder packages
3+ *
4+ * This interface enables dependency injection of logging functionality,
5+ * allowing different runtime contexts to provide appropriate logger implementations:
6+ * - Node.js contexts can use Winston
7+ * - Browser contexts can use console wrappers
8+ * - Test contexts can use mock loggers
9+ */
10+ export interface SkLogger {
11+ debug ( message : string , ...args : any [ ] ) : void ;
12+ info ( message : string , ...args : any [ ] ) : void ;
13+ warn ( message : string , ...args : any [ ] ) : void ;
14+ error ( message : string , ...args : any [ ] ) : void ;
15+ }
16+
17+ /**
18+ * No-op logger implementation for contexts where logging is not needed
19+ */
20+ export const noOpLogger : SkLogger = {
21+ debug : ( ) => { } ,
22+ info : ( ) => { } ,
23+ warn : ( ) => { } ,
24+ error : ( ) => { } ,
25+ } ;
26+
27+ /**
28+ * Console-based logger for browser/development contexts
29+ * Uses console methods with appropriate ESLint suppressions
30+ */
31+ export const consoleLogger : SkLogger = {
32+ debug : ( message : string , ...args : any [ ] ) => console . debug ( message , ...args ) , // eslint-disable-line no-console
33+ info : ( message : string , ...args : any [ ] ) => console . info ( message , ...args ) , // eslint-disable-line no-console
34+ warn : ( message : string , ...args : any [ ] ) => console . warn ( message , ...args ) , // eslint-disable-line no-console
35+ error : ( message : string , ...args : any [ ] ) => console . error ( message , ...args ) , // eslint-disable-line no-console
36+ } ;
0 commit comments