import { logging } from '@angular-devkit/core' ; /**
 * TestLogger stores all log entries and has some tests to check logs.
 * (a helper class for testing)
 */ export class TestLogger extends logging . Logger { logs : string [ ] ; debugEnabled : boolean ; constructor ( name , parent ? ) { super ( name , parent ) ; this . debugEnabled = false ; this . logs = [ ] ; this . subscribe ( ev => { if ( this . debugEnabled ) { console . log ( 'LogEvent' , ev ) ; } this . logs . push ( ev . message ) ; } ) ; } public clear ( ) { this . logs = [ ] ; } public debugEnable ( flag ) { this . debugEnabled = flag ; } public includes ( message ) { return this . logs . findIndex ( msg => msg . indexOf ( message ) >= 0 ) >= 0 ; } public test ( re ) { return this . logs . findIndex ( msg => re . test ( msg ) ) >= 0 ; } }