class Logger { private readonly MSG_PREFIX = 'ZC' ; public debug ( message , ... optionalParams ) { if ( process . env . NODE_ENV === 'development' ) { console . debug ( this . affixMessage ( message ) , ... optionalParams ) ; } } public log ( message , ... optionalParams ) { console . log ( this . affixMessage ( message ) , ... optionalParams ) ; } public error ( message , error ? ) { if ( error ) { console . error ( this . affixMessage ( message ) , error ) ; } else { console . error ( this . affixMessage ( message ) ) ; } } private affixMessage ( message ) { const timestamp = new Date ( ) . toLocaleTimeString ( ) ; return `[${ timestamp }] ${ this . MSG_PREFIX }: ${ message }` ; } } export const logger = new Logger ( ) ;