mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
21 lines
632 B
CoffeeScript
21 lines
632 B
CoffeeScript
logger = require "logger-sharelatex"
|
|
|
|
module.exports.logger = (req, res, next) ->
|
|
startTime = new Date()
|
|
end = res.end
|
|
res.end = () ->
|
|
end.apply(this, arguments)
|
|
logger.log
|
|
req:
|
|
url: req.originalUrl || req.url
|
|
method: req.method
|
|
referrer: req.headers['referer'] || req.headers['referrer']
|
|
"remote-addr": req.ip || req.socket?.socket?.remoteAddress || req.socket?.remoteAddress
|
|
"user-agent": req.headers["user-agent"]
|
|
"content-length": req.headers["content-length"]
|
|
res:
|
|
"content-length": res._headers?["content-length"]
|
|
"response-time": new Date() - startTime
|
|
"http request"
|
|
next()
|
|
|