From 498a144ffd672448a8abca2ecfbce052bd5dba7c Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sat, 30 Nov 2024 09:59:17 +0000 Subject: [PATCH] Record a trace event for method calls Makes traces easier to navigate. Currently only enabled when debug logging is on (ideally it should be enabled when tracing is on, but OCaml doesn't tell us that). --- CHANGES.md | 2 +- capnp-rpc/service.ml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index da505f4e..040d0f55 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -44,7 +44,7 @@ New features: API changes: -- Eio port (@talex5 #280 #284 #298 #292 #297 #300). +- Eio port (@talex5 #280 #284 #298 #292 #297 #300 #304). This switches capnp-rpc from Lwt to Eio. One particularly nice side effect of this is that `Service.return_lwt` has gone, diff --git a/capnp-rpc/service.ml b/capnp-rpc/service.ml index 01b0e40e..2485eadc 100644 --- a/capnp-rpc/service.ml +++ b/capnp-rpc/service.ml @@ -38,7 +38,10 @@ let local (s:#generic) = let call = Msg.Request.readable msg in let interface_id = Call.interface_id_get call in let method_id = Call.method_id_get call in - Log.debug (fun f -> f "Invoking local method %a" pp_method (interface_id, method_id)); + Log.debug (fun f -> + Eio.Private.Trace.log (Fmt.str "%a" pp_method (interface_id, method_id)); + f "Invoking local method %a" pp_method (interface_id, method_id) + ); let p = Call.params_get call in let m : abstract_method_t = s#dispatch ~interface_id ~method_id in let release_params () = Core_types.Request_payload.release msg in