-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Develop debug #1861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop debug #1861
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| import { advancedOperatorsSearch } from './advancedOperatorsSearch'; | ||
|
|
||
| export const findBotByTrigger = async (botRepository: any, content: string, instanceId: string) => { | ||
| console.log(`🔍 [findBotByTrigger] Searching for bot - content: "${content}", instanceId: ${instanceId}`); | ||
|
|
||
| // Check for triggerType 'all' or 'none' (both should match any message) | ||
| const findTriggerAllOrNone = await botRepository.findFirst({ | ||
| where: { | ||
|
|
@@ -12,7 +14,10 @@ export const findBotByTrigger = async (botRepository: any, content: string, inst | |
| }, | ||
| }); | ||
|
|
||
| console.log(`🤖 [findBotByTrigger] All/None trigger found: ${findTriggerAllOrNone ? 'YES' : 'NO'} - ID: ${findTriggerAllOrNone?.id || 'NONE'}`); | ||
|
|
||
| if (findTriggerAllOrNone) { | ||
| console.log(`✅ [findBotByTrigger] Returning bot with triggerType: ${findTriggerAllOrNone.triggerType}`); | ||
|
Comment on lines
14
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Use of console.log for logging may be inconsistent with other logger usage. Replace console.log with the project's structured logger to ensure consistent logging and log level management. Suggested implementation: import { advancedOperatorsSearch } from './advancedOperatorsSearch';
import { logger } from '../logger';
export const findBotByTrigger = async (botRepository: any, content: string, instanceId: string) => {
logger.info(`🔍 [findBotByTrigger] Searching for bot - content: "${content}", instanceId: ${instanceId}`);
// Check for triggerType 'all' or 'none' (both should match any message)
const findTriggerAllOrNone = await botRepository.findFirst({
where: {
},
});
logger.info(`🤖 [findBotByTrigger] All/None trigger found: ${findTriggerAllOrNone ? 'YES' : 'NO'} - ID: ${findTriggerAllOrNone?.id || 'NONE'}`);
if (findTriggerAllOrNone) {
logger.info(`✅ [findBotByTrigger] Returning bot with triggerType: ${findTriggerAllOrNone.triggerType}`);
return findTriggerAllOrNone;If your logger uses a different import path or method (e.g., |
||
| return findTriggerAllOrNone; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Error logging may omit stack trace information.
Log the full error object or stack trace to improve error reporting and facilitate debugging.