Chg: loggerをclassに変更 / Feat: loggerでの発生場所の記録
This commit is contained in:
@@ -5,18 +5,20 @@ import staticStream from "@fastify/static";
|
||||
import { styleText } from "node:util";
|
||||
import Routes from "@/routes";
|
||||
import Database from "@/lib/db";
|
||||
import logger from "@/lib/logger";
|
||||
import Logger from "@/lib/logger";
|
||||
import AccessLog from "@/lib/access";
|
||||
import Authorization from "@/lib/auth";
|
||||
import { RequestContext } from "@mikro-orm/core";
|
||||
import { DatabaseError, ErrorBase } from "@/errors";
|
||||
import { ConfigEntity } from "@/modules/entities/Config";
|
||||
|
||||
process.title = "Chat";
|
||||
process.title = "LynqChat";
|
||||
|
||||
const logger = new Logger("Core");
|
||||
logger.info("Process started...");
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
process.title = "Chat backend";
|
||||
process.title = "LynqChat backend";
|
||||
logger.warn(styleText(["red", "bold", "bgYellow"], "Development environment avaiable!!"));
|
||||
}
|
||||
|
||||
@@ -38,7 +40,8 @@ try {
|
||||
}));
|
||||
}
|
||||
|
||||
logger.error("Unknown error: ", err);
|
||||
const customLogger = new Logger("Unknown(Error handler)");
|
||||
customLogger.error("Unknown error:", err);
|
||||
|
||||
return res.status(500).send(ErrorBase({
|
||||
bad: "server",
|
||||
@@ -56,7 +59,7 @@ try {
|
||||
index: "/",
|
||||
});
|
||||
} catch (err) {
|
||||
logger.error("Error: It's in production but the frontend dist is not found.");
|
||||
logger.error("It's in production but the frontend dist is not found.");
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -101,7 +104,8 @@ try {
|
||||
}));
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error("Database Error: Could not check if already initialization:", err);
|
||||
const customLogger = new Logger("Check already initialized hook");
|
||||
customLogger.error("Database error: Could not check if already initialization:", err);
|
||||
|
||||
return res.code(500).send(DatabaseError());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user