refactor: rename logger to log

This commit is contained in:
Ritesh Ghosh
2025-05-11 13:31:58 +05:30
parent e23383f4c4
commit 36b4f8acfc
4 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import { HiAnimeError } from "aniwatch";
import type { ErrorHandler, NotFoundHandler } from "hono";
import type { ContentfulStatusCode } from "hono/utils/http-status";
import { logger } from "./logger.js";
import { log } from "./logger.js";
const errResp: { status: ContentfulStatusCode; message: string } = {
status: 500,
@@ -9,7 +9,7 @@ const errResp: { status: ContentfulStatusCode; message: string } = {
};
export const errorHandler: ErrorHandler = (err, c) => {
logger.error(JSON.stringify(err));
log.error(JSON.stringify(err));
if (err instanceof HiAnimeError) {
errResp.status = err.status as ContentfulStatusCode;
@@ -23,6 +23,6 @@ export const notFoundHandler: NotFoundHandler = (c) => {
errResp.status = 404;
errResp.message = "Not Found";
logger.error(JSON.stringify(errResp));
log.error(JSON.stringify(errResp));
return c.json(errResp, errResp.status);
};
+1 -1
View File
@@ -23,4 +23,4 @@ const loggerOptions: LoggerOptions = {
timestamp: pino.stdTimeFunctions.isoTime,
};
export const logger = pino(loggerOptions);
export const log = pino(loggerOptions);