-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug in the log file generator.
- Loading branch information
Showing
4 changed files
with
35 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
const { createWriteStream } = require("fs"); | ||
const { createWriteStream, existsSync, mkdirSync } = require("fs"); | ||
const { format } = require("util"); | ||
|
||
module.exports = (info) => { | ||
const date = new Date(); | ||
const year = date.getFullYear(); | ||
const month = date.getMonth(); | ||
const day = date.getDay(); | ||
const file = createWriteStream(__dirname + "../../../logs/debug_" + year + "-" + month + "-" + day + ".log", { "flags" : "w" }); | ||
const dir = "./source/logs/"; | ||
|
||
if (!existsSync(dir)) mkdirSync(dir); | ||
|
||
const file = createWriteStream("./source/logs/debug_" + year + "-" + month + "-" + day + ".log", { "flags" : "w" }); | ||
|
||
file.write(format(info) + "\n"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
const { createWriteStream } = require("fs"); | ||
const { createWriteStream, existsSync, mkdirSync } = require("fs"); | ||
const { format } = require("util"); | ||
|
||
module.exports = (error) => { | ||
const date = new Date(); | ||
const minutes = date.getMinutes(); | ||
const hours = date.getHours(); | ||
const year = date.getFullYear(); | ||
const month = date.getMonth(); | ||
const day = date.getDay(); | ||
const file = createWriteStream(__dirname + "../../../logs/error_" + year + "-" + month + "-" + day + "_" + hours + "-" + minutes + ".log", { "flags" : "w" }); | ||
const dir = "./source/logs/"; | ||
|
||
if (!existsSync(dir)) mkdirSync(dir); | ||
|
||
const file = createWriteStream("./source/logs/error_" + year + "-" + month + "-" + day + ".log", { "flags" : "w" }); | ||
|
||
file.write(format(error) + "\n"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
const { createWriteStream } = require("fs"); | ||
const { createWriteStream, existsSync, mkdirSync } = require("fs"); | ||
const { format } = require("util"); | ||
|
||
module.exports = (info) => { | ||
const date = new Date(); | ||
const minutes = date.getMinutes(); | ||
const hours = date.getHours(); | ||
const year = date.getFullYear(); | ||
const month = date.getMonth(); | ||
const day = date.getDay(); | ||
const file = createWriteStream(__dirname + "../../../logs/warn_" + year + "-" + month + "-" + day + "_" + hours + "-" + minutes + ".log", { "flags" : "w" }); | ||
const dir = "./source/logs/"; | ||
|
||
if (!existsSync(dir)) mkdirSync(dir); | ||
|
||
const file = createWriteStream("./source/logs/warn_" + year + "-" + month + "-" + day + ".log", { "flags" : "w" }); | ||
|
||
file.write(format(info) + "\n"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters