Skip to content

Commit

Permalink
[core] Add more logging in WEBJS
Browse files Browse the repository at this point in the history
  • Loading branch information
devlikepro committed Oct 3, 2024
1 parent 14a7e1c commit 0ae594b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/core/engines/webjs/session.webjs.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0ae594b

Please sign in to comment.