feat(federation): add room sync and deletion notification endpoints for federated instances fix(federation): handle room deletion and update settings during sync process feat(federation): enhance FederatedRoomCard and FederatedRoomDetail components to display deleted rooms i18n: add translations for room deletion messages in English and German
26 lines
850 B
JavaScript
26 lines
850 B
JavaScript
import { log, fmtDuration, fmtStatus, fmtMethod } from '../config/logger.js';
|
|
|
|
export default function requestResponseLogger(req, res, next) {
|
|
const start = Date.now();
|
|
const { method, originalUrl } = req;
|
|
|
|
res.on('finish', () => {
|
|
try {
|
|
const duration = Date.now() - start;
|
|
const status = res.statusCode;
|
|
const contentType = (res.getHeader?.('content-type') || '').toString().toLowerCase();
|
|
const format = contentType.includes('json') ? 'json' : contentType.includes('html') ? 'html' : '';
|
|
const formatStr = format ? ` ${format}` : '';
|
|
|
|
// METHOD /path → status (duration)
|
|
log.http.info(
|
|
`${fmtMethod(method)} ${originalUrl} → ${fmtStatus(status)}${formatStr} (${fmtDuration(duration)})`
|
|
);
|
|
} catch {
|
|
// never break the request pipeline
|
|
}
|
|
});
|
|
|
|
return next();
|
|
}
|