Added logger and tests

This commit is contained in:
Emil
2026-02-24 10:02:13 +01:00
parent cfc4cb6849
commit 9b92883d30
16 changed files with 104 additions and 44 deletions
+5 -2
View File
@@ -1,4 +1,7 @@
import { Resend } from 'resend'
import { createLogger } from '@/lib/logger'
const log = createLogger('email')
// Default sender configuration
// Using a fixed From address with dynamic Reply-To
@@ -88,7 +91,7 @@ export async function sendEmail(options: SendEmailOptions): Promise<SendEmailRes
})
if (response.error) {
console.error('Resend error:', response.error)
log.error('Resend error:', response.error)
return {
success: false,
error: response.error.message
@@ -100,7 +103,7 @@ export async function sendEmail(options: SendEmailOptions): Promise<SendEmailRes
messageId: response.data?.id
}
} catch (error) {
console.error('Failed to send email:', error)
log.error('Failed to send email:', error)
return {
success: false,
error: error instanceof Error ? error.message : 'Unknown error'