@@ -20,16 +20,33 @@ export interface LoggerOptions {
2020 level ?: LogLevel ;
2121}
2222
23+ /** Flexible logger interface compatible with pino but lenient on call signatures */
24+ export interface Logger {
25+ fatal ( msg : string , ...args : any [ ] ) : void ;
26+ fatal ( obj : unknown , msg ?: string , ...args : any [ ] ) : void ;
27+ error ( msg : string , ...args : any [ ] ) : void ;
28+ error ( obj : unknown , msg ?: string , ...args : any [ ] ) : void ;
29+ warn ( msg : string , ...args : any [ ] ) : void ;
30+ warn ( obj : unknown , msg ?: string , ...args : any [ ] ) : void ;
31+ info ( msg : string , ...args : any [ ] ) : void ;
32+ info ( obj : unknown , msg ?: string , ...args : any [ ] ) : void ;
33+ debug ( msg : string , ...args : any [ ] ) : void ;
34+ debug ( obj : unknown , msg ?: string , ...args : any [ ] ) : void ;
35+ trace ( msg : string , ...args : any [ ] ) : void ;
36+ trace ( obj : unknown , msg ?: string , ...args : any [ ] ) : void ;
37+ child ( bindings : Record < string , any > ) : Logger ;
38+ }
39+
2340/**
2441 * Create a child logger scoped to a specific module.
2542 *
2643 * @param module Hierarchical module name, e.g. 'crm:account' or 'ai:cache'
2744 * @param options Optional overrides
2845 */
29- export function createLogger ( module : string , options ?: LoggerOptions ) : pino . Logger {
46+ export function createLogger ( module : string , options ?: LoggerOptions ) : Logger {
3047 const level = options ?. level ?? ( process . env . LOG_LEVEL as LogLevel ) ?? 'info' ;
31- return pino ( { name : module , level } ) ;
48+ return pino ( { name : module , level } ) as unknown as Logger ;
3249}
3350
3451/** Shared root logger instance */
35- export const logger : pino . Logger = createLogger ( 'hotcrm' ) ;
52+ export const logger : Logger = createLogger ( 'hotcrm' ) ;
0 commit comments