🚧 Started working on processing of substitutions

This commit is contained in:
2022-05-02 22:56:38 +02:00
parent 9bd8132119
commit b3f2ec52d4
6 changed files with 573 additions and 1 deletions

15
server/logs.js Normal file
View File

@ -0,0 +1,15 @@
import fs from "fs";
export function log(type, text) {
if (!fs.existsSync("logs")) fs.mkdirSync("logs");
const logName = new Date().toISOString().split("T")[0] + ".log";
const timestamp = new Date().toISOString().replace("T", " ").split(".")[0];
const logLine = `<${timestamp}> [${type}]: ${text}`;
fs.appendFileSync("logs/" + logName, logLine + "\n");
console.log(logLine);
}
export function getLogPath() {
const logName = new Date().toISOString().split("T")[0] + ".log";
return "logs/" + logName;
}