feat(logging): emit sanitized structured app logs

This commit is contained in:
Do Siki
2026-09-28 09:51:40 +02:00
parent 2ad3e75c87
commit b5a8936f42
26 changed files with 429 additions and 574 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
import { MongoClient, Db } from 'mongodb'
import { dbLogger, getSafeErrorDetails } from './logger'
// WHY this file only exposes getDb/checkMongoConnection now: it used to also
// export getCollection(), used by src/app/api/contact/route.ts for a raw,
@@ -63,7 +64,7 @@ export async function checkMongoConnection(): Promise<boolean> {
await db.admin().ping()
return true
} catch (error) {
console.error('MongoDB connection check failed:', error)
dbLogger.error('MongoDB connection check failed', getSafeErrorDetails(error))
return false
}
}