All files / src/common/middlewares access.js

100% Statements 4/4
100% Branches 2/2
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13    2x     12x 12x   12x        
import { newLogger } from "@common/utils/logger.js";
 
const logger = newLogger("Middleware|access");
 
function accessLog(req, res, next) {
    const remoteClient = req.headers['x-forwarded-for'] || req.socket.remoteAddress 
    logger.debug('[access] %s "%s %s HTTP/%s"', remoteClient, req.originalMethod, req.originalUrl, req.httpVersion);
 
    next();
}
 
export { accessLog };