Optional
connection?: { Optional
remoteexport const myRequestHandler = (deps: { log: SimpleLoggerInterface }) =>
(req: Request, res: Response, next: NextFunction) => {
try {
const log = logger(deps.log, req, res);
log.info("Starting request `myRequestHandler`");
// ...
res.send("OK");
} catch (e) {
next(e);
}
}
Generated using TypeDoc
Call this function at the top of your request handlers and/or middleware to obtain a logger tagged with information from the current request. For a given request, you'll always get the same logger back.