File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -298,13 +298,20 @@ async fn run_server(addr: SocketAddr) -> anyhow::Result<()> {
298
298
Ok :: < _ , hyper:: Error > ( hyper:: service:: service_fn ( move |req| {
299
299
let uuid = uuid:: Uuid :: new_v4 ( ) ;
300
300
let span = tracing:: span!( tracing:: Level :: INFO , "request" , ?uuid) ;
301
+ // Only log the webhook responses at INFO level to avoid flooding the
302
+ // logs with huge responses. Other responses are at DEBUG.
303
+ let log_info_response = matches ! ( req. uri( ) . path( ) , "/github-hook" | "/zulip-hook" ) ;
301
304
serve_req ( req, ctx. clone ( ) , agenda. clone ( ) )
302
305
. map ( move |mut resp| {
303
306
if let Ok ( resp) = & mut resp {
304
307
resp. headers_mut ( )
305
308
. insert ( "X-Request-Id" , uuid. to_string ( ) . parse ( ) . unwrap ( ) ) ;
306
309
}
307
- log:: info!( "response = {:?}" , resp) ;
310
+ if log_info_response {
311
+ log:: info!( "response = {resp:?}" ) ;
312
+ } else {
313
+ log:: debug!( "response = {resp:?}" ) ;
314
+ }
308
315
resp
309
316
} )
310
317
. instrument ( span)
You can’t perform that action at this time.
0 commit comments