mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 09:36:08 +00:00
Refactor error logging across the application to use a centralized logger
- Introduced a new logger utility (`logError`) to standardize error logging. - Replaced all instances of `console.error` with `logError` in various API routes and libraries. - Enhanced error logging to sanitize sensitive information, particularly for Prisma and Stripe errors. - Ensured consistent error handling and logging practices throughout the codebase.
This commit is contained in:
@@ -2,6 +2,7 @@ import { DeleteObjectCommand, ListObjectsV2Command, type ListObjectsV2CommandInp
|
||||
import { db, disconnectDb } from '../lib/db';
|
||||
import { r2Client, R2_BUCKET_NAME } from '../lib/r2';
|
||||
import { cleanupExpiredBillingWorkspaces } from './expired-billing-cleanup';
|
||||
import { logError } from '@/lib/logger';
|
||||
|
||||
const UNATTACHED_UPLOAD_TTL_MS = 15 * 60 * 1000;
|
||||
const CHUNK_SIZE = 500;
|
||||
@@ -166,7 +167,7 @@ async function main() {
|
||||
deleted += 1;
|
||||
} catch (error) {
|
||||
failed += 1;
|
||||
console.error(`[r2-orphan-cleanup] Failed deleting ${candidate.key}:`, error);
|
||||
logError(`[r2-orphan-cleanup] Failed deleting ${candidate.key}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +180,7 @@ async function main() {
|
||||
|
||||
main()
|
||||
.catch((error) => {
|
||||
console.error('[r2-orphan-cleanup] Fatal error:', error);
|
||||
logError('[r2-orphan-cleanup] Fatal error:', error);
|
||||
process.exitCode = 1;
|
||||
})
|
||||
.finally(async () => {
|
||||
|
||||
Reference in New Issue
Block a user