/**
 * Class processing the logger and disatching async.
 */ export class LoggingSession { private pendingMessage : Promise < unknown > | undefined ; public registerLog ( sendMessage ) { this . pendingMessage = ( this . pendingMessage ?? Promise . resolve ( ) ) . then ( async ( ) => { try { await sendMessage ( ) ; } catch ( error ) { console . error ( "Unexpected error while logging" , error ) ; } } ) ; } /**
     * Wait for any pending message to be sent.
     */ public async waitForMessages ( ) { if ( this . pendingMessage ) { await this . pendingMessage ; } } } export const AutorestLoggingSession = new LoggingSession ( ) ;