Skip to content

Commit be89bb2

Browse files
committed
refactor: replace logger with console for error handling in Telegram workflows
1 parent 45625c5 commit be89bb2

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

src/workflows/telegram/TelegramQuestionWorkflow.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { executeChild, proxyActivities } from '@temporalio/workflow';
22
import type * as activities from '../../activities';
33
import { Update } from 'grammy/types';
4-
import logger from '../../config/logger.config';
54

65
const { getCommunityFromTelegram } = proxyActivities<typeof activities>({
76
startToCloseTimeout: '1h',
@@ -19,18 +18,18 @@ export async function TelegramQuestionWorkflow({
1918
}: ITelegramQuestionWorkflow) {
2019
const chatId = update.message.chat.id;
2120
if (!chatId) {
22-
logger.error('No chat ID found');
21+
console.error('No chat ID found');
2322
return;
2423
}
2524
const community = await getCommunityFromTelegram(chatId);
2625
if (!community) {
27-
logger.error('No community found');
26+
console.error('No community found');
2827
return;
2928
}
3029

3130
const text = update.message.text;
3231
if (!text) {
33-
logger.error('No text found');
32+
console.error('No text found');
3433
return;
3534
}
3635

src/workflows/telegram/TelegramSummaryWorkflow.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { executeChild, proxyActivities } from '@temporalio/workflow';
22
import type * as activities from '../../activities';
33
import { Update } from 'grammy/types';
4-
import logger from '../../config/logger.config';
54

65
const { getCommunityFromTelegram, getPlatform } = proxyActivities<
76
typeof activities
@@ -21,12 +20,12 @@ export async function TelegramSummaryWorkflow({
2120
}: ITelegramSummaryWorkflow) {
2221
const chatId = update.message.chat.id;
2322
if (!chatId) {
24-
logger.error('No chat ID found');
23+
console.error('No chat ID found');
2524
return;
2625
}
2726
const community = await getCommunityFromTelegram(chatId);
2827
if (!community) {
29-
logger.error('No community found');
28+
console.error('No community found');
3029
return;
3130
}
3231

@@ -38,7 +37,7 @@ export async function TelegramSummaryWorkflow({
3837
});
3938

4039
if (!platform) {
41-
logger.error('No platform found');
40+
console.error('No platform found');
4241
return;
4342
}
4443

src/workflows/telegram/TelegramVectorIngestionWorkflow.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { proxyActivities, startChild } from '@temporalio/workflow';
22
import type * as activities from '../../activities';
33
import { TelegramEvent } from '../../shared/types/telegram/TelegramEvent';
44
import { Update } from 'grammy/types';
5-
import logger from '../../config/logger.config';
65

76
interface ITelegramVectorIngestionWorkflow {
87
event: TelegramEvent;
@@ -28,7 +27,7 @@ export async function TelegramVectorIngestionWorkflow({
2827
if (
2928
!(event === TelegramEvent.EDITED_MESSAGE || event === TelegramEvent.MESSAGE)
3029
) {
31-
logger.info('Skipping vector ingestion for event', {
30+
console.info('Skipping vector ingestion for event', {
3231
event,
3332
message_id: update.message.message_id,
3433
});
@@ -37,12 +36,12 @@ export async function TelegramVectorIngestionWorkflow({
3736

3837
const chatId = update.message.chat.id;
3938
if (!chatId) {
40-
logger.error('No chat ID found');
39+
console.error('No chat ID found');
4140
return;
4241
}
4342
const community = await getCommunityFromTelegram(chatId);
4443
if (!community) {
45-
logger.error('No community found');
44+
console.error('No community found');
4645
return;
4746
}
4847

@@ -54,7 +53,7 @@ export async function TelegramVectorIngestionWorkflow({
5453
});
5554

5655
if (!platform) {
57-
logger.error('No platform found');
56+
console.error('No platform found');
5857
return;
5958
}
6059

0 commit comments

Comments
 (0)