import { isProduction } from "../common-vars" ; export interface CreateLoggerOptions { systemPrefix ? : string ; outputSource ? : Logger ; } export interface Logger { info ( ... data ) : void ; error ( ... data ) : void ; } export function createLogger ( { systemPrefix = "[APP]" , outputSource = console } = { } ) { const prefix = systemPrefix + `:` ; const console = Object . create ( outputSource ) as typeof outputSource ; if ( isProduction ) { console . info = ( ) => null ; console . error = ( ) => null ; } else { console . info = console . info . bind ( console , prefix ) ; console . error = console . error . bind ( console , prefix ) ; } return console ; }