UNPKG

@autorest/common

Version:
31 lines 984 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AutorestLoggingSession = exports.LoggingSession = void 0; /** * Class processing the logger and disatching async. */ class LoggingSession { registerLog(sendMessage) { var _a; this.pendingMessage = ((_a = this.pendingMessage) !== null && _a !== void 0 ? _a : Promise.resolve()).then(async () => { try { await sendMessage(); } catch (error) { // eslint-disable-next-line no-console console.error("Unexpected error while logging", error); } }); } /** * Wait for any pending message to be sent. */ async waitForMessages() { if (this.pendingMessage) { await this.pendingMessage; } } } exports.LoggingSession = LoggingSession; exports.AutorestLoggingSession = new LoggingSession(); //# sourceMappingURL=logging-session.js.map