🚧 Started working on processing of substitutions
This commit is contained in:
15
server/logs.js
Normal file
15
server/logs.js
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user