mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added a "|", and minor log improvement
This commit is contained in:
parent
a2e4091c94
commit
75655e4ea5
2 changed files with 3 additions and 7 deletions
|
@ -70,7 +70,7 @@ function LogReq (req, toFile, sc) {
|
|||
|
||||
logEntry += dl + req.hostname + dl + req.headers['user-agent'] + dl + req.method + dl
|
||||
|
||||
logEntry += req.url
|
||||
logEntry += C(GetRandomColor(ip)) + req.url
|
||||
|
||||
if (sc !== undefined && sc === 404) { logEntry += dl + sc }
|
||||
|
||||
|
@ -95,11 +95,7 @@ function GetRandomColor (ip) {
|
|||
}
|
||||
|
||||
let res = ip.split('').reduce((res, x) => {
|
||||
if (!isNaN(x)) {
|
||||
return res + parseInt(x)
|
||||
} else {
|
||||
return res
|
||||
}
|
||||
return res + x.charCodeAt(0)
|
||||
}, 0)
|
||||
return colors[res % colors.length]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue