'use strict' ; import * as util from 'util' ; const padding = ' ' ; const statuses = [ 'skip' , 'force' , 'create' , 'invoke' , 'conflict' , 'identical' , 'info' ] ; export class Log { private output : string = '' ; private cleanOutput : string [ ] = [ ] ; [ index ] : any ; constructor ( ) { for ( const status of statuses ) { this [ status ] = ( arg ) => { if ( status !== 'identical' && status !== 'conflict' ) { this . cleanOutput . push ( arg ) ; } this . write ( this . pad ( status ) ) . write ( padding ) ; this . write ( `${ arg }\n` ) ; return this ; } ; } } public getOutput ( ) { return this . output ; } public getCleanOutput ( ) { return this . cleanOutput ; } public write ( ... args ) { this . output = this . output + util . format . apply ( util , args ) ; return this ; } public pad ( status ) { const max = 'identical' . length ; const delta = max - status . length ; return delta ? new Array ( delta + 1 ) . join ( ' ' ) + status : status ; } public setOutput ( text ) { this . output = text ; } public setCleanOutput ( cleanText ) { this . cleanOutput = cleanText ; } public clear ( ) { this . output = '' ; this . cleanOutput = [ ] ; } }