fix(#12): Implement structured logging with request correlation and security event marking
Some checks are pending
Docker Test / test (push) Waiting to run

This commit is contained in:
OpenClaw 2026-03-06 23:34:31 +00:00
parent 32480438c7
commit 0679332c77
3 changed files with 77 additions and 2 deletions

View file

@ -5,7 +5,8 @@ function logger(req, res, next) {
method: req.method,
url: req.url,
requestId: req.requestId,
level: 'info'
level: 'info',
route: req.route ? req.route.path : 'unknown'
}));
res.on('finish', () => {
const securityEvent = [401, 403].includes(res.statusCode);
@ -16,7 +17,8 @@ function logger(req, res, next) {
status: res.statusCode,
requestId: req.requestId,
level: res.statusCode >= 400 ? 'error' : 'info',
securityEvent: securityEvent
securityEvent: securityEvent,
route: req.route ? req.route.path : 'unknown'
}));
});
next();