diff --git a/api/package.json b/api/package.json index bd21dded..533f4c88 100644 --- a/api/package.json +++ b/api/package.json @@ -54,6 +54,7 @@ "multer": "^2.0.1", "nats": "^2.29.3", "nestjs-pino": "^4.5.0", + "pino": "^9.6.0", "passport": "^0.6.0", "passport-jwt": "^4.0.1", "passport-local": "^1.0.0", diff --git a/api/src/main.ts b/api/src/main.ts index 73b349fb..f20a0e4d 100644 --- a/api/src/main.ts +++ b/api/src/main.ts @@ -1,15 +1,17 @@ import { ValidationPipe } from "@nestjs/common"; import { NestFactory } from "@nestjs/core"; import { Logger } from "nestjs-pino"; +import pino from "pino"; import { AppModule } from "./app.module"; import { runMigrations } from "./database/migrate"; +const bootstrapLogger = pino({ name: "bootstrap" }); + async function bootstrap() { // Run database migrations before starting the application - // Note: migrations run before NestJS app is created, so we use console here - console.log("Running database migrations..."); + bootstrapLogger.info("Running database migrations..."); await runMigrations(); - console.log("Database migrations completed"); + bootstrapLogger.info("Database migrations completed"); const app = await NestFactory.create(AppModule, { bufferLogs: true }); @@ -39,6 +41,6 @@ async function bootstrap() { } bootstrap().catch((error) => { - console.error("Failed to start the0 API:", error); + bootstrapLogger.error({ err: error }, "Failed to start the0 API"); process.exit(1); });