import { LoggerFactory } from 'src/core/server' ; const trimStr = ( toTrim ) => { return typeof toTrim === 'string' ? toTrim . trim ( ) : toTrim ; } ; export interface GenericLevelLogger { debug : ( msg : string ) => void ; info : ( msg : string ) => void ; warning : ( msg : string ) => void ; error : ( msg : Error ) => void ; } export class LevelLogger implements GenericLevelLogger { private _logger : LoggerFactory ; private _tags : string [ ] ; public warning : ( msg : string , tags ? : string [ ] ) => void ; constructor ( logger , tags ? ) { this . _logger = logger ; this . _tags = tags || [ ] ; this . warning = this . warn . bind ( this ) ; } private getLogger ( tags ) { return this . _logger . get ( ... this . _tags , ... tags ) ; } public error ( err , tags = [ ] ) { this . getLogger ( tags ) . error ( err ) ; } public warn ( msg , tags = [ ] ) { this . getLogger ( tags ) . warn ( msg ) ; } public debug ( msg , tags = [ ] ) { this . getLogger ( tags ) . debug ( msg ) ; } public trace ( msg , tags = [ ] ) { this . getLogger ( tags ) . trace ( msg ) ; } public info ( msg , tags = [ ] ) { this . getLogger ( tags ) . info ( trimStr ( msg ) ) ; } public clone ( tags ) { return new LevelLogger ( this . _logger , [ ... this . _tags , ... tags ] ) ; } }