import { Logger , LogLevel } from './Logger' ; export class NullLogger implements Logger { public static instance : Logger = new NullLogger ( ) ; private constructor ( ) { } public log ( _logLevel , _message ) { } } export class ConsoleLogger implements Logger { private readonly minimumLogLevel : LogLevel ; public constructor ( minimumLogLevel ) { this . minimumLogLevel = minimumLogLevel ; } public log ( logLevel , message ) { if ( logLevel >= this . minimumLogLevel ) { switch ( logLevel ) { case LogLevel . Critical : case LogLevel . Error : console . error ( `[${ new Date ( ) . toISOString ( ) }] ${ LogLevel [ logLevel ] }: ${ message }` ) ; break ; case LogLevel . Warning : console . warn ( `[${ new Date ( ) . toISOString ( ) }] ${ LogLevel [ logLevel ] }: ${ message }` ) ; break ; case LogLevel . Information : console . info ( `[${ new Date ( ) . toISOString ( ) }] ${ LogLevel [ logLevel ] }: ${ message }` ) ; break ; default : console . log ( `[${ new Date ( ) . toISOString ( ) }] ${ LogLevel [ logLevel ] }: ${ message }` ) ; break ; } } } }