const startMsg = 'Nest application successfully started' ; const responseMsg = 'request completed' ; export type LogObject = { msg : string ; req ? : { id : number ; } ; res ? : Record < string , any > ; context ? : string ; err ? : { message : string ; stack : string ; type : string ; } ; [ key ] : any ; } ; export class LogsContainer { static from ( stringer ) { return new LogsContainer ( stringer . toString ( ) ) ; } private readonly logs : LogObject [ ] ; constructor ( logs ) { this . logs = logs . split ( '\n' ) . map ( ( v ) => v . trim ( ) ) . filter ( ( v ) => ! ! v ) . map ( ( v ) => JSON . parse ( v ) ) ; } getStartLog ( ) { return this . logs . find ( ( log ) => log . msg . startsWith ( startMsg ) ) ; } getResponseLog ( ) { return this . logs . find ( ( log ) => log . msg === responseMsg ) ; } get some ( ) { return this . logs . some . bind ( this . logs ) ; } get find ( ) { return this . logs . find . bind ( this . logs ) ; } }