-
I want to suppress "2025-01-31T21:56:59.007Z debug: GET: /v1/other/health" from being logged even if we are in debug mode. |
Beta Was this translation helpful? Give feedback.
Answered by
RobinTail
Apr 7, 2025
Replies: 2 comments
-
class MyLogger extends BuiltinLogger {
public override debug(message: string, meta?: unknown) {
if (/GET: \/v1\/other\/health/.test(message)) return;
super.debug(message, meta);
}
}
createConfig({
logger: new MyLogger()
}); You can also use createConfig({
childLoggerProvider: ({request, parent}) => {
if (request.path === "/v1/other/health") {
return {
debug: () => {},
// ... others
};
}
return parent.child(); // or just parent if you don't need tracking requestId
};
}); |
Beta Was this translation helpful? Give feedback.
0 replies
-
@gmorgen1 starting v22.13.0 you can customize or disable access logging directly import { createConfig } from "express-zod-api";
const config = createConfig({
// or null to disable it:
accessLogger: (request, logger) => {
if (/GET: \/v1\/other\/health/.test(request.path)) return;
logger.info(`${request.megtho}: ${request.path}`);
}
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
RobinTail
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@gmorgen1 starting v22.13.0 you can customize or disable access logging directly