import { LOG_ERRORS_ADD , LOG_WARNINGS_ADD , LogAction } from '../../actions/log' ; export class Logger { private handleAction : ( action : LogAction ) => void ; constructor ( handleAction ) { this . handleAction = handleAction ; } public level ( ) { return this ; } public error ( ... args ) { this . handleAction ( { type : LOG_ERRORS_ADD , payload : { errors : args } } ) ; } public warn ( ... args ) { this . handleAction ( { type : LOG_WARNINGS_ADD , payload : { warnings : args , level : 'warn' } } ) ; return this ; } public info ( ... args ) { this . handleAction ( { type : LOG_WARNINGS_ADD , payload : { warnings : args , level : 'info' } } ) ; return this ; } public debug ( ... args ) { this . handleAction ( { type : LOG_WARNINGS_ADD , payload : { warnings : args , level : 'debug' } } ) ; return this ; } }