Merge pull request #631 from Hexastack/fix/logger-2nd-attempt

Fix/logger 2nd attempt
This commit is contained in:
Med Marrouchi
2025-01-28 19:21:47 +01:00
committed by GitHub
13 changed files with 110 additions and 131 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@@ -173,7 +173,7 @@ export class MessageController extends BaseController<
success: true,
};
} catch (err) {
this.logger.debug('MessageController send : Unable to send message', err);
this.logger.debug('Unable to send message', err);
throw new BadRequestException(
'MessageController send : unable to send message',
);

View File

@@ -286,7 +286,7 @@ export class BlockService extends BaseService<
return e.entity === ev.entity;
});
} else {
this.logger.warn('Block Service : Unknown NLP match type', ev);
this.logger.warn('Unknown NLP match type', ev);
return false;
}
});

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@@ -62,10 +62,7 @@ export class BotService {
context = context || getDefaultConversationContext();
fallback = typeof fallback !== 'undefined' ? fallback : false;
const options = block.options;
this.logger.debug(
'Bot service : Sending message ... ',
event.getSenderForeignId(),
);
this.logger.debug('Sending message ... ', event.getSenderForeignId());
// Process message : Replace tokens with context data and then send the message
const recipient = event.getSender();
const envelope = await this.blockService.processMessage(
@@ -116,7 +113,7 @@ export class BotService {
assignTo,
);
this.logger.debug('Bot service : Assigned labels ', blockLabels);
this.logger.debug('Assigned labels ', blockLabels);
return response;
}
@@ -375,7 +372,7 @@ export class BotService {
);
this.logger.debug(
'Bot service : Started a new conversation with ',
'Started a new conversation with ',
subscriber.id,
block.name,
);
@@ -386,14 +383,11 @@ export class BotService {
false,
);
} catch (err) {
this.logger.error('Bot service : Unable to store context data!', err);
this.logger.error('Unable to store context data!', err);
this.eventEmitter.emit('hook:conversation:end', convo, true);
}
} catch (err) {
this.logger.error(
'Botservice : Unable to start a new conversation with ',
err,
);
this.logger.error('Unable to start a new conversation with ', err);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@@ -65,10 +65,7 @@ export class MessageService extends BaseService<
success: true,
});
} catch (e) {
this.logger.error(
'MessageController subscribe : Websocket subscription',
e,
);
this.logger.error('Websocket subscription', e);
throw new InternalServerErrorException(e);
}
}

View File

@@ -72,9 +72,7 @@ export class SubscriberService extends BaseService<
subscribe: Room.SUBSCRIBER,
});
} catch (e) {
this.logger.error(
'SubscriberController subscribe : Websocket subscription',
);
this.logger.error('Websocket subscription');
throw new InternalServerErrorException(e);
}
}