import { Logger } from "./Logger" ; import * as chalk from "chalk" ; export class StatisticsReporter { public reportTitle ( name ) { Logger . log ( name ) ; } public reportValue ( name , value ) { Logger . log ( this . padRight ( name + ":" , 25 ) + chalk . magenta ( this . padLeft ( value . toString ( ) , 10 ) ) ) ; } public reportCount ( name , count ) { this . reportValue ( name , "" + count ) ; } public reportTime ( name , time ) { this . reportValue ( name , ( time / 1000 ) . toFixed ( 2 ) + "s" ) ; } public reportPercentage ( name , percentage ) { this . reportValue ( name , percentage . toFixed ( 2 ) + "%" ) ; } private padLeft ( s , length ) { while ( s . length < length ) { s = " " + s ; } return s ; } private padRight ( s , length ) { while ( s . length < length ) { s = s + " " ; } return s ; } }