feat: add logging enhancements by integrating pino and pino-pretty for improved error tracking and debugging across the application
This commit is contained in:
@@ -4,6 +4,7 @@ import { ERROR_CODES } from "@/constants/errorCodes";
|
||||
import { AppError } from "@/utils/errors";
|
||||
import { getErrorMessage } from "@/utils/errors";
|
||||
import type { NextRequest } from "next/server";
|
||||
import logger from "@/lib/logger";
|
||||
export const revalidate = 60;
|
||||
|
||||
const DEFAULT_PAGE_SIZE = 20;
|
||||
@@ -34,7 +35,7 @@ export async function GET(
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("API Series Books - Erreur:", error);
|
||||
logger.error({ err: error }, "API Series Books - Erreur:");
|
||||
if (error instanceof AppError) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
@@ -74,7 +75,7 @@ export async function DELETE(
|
||||
|
||||
return NextResponse.json({ success: true });
|
||||
} catch (error) {
|
||||
console.error("API Series Cache Invalidation - Erreur:", error);
|
||||
logger.error({ err: error }, "API Series Cache Invalidation - Erreur:");
|
||||
if (error instanceof AppError) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ import { AppError } from "@/utils/errors";
|
||||
import type { KomgaSeries } from "@/types/komga";
|
||||
import { getErrorMessage } from "@/utils/errors";
|
||||
import type { NextRequest } from "next/server";
|
||||
import logger from "@/lib/logger";
|
||||
export const revalidate = 60;
|
||||
|
||||
export async function GET(
|
||||
@@ -21,7 +22,7 @@ export async function GET(
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("API Series - Erreur:", error);
|
||||
logger.error({ err: error }, "API Series - Erreur:");
|
||||
if (error instanceof AppError) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user