Logging of RPCs

This commit is contained in:
Milo Davis 2017-08-25 11:21:27 +02:00 committed by Grégoire Henry
parent f2f4682606
commit f184be8ddc
2 changed files with 8 additions and 2 deletions

View File

@ -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 = [

View File

@ -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 () ->