Bugfix
This commit is contained in:
parent
72d781b1a9
commit
a19acec354
1 changed files with 3 additions and 3 deletions
|
@ -5,13 +5,13 @@ import { default as settings } from '../settings.json' with {type: "json"}
|
||||||
const checkLog = () => {
|
const checkLog = () => {
|
||||||
if (settings.disableLogging) return
|
if (settings.disableLogging) return
|
||||||
try {
|
try {
|
||||||
if (!fs.readdirSync('.').includes('logs')) fs.mkdirSync('logs')
|
if (!readdirSync('.').includes('logs')) mkdirSync('logs')
|
||||||
const dateToday = new Date(Date.now())
|
const dateToday = new Date(Date.now())
|
||||||
const dateTomorrow = new Date(Date.now() + 86400000)
|
const dateTomorrow = new Date(Date.now() + 86400000)
|
||||||
const filenameToday = `${dateToday.getUTCMonth() + 1}-${dateToday.getUTCDate()}-${dateToday.getUTCFullYear()}`
|
const filenameToday = `${dateToday.getUTCMonth() + 1}-${dateToday.getUTCDate()}-${dateToday.getUTCFullYear()}`
|
||||||
const filenameTomorrow = `${dateTomorrow.getUTCMonth() + 1}-${dateTomorrow.getUTCDate()}-${dateTomorrow.getUTCFullYear()}`
|
const filenameTomorrow = `${dateTomorrow.getUTCMonth() + 1}-${dateTomorrow.getUTCDate()}-${dateTomorrow.getUTCFullYear()}`
|
||||||
if (!fs.readdirSync('./logs').includes(filenameToday)) fs.mkdirSync(`logs/${filenameToday}`)
|
if (!readdirSync('./logs').includes(filenameToday)) mkdirSync(`logs/${filenameToday}`)
|
||||||
if (!fs.readdirSync('./logs').includes(filenameTomorrow)) fs.mkdirSync(`logs/${filenameTomorrow}`) // Create tomorrow's log directory early
|
if (!readdirSync('./logs').includes(filenameTomorrow)) mkdirSync(`logs/${filenameTomorrow}`) // Create tomorrow's log directory early
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e) // Prevents some crashes when disk space is full or when the permissions are incorrect
|
console.log(e) // Prevents some crashes when disk space is full or when the permissions are incorrect
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue