From f184be8ddc2e1939d085d470ddba59ed9c867967 Mon Sep 17 00:00:00 2001 From: Milo Davis Date: Fri, 25 Aug 2017 11:21:27 +0200 Subject: [PATCH] Logging of RPCs --- src/client/client_config.ml | 5 +++++ src/client_main.ml | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/client/client_config.ml b/src/client/client_config.ml index 26501664c..ba142578d 100644 --- a/src/client/client_config.ml +++ b/src/client/client_config.ml @@ -164,12 +164,14 @@ let preparse_args argv = type cli_args = { block: Node_rpc_services.Blocks.block ; print_timings: bool ; + log_requests: bool ; force: bool ; } let default_cli_args = { block = Client_commands.default_cfg.block ; print_timings = false ; + log_requests = false ; force = false ; } @@ -197,6 +199,9 @@ let parse_args usage dispatcher argv = "-block", Arg.String (fun _ -> ( (* preparsed *) )), "The block on which to apply contextual commands.\n\ default: " ^ Node_rpc_services.Blocks.to_string default_cli_args.block ; + "-log-requests", + Arg.Unit (fun () -> parsed_args := { !parsed_args with log_requests = true }), + "If set, this flag causes all requests and responses to the node to be logged." ] in (* Command-line args which can be set in config file as well *) let file_args = [ diff --git a/src/client_main.ml b/src/client_main.ml index c6726db6b..8666a34dc 100644 --- a/src/client_main.ml +++ b/src/client_main.ml @@ -78,8 +78,9 @@ let main () = if parsed_args.print_timings then { rpc_config with logger = Client_rpcs.timings_logger Format.err_formatter } - else - rpc_config + else if parsed_args.log_requests + then {rpc_config with logger = Client_rpcs.full_logger Format.err_formatter } + else rpc_config in command (cctxt config rpc_config)) >>= function | Ok () ->