mirror of
https://git.femboyfinancial.jp/james/FemScoreboard.git
synced 2025-01-30 02:09:01 -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 timeoutMins = Math.random() * 360 + 120;
|
||||||
const scheduledTime = new Date();
|
const scheduledTime = new Date();
|
||||||
scheduledTime.setMinutes(scheduledTime.getMinutes() + timeoutMins);
|
scheduledTime.setMinutes(scheduledTime.getMinutes() + timeoutMins);
|
||||||
logInfo(`[bot] Next MOTD: ${scheduledTime}`);
|
logInfo(`[bot] Next MOTD: ${scheduledTime.toLocaleTimeString()}`);
|
||||||
setTimeout(scheduleRandomMessage, timeoutMins * 60 * 1000);
|
setTimeout(scheduleRandomMessage, timeoutMins * 60 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,16 +16,20 @@ const reactionEmojis: string[] = process.env.REACTIONS.split(',');
|
|||||||
let db: Database = null;
|
let db: Database = null;
|
||||||
|
|
||||||
|
|
||||||
|
function curDateStr() {
|
||||||
|
return new Date().toJSON().replace('T', ' ').replace('Z', '');
|
||||||
|
}
|
||||||
|
|
||||||
function logInfo(...data) {
|
function logInfo(...data) {
|
||||||
console.log(`[${new Date()}] ${data.join(' ')}`);
|
console.log(`[${curDateStr()}] ${data.join(' ')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function logWarn(...data) {
|
function logWarn(...data) {
|
||||||
console.warn(`[${new Date()}] ${data.join(' ')}`);
|
console.warn(`[${curDateStr()}] ${data.join(' ')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function logError(...data) {
|
function logError(...data) {
|
||||||
console.error(`[${new Date()}] ${data.join(' ')}`);
|
console.error(`[${curDateStr()}] ${data.join(' ')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openDb() {
|
async function openDb() {
|
||||||
|
Loading…
Reference in New Issue
Block a user