refactor: write error logs into a file
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import fs from "fs";
|
||||||
function timestamp() {
|
function timestamp() {
|
||||||
return new Date().toISOString();
|
return new Date().toISOString();
|
||||||
}
|
}
|
||||||
@@ -44,6 +45,9 @@ export const logger = {
|
|||||||
log("warn", step, message, details);
|
log("warn", step, message, details);
|
||||||
},
|
},
|
||||||
error(step, message, details) {
|
error(step, message, details) {
|
||||||
|
fs.writeFileSync("./logs.err.log", `${step}, ${message}, ${details}`, {
|
||||||
|
encoding: "utf-8",
|
||||||
|
});
|
||||||
log("error", step, message, details);
|
log("error", step, message, details);
|
||||||
},
|
},
|
||||||
debug(step, message, details) {
|
debug(step, message, details) {
|
||||||
|
|||||||
Reference in New Issue
Block a user