mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Logging fix, ignoring some ips in logging, displaying "DIR" insted of 0MB
This commit is contained in:
parent
3c52873422
commit
f7b0e727fc
3 changed files with 26 additions and 13 deletions
25
server.js
25
server.js
|
@ -65,6 +65,19 @@ let modules = {
|
|||
|
||||
const app = express()
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
res.on('finish', function () {
|
||||
logger.LogReq(req, true, res.statusCode)
|
||||
let toLog = loggableKeywords.some((x) => {
|
||||
return req.url.includes(x)
|
||||
})
|
||||
if (toLog) { logger.LogReq(req) }
|
||||
if (res.statusCode !== 404) { stat.LogStat(req.url) }
|
||||
})
|
||||
next()
|
||||
})
|
||||
|
||||
|
||||
Object.keys(modules).forEach(function (k, i) {
|
||||
let x = modules[k]
|
||||
try {
|
||||
|
@ -132,18 +145,6 @@ function setLogTimer () {
|
|||
|
||||
setLogTimer()
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
res.on('finish', function () {
|
||||
logger.LogReq(req, true, res.statusCode)
|
||||
let toLog = loggableKeywords.some((x) => {
|
||||
return req.url.includes(x)
|
||||
})
|
||||
if (toLog) { logger.LogReq(req) }
|
||||
if (res.statusCode !== 404) { stat.LogStat(req.url) }
|
||||
})
|
||||
next()
|
||||
})
|
||||
|
||||
logger.Log('Node version: ' + process.version)
|
||||
logger.Log('Listening on port: ' + port)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue