feat: add logging enhancements by integrating pino and pino-pretty for improved error tracking and debugging across the application

This commit is contained in:
Julien Froidefond
2025-10-26 06:15:47 +01:00
parent 7cc72dc13d
commit 52350a43d9
84 changed files with 455 additions and 177 deletions

View File

@@ -5,6 +5,7 @@ import { ERROR_CODES } from "@/constants/errorCodes";
import { AppError } from "@/utils/errors";
import { getErrorMessage } from "@/utils/errors";
import { findHttpStatus } from "@/utils/image-errors";
import logger from "@/lib/logger";
export const dynamic = "force-dynamic";
@@ -18,7 +19,7 @@ export async function GET(
const response = await SeriesService.getCover(seriesId);
return response;
} catch (error) {
console.error("Erreur lors de la récupération de la couverture de la série:", error);
logger.error({ err: error }, "Erreur lors de la récupération de la couverture de la série:");
// Chercher un status HTTP 404 dans la chaîne d'erreurs
const httpStatus = findHttpStatus(error);
@@ -26,7 +27,7 @@ export async function GET(
if (httpStatus === 404) {
const seriesId: string = (await params).seriesId;
// eslint-disable-next-line no-console
console.log(`📷 First page image not found for series: ${seriesId}`);
logger.info(`📷 First page image not found for series: ${seriesId}`);
return NextResponse.json(
{
error: {