Logging fix

This commit is contained in:
mrfry 2022-05-16 16:23:15 +02:00
parent 832a8f263b
commit d53c46037b

View file

@ -113,7 +113,7 @@ function LogReq(
if (req.url.includes('lred')) {
dl += C('red')
}
if (!shouldLog(req.session.user.id, noLogIds)) {
if (req.session && req.session.user && !shouldLog(req.session.user.id, noLogIds)) {
return
}
@ -225,14 +225,13 @@ function Load(): void {
}
export function shouldLog(userId: string | number, nolog: string[]): boolean {
return nolog.some((noLogId) => {
return !nolog.some((noLogId) => {
return noLogId === userId.toString()
})
}
function LogStat(url: string, hostname: string, userId: number | string): void {
const nolog = shouldLog(userId, noLogIds)
if (nolog) {
if (!shouldLog(userId, noLogIds)) {
return
}