fix: refactoring logs and adding pino logger for production and dev. (#236)

This commit is contained in:
Charles GTE
2026-03-29 11:22:28 +02:00
committed by GitHub
parent 057c192314
commit e1c0fc6917
24 changed files with 354 additions and 120 deletions
+6 -3
View File
@@ -17,12 +17,15 @@ import * as storagePolicy from "@/db/schema/13_storage-policy";
import * as backupStorage from "@/db/schema/14_storage-backup";
import * as healthcheckLog from "@/db/schema/15_healthcheck-log";
const log = logger.child({module: "db"});
import {Pool} from "pg";
// Do not delete
import dotenv from "dotenv";
import {migrate} from "drizzle-orm/node-postgres/migrator";
import {logger} from "@/lib/logger";
dotenv.config({
path: ".env",
@@ -66,12 +69,12 @@ export async function makeMigration() {
const database = drizzle({client: pool});
console.log("Running migrations...");
log.info("Running migrations...");
try {
await migrate(database, {migrationsFolder: "./src/db/migrations"});
console.log("Migrations applied successfully.");
log.info("Migrations applied successfully.");
} catch (error) {
console.error("Error applying migrations:", error);
log.error({error: error}, "Error applying migrations:");
}
}
}