refactor: rename logger to log
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
@@ -23,4 +23,4 @@ const loggerOptions: LoggerOptions = {
|
||||
timestamp: pino.stdTimeFunctions.isoTime,
|
||||
};
|
||||
|
||||
export const logger = pino(loggerOptions);
|
||||
export const log = pino(loggerOptions);
|
||||
|
||||
Reference in New Issue
Block a user