From 0ae594b198a2c36bf507cff555a7279f64e9018a Mon Sep 17 00:00:00 2001 From: devlikepro Date: Thu, 3 Oct 2024 14:50:27 +0700 Subject: [PATCH] [core] Add more logging in WEBJS --- src/core/engines/webjs/session.webjs.core.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/engines/webjs/session.webjs.core.ts b/src/core/engines/webjs/session.webjs.core.ts index 0133ffdf..48fc5fcc 100644 --- a/src/core/engines/webjs/session.webjs.core.ts +++ b/src/core/engines/webjs/session.webjs.core.ts @@ -305,29 +305,29 @@ export class WhatsappSessionWebJSCore extends WhatsappSession { this.logger.info(`Session '${this.name}' is ready!`); }); - this.whatsapp.on(Events.AUTHENTICATED, () => { + this.whatsapp.on(Events.AUTHENTICATED, (args) => { this.status = WAHASessionStatus.WORKING; this.qr.save(''); - this.logger.info(`Session '${this.name}' has been authenticated!`); + this.logger.info({ args: args }, `Session has been authenticated!`); }); - this.whatsapp.on(Events.AUTHENTICATION_FAILURE, () => { + this.whatsapp.on(Events.AUTHENTICATION_FAILURE, (args) => { this.status = WAHASessionStatus.FAILED; this.qr.save(''); - this.logger.info(`Session '${this.name}' has been disconnected!`); + this.logger.info({ args: args }, `Session has failed to authenticate!`); }); - this.whatsapp.on(Events.DISCONNECTED, () => { + this.whatsapp.on(Events.DISCONNECTED, (args) => { this.status = WAHASessionStatus.FAILED; this.qr.save(''); - this.logger.info(`Session '${this.name}' has been disconnected!`); + this.logger.info({ args: args }, `Session has been disconnected!`); }); this.whatsapp.on(Events.STATE_CHANGED, (state: WAState) => { const badStates = [WAState.OPENING, WAState.TIMEOUT]; const log = this.logger.child({ state: state, event: 'change_state' }); - log.debug('Session engine state changed'); + log.info('Session engine state changed'); if (!badStates.includes(state)) { return; }