import color from 'cli-color' ; import { RunnerResults } from '../core/runner' ; import { pluralize } from '../utils/string' ; export const getLogger = ( debug = false , silent = false ) => ( { error ( error ) { const message = ( error instanceof Error && error . message ) || error ; console . log ( color . red ( message ) ) ; debug && error instanceof Error && console . log ( error . stack ) ; } , log ( ... values ) { ! silent && console . log ( ... values ) ; } , start ( loadedConfigPath = null ) { this . log ( color . yellow ( `Generating font kit...` ) ) ; if ( loadedConfigPath ) { this . log ( color . green ( `✔ Using configuration file: ${ color . green . bold ( loadedConfigPath ) }` ) ) ; } } , results ( { assetsIn , writeResults , options : { inputDir } } ) { const iconsCount = Object . values ( assetsIn ) . length ; this . log ( color . white ( `✔ ${ iconsCount } ${ pluralize ( 'SVG' , iconsCount ) } found in ${ inputDir }` ) ) ; for ( const { writePath } of writeResults ) { this . log ( color . blue ( `✔ Generated` , color . blueBright ( writePath ) ) ) ; } this . log ( color . green . bold ( 'Done' ) ) ; } } ) ;