import * as c from 'colorette' ; export class Logger { public static get ( name ) { const logger = new Logger ( name ) ; return logger . info ; } public readonly name ; public constructor ( name ) { this . name = name ; } public info ( ... args ) { console . info ( this . prefix ( c . blue , 'info' ) , ... args ) ; } public success ( ... args ) { console . log ( this . prefix ( [ c . green ] , 'success' ) , ... args ) ; } public error ( ... args ) { console . log ( this . prefix ( c . red , 'error' ) , ... args ) ; } public debug ( ... args ) { console . log ( this . prefix ( c . blue , 'debug' ) , ... args ) ; } public warn ( ... args ) { console . log ( this . prefix ( c . yellow , 'warning' ) , ... args ) ; } private prefix ( color , text ) { const colored = Array . isArray ( color ) ? color . reduce ( ( all , c ) => c ( all ) , text ) : color ( text ) ; return c . bold ( `${ new Date ( ) . toLocaleDateString ( ) } [${ this . name } • ${ colored }:]` ) ; } }