export interface Logger { debug : ( ... args : any ) => void ; info : ( ... args : any ) => void ; warn : ( ... args : any ) => void ; error : ( ... args : any ) => void ; child : ( ctx : object ) => Logger ; } export enum Level { error = 0 , warn = 1 , info = 2 , debug = 3 } export class ConsoleLogger { constructor ( public level = Level . info , public ctx = { } ) { } debug ( ... args ) { if ( this . level >= Level . debug ) { console . log ( ... args ) ; } } info ( ... args ) { if ( this . level >= Level . info ) { console . log ( ... args ) ; } } warn ( ... args ) { if ( this . level >= Level . warn ) { console . log ( ... args ) ; } } error ( ... args ) { if ( this . level >= Level . error ) { console . log ( ... args ) ; } } child ( ctx ) { return new ConsoleLogger ( this . level , { ... this . ctx , ... ctx } ) ; } }