import { IContext } from "../../../framework/api/IContext" ; import { ILogTarget } from "../../../framework/api/ILogTarget" ; import { LogLevel } from "../../../framework/api/LogLevel" ; import { LogMessageParser } from "./LogMessageParser" ; private export class ConsoleLogTarget implements ILogTarget { private _messageParser : LogMessageParser = new LogMessageParser ( ) ; private _context : IContext ; param context constructor ( context ) { this . _context = context ; } inheritDoc public log ( source , level , timestamp , message , params ? ) { if ( this . _context . logLevel < level ) { return ; } switch ( level ) { case LogLevel . DEBUG : console . log ( timestamp , this . _context , source , this . _messageParser . parseMessage ( message , params ) ) ; break ; case LogLevel . INFO : console . info ( timestamp , this . _context , source , this . _messageParser . parseMessage ( message , params ) ) ; break ; case LogLevel . WARN : console . warn ( timestamp , this . _context , source , this . _messageParser . parseMessage ( message , params ) ) ; break ; case LogLevel . ERROR : console . error ( timestamp , this . _context , source , this . _messageParser . parseMessage ( message , params ) ) ; break ; case LogLevel . FATAL : console . error ( timestamp , this . _context , source , this . _messageParser . parseMessage ( message , params ) ) ; break ; } } }