Closed elawad closed 2 months ago
Is the solution to use the on error
event?
https://github.com/chimurai/http-proxy-middleware/blob/32a5b233a1ba488083821cfd1c356deb56792d27/src/plugins/default/logger-plugin.ts#L22-L31
You can use a logger library and set the log level there: https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/logger.md
Or create a custom logger object to only log errors:
app.use('/api', createProxyMiddleware({
target: 'https://example.com/api',
changeOrigin: true,
logger: {
info: () => {},
warn: () => {},
error: console.error,
},
}));
That's exactly what I wanted, thank you!
Checks
http-proxy-middleware
.Describe the bug (be clear and concise)
Before v3 we could use
logLevel: 'error'
to only log errors. With v3 we now uselogger: console
but this output lots of info logs.What's the best way to filter only error logs, keeping HPM's log format?
Step-by-step reproduction instructions
Expected behavior (be clear and concise)
A way to reduce logs to only errors.
How is http-proxy-middleware used in your project?
What http-proxy-middleware configuration are you using?
What OS/version and node/version are you seeing the problem?
Additional context (optional)
No response