From 65a5e85ae3dafe79990ab2b4bdba69f3f69a1485 Mon Sep 17 00:00:00 2001 From: Adam Fraser Date: Tue, 20 Aug 2024 12:38:12 -0400 Subject: [PATCH] Sending notification logs --- indexer/packages/notifications/src/message.ts | 13 ++++++------- .../notifications/notifications-functions.ts | 11 +++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/indexer/packages/notifications/src/message.ts b/indexer/packages/notifications/src/message.ts index 0c25fd67f41..7756afebc2f 100644 --- a/indexer/packages/notifications/src/message.ts +++ b/indexer/packages/notifications/src/message.ts @@ -49,13 +49,6 @@ export async function sendFirebaseMessage( try { const result = await sendMulticast(message); if (result?.failureCount && result?.failureCount > 0) { - logger.info({ - at: 'notifications#firebase', - message: `Failed to send Firebase message: ${JSON.stringify(message)}`, - result, - address, - notificationType: notification.type, - }); throw new Error('Failed to send Firebase message'); } } catch (error) { @@ -69,6 +62,12 @@ export async function sendFirebaseMessage( throw new Error('Failed to send Firebase message'); } finally { // stats.timing(`${config.SERVICE_NAME}.send_firebase_message.timing`, Date.now() - start); + logger.info({ + at: 'notifications#firebase', + message: 'Firebase message sent succesfully', + address, + notificationType: notification.type, + }); } } diff --git a/indexer/services/ender/src/helpers/notifications/notifications-functions.ts b/indexer/services/ender/src/helpers/notifications/notifications-functions.ts index 8a60259dda4..c5766ed8fc4 100644 --- a/indexer/services/ender/src/helpers/notifications/notifications-functions.ts +++ b/indexer/services/ender/src/helpers/notifications/notifications-functions.ts @@ -1,3 +1,4 @@ +import { logger } from '@dydxprotocol-indexer/base'; import { createNotification, NotificationDynamicFieldKey, @@ -23,6 +24,11 @@ export async function sendOrderFilledNotification( const token = await TokenTable.findAll({ address: subaccount.address, limit: 1 }, []); if (token.length === 0) { + logger.info({ + at: 'ender#notification-functions', + message: 'No token found for address', + address: subaccount.address, + }); return; } const notification = createNotification( @@ -33,6 +39,11 @@ export async function sendOrderFilledNotification( [NotificationDynamicFieldKey.AVERAGE_PRICE]: order.price, }, ); + logger.info({ + at: 'ender#notification-functions', + message: 'Sending firebase message', + notificationType: notification.type, + }); await sendFirebaseMessage(subaccount.address, notification); }