Fix remaining console statements

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 19:24:38 +00:00
parent ba6bb8a317
commit 99ceacfe0c
12 changed files with 225 additions and 118 deletions

View File

@@ -1,6 +1,6 @@
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
import { Novu } from "npm:@novu/api@1.6.0";
import { startRequest, endRequest } from "../_shared/logger.ts";
import { edgeLogger, startRequest, endRequest } from "../_shared/logger.ts";
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
@@ -42,7 +42,12 @@ serve(async (req) => {
? { subscriberId }
: { topicKey: topicKey! };
console.log('Triggering notification:', { workflowId, recipient, requestId: tracking.requestId });
edgeLogger.info('Triggering notification', {
workflowId,
recipient,
requestId: tracking.requestId,
action: 'trigger_notification'
});
const result = await novu.trigger({
to: recipient,
@@ -51,7 +56,10 @@ serve(async (req) => {
overrides,
});
console.log('Notification triggered successfully:', result.data);
edgeLogger.info('Notification triggered successfully', {
requestId: tracking.requestId,
transactionId: result.data.transactionId
});
endRequest(tracking, 200);
@@ -72,7 +80,10 @@ serve(async (req) => {
);
} catch (error: unknown) {
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
console.error('Error triggering notification:', errorMessage);
edgeLogger.error('Error triggering notification', {
requestId: tracking.requestId,
error: errorMessage
});
endRequest(tracking, 500, errorMessage);