import Logger from '../utils/Logger' ; class BuildLog { public isBuildFailed : boolean ; private firstLineNumber : number ; private lines : string [ ] ; constructor ( private size ) { this . clear ( ) ; } onBuildFailed ( error ) { this . log ( '----------------------' ) ; this . log ( 'Deploy failed!' ) ; this . log ( error ) ; this . isBuildFailed = true ; } clear ( ) { this . isBuildFailed = false ; this . firstLineNumber = - this . size ; this . lines = [ ] ; for ( let i = 0 ; i < this . size ; i ++ ) { this . lines . push ( '' ) ; } } log ( msg ) { msg = ( msg || '' ) + '' ; this . lines . shift ( ) ; this . lines . push ( msg ) ; this . firstLineNumber ++ ; Logger . dev ( msg ) ; } getLogs ( ) { const self = this ; return JSON . parse ( JSON . stringify ( { lines : self . lines , firstLineNumber : self . firstLineNumber , } ) ) ; } } export default BuildLog ;