Update:Log uncaught exceptions to crash_logs.txt #706 & cleanup logger

This commit is contained in:
advplyr 2024-02-15 16:46:19 -06:00
parent 04d16fc535
commit af7cb2432b
9 changed files with 223 additions and 107 deletions

View file

@ -699,7 +699,7 @@ class MiscController {
}
/**
* GET: /api/me/stats/year/:year
* GET: /api/stats/year/:year
*
* @param {import('express').Request} req
* @param {import('express').Response} res
@ -717,5 +717,23 @@ class MiscController {
const stats = await adminStats.getStatsForYear(year)
res.json(stats)
}
/**
* GET: /api/logger-data
* admin or up
*
* @param {import('express').Request} req
* @param {import('express').Response} res
*/
async getLoggerData(req, res) {
if (!req.user.isAdminOrUp) {
Logger.error(`[MiscController] Non-admin user "${req.user.username}" attempted to get logger data`)
return res.sendStatus(403)
}
res.json({
currentDailyLogs: Logger.logManager.getMostRecentCurrentDailyLogs()
})
}
}
module.exports = new MiscController()