mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Logging fix
This commit is contained in:
parent
832a8f263b
commit
d53c46037b
1 changed files with 3 additions and 4 deletions
|
@ -113,7 +113,7 @@ function LogReq(
|
||||||
if (req.url.includes('lred')) {
|
if (req.url.includes('lred')) {
|
||||||
dl += C('red')
|
dl += C('red')
|
||||||
}
|
}
|
||||||
if (!shouldLog(req.session.user.id, noLogIds)) {
|
if (req.session && req.session.user && !shouldLog(req.session.user.id, noLogIds)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,14 +225,13 @@ function Load(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function shouldLog(userId: string | number, nolog: string[]): boolean {
|
export function shouldLog(userId: string | number, nolog: string[]): boolean {
|
||||||
return nolog.some((noLogId) => {
|
return !nolog.some((noLogId) => {
|
||||||
return noLogId === userId.toString()
|
return noLogId === userId.toString()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function LogStat(url: string, hostname: string, userId: number | string): void {
|
function LogStat(url: string, hostname: string, userId: number | string): void {
|
||||||
const nolog = shouldLog(userId, noLogIds)
|
if (!shouldLog(userId, noLogIds)) {
|
||||||
if (nolog) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue