mirror of
https://git.femboyfinancial.jp/james/FemScoreboard.git
synced 2025-01-29 09:49:02 -08:00
Better date formatting in logs
This commit is contained in:
parent
2809c29c9a
commit
49360a7c5b
@ -86,7 +86,7 @@ async function scheduleRandomMessage(firstTime = false)
|
||||
const timeoutMins = Math.random() * 360 + 120;
|
||||
const scheduledTime = new Date();
|
||||
scheduledTime.setMinutes(scheduledTime.getMinutes() + timeoutMins);
|
||||
logInfo(`[bot] Next MOTD: ${scheduledTime}`);
|
||||
logInfo(`[bot] Next MOTD: ${scheduledTime.toLocaleTimeString()}`);
|
||||
setTimeout(scheduleRandomMessage, timeoutMins * 60 * 1000);
|
||||
}
|
||||
|
||||
|
@ -16,16 +16,20 @@ const reactionEmojis: string[] = process.env.REACTIONS.split(',');
|
||||
let db: Database = null;
|
||||
|
||||
|
||||
function curDateStr() {
|
||||
return new Date().toJSON().replace('T', ' ').replace('Z', '');
|
||||
}
|
||||
|
||||
function logInfo(...data) {
|
||||
console.log(`[${new Date()}] ${data.join(' ')}`);
|
||||
console.log(`[${curDateStr()}] ${data.join(' ')}`);
|
||||
}
|
||||
|
||||
function logWarn(...data) {
|
||||
console.warn(`[${new Date()}] ${data.join(' ')}`);
|
||||
console.warn(`[${curDateStr()}] ${data.join(' ')}`);
|
||||
}
|
||||
|
||||
function logError(...data) {
|
||||
console.error(`[${new Date()}] ${data.join(' ')}`);
|
||||
console.error(`[${curDateStr()}] ${data.join(' ')}`);
|
||||
}
|
||||
|
||||
async function openDb() {
|
||||
|
Loading…
Reference in New Issue
Block a user