mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
Add automatic log folder creation
This commit is contained in:
parent
626bc03dbd
commit
501b8bf78a
11
index.ts
11
index.ts
|
|
@ -6,6 +6,7 @@ import { client } from "~database/datasource";
|
|||
import { LogLevel, LogManager, MultiLogManager } from "log-manager";
|
||||
import { moduleIsEntry } from "@module";
|
||||
import { createServer } from "~server";
|
||||
import { exists, mkdir } from "fs/promises";
|
||||
|
||||
const timeAtStart = performance.now();
|
||||
|
||||
|
|
@ -21,6 +22,16 @@ const consoleLogger = new LogManager(
|
|||
);
|
||||
const dualLogger = new MultiLogManager([logger, consoleLogger]);
|
||||
|
||||
if (!(await exists(process.cwd() + "/logs/"))) {
|
||||
await consoleLogger.log(
|
||||
LogLevel.WARNING,
|
||||
"Lysand",
|
||||
`Creating logs directory at ${process.cwd()}/logs/`
|
||||
);
|
||||
|
||||
await mkdir(process.cwd() + "/logs/");
|
||||
}
|
||||
|
||||
await dualLogger.log(LogLevel.INFO, "Lysand", "Starting Lysand...");
|
||||
|
||||
// NODE_ENV seems to be broken and output `development` even when set to production, so use the flag instead
|
||||
|
|
|
|||
Loading…
Reference in a new issue