From 31d207f52ef2020eaf4e4de064182138caace8a8 Mon Sep 17 00:00:00 2001 From: Vincent Botbol Date: Tue, 25 Sep 2018 16:40:30 +0200 Subject: [PATCH] Baker: improve logging --- src/proto_alpha/lib_delegate/client_baking_forge.ml | 6 +++--- src/proto_alpha/lib_delegate/client_baking_revelation.ml | 2 +- src/proto_alpha/lib_delegate/client_daemon.ml | 9 +++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/proto_alpha/lib_delegate/client_baking_forge.ml b/src/proto_alpha/lib_delegate/client_baking_forge.ml index 6a891b8d7..68b24606a 100644 --- a/src/proto_alpha/lib_delegate/client_baking_forge.ml +++ b/src/proto_alpha/lib_delegate/client_baking_forge.ml @@ -836,7 +836,7 @@ let bake (cctxt : #Proto_alpha.full) state = ~shell_header ~priority ?seed_nonce_hash ~src_sk operations |> trace_exn (Failure "Error while injecting block") >>=? fun block_hash -> - lwt_log_info Tag.DSL.(fun f -> + lwt_log_notice Tag.DSL.(fun f -> f "Injected block %a for %s after %a (level %a, priority %d, fitness %a, operations %a)." -% t event "injected_block" -% a Block_hash.Logging.tag block_hash @@ -906,7 +906,7 @@ let compute_best_slot_on_current_level let level = Raw_level.succ new_head.Client_baking_blocks.level in get_baking_slots cctxt ?max_priority new_head delegates >>= function | [] -> - lwt_log_info Tag.DSL.(fun f -> + lwt_log_notice Tag.DSL.(fun f -> let max_priority = Option.unopt ~default:default_max_priority max_priority in f "No slot found at level %a (max_priority = %d)" -% t event "no_slot_found" @@ -923,7 +923,7 @@ let compute_best_slot_on_current_level ) h t in Client_keys.Public_key_hash.name cctxt delegate >>=? fun name -> - lwt_log_info Tag.DSL.(fun f -> + lwt_log_notice Tag.DSL.(fun f -> f "New baking slot found (level %a, priority %d) at %a for %s after %a." -% t event "have_baking_slot" -% a level_tag level diff --git a/src/proto_alpha/lib_delegate/client_baking_revelation.ml b/src/proto_alpha/lib_delegate/client_baking_revelation.ml index 30b03e438..068d0010a 100644 --- a/src/proto_alpha/lib_delegate/client_baking_revelation.ml +++ b/src/proto_alpha/lib_delegate/client_baking_revelation.ml @@ -45,7 +45,7 @@ let forge_seed_nonce_revelation Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash -> match nonces with | [] -> - lwt_log_info Tag.DSL.(fun f -> + lwt_log_notice Tag.DSL.(fun f -> f "Nothing to reveal for block %a" -% t event "no_nonce_reveal" -% a Block_hash.Logging.tag hash diff --git a/src/proto_alpha/lib_delegate/client_daemon.ml b/src/proto_alpha/lib_delegate/client_daemon.ml index 128b272f5..b8cacf2ad 100644 --- a/src/proto_alpha/lib_delegate/client_daemon.ml +++ b/src/proto_alpha/lib_delegate/client_daemon.ml @@ -25,9 +25,11 @@ let await_bootstrapped_node (cctxt: #Proto_alpha.full) = (* Waiting for the node to be synchronized *) - cctxt#message "Waiting for the node to be synchronized with the its \ + cctxt#message "Waiting for the node to be synchronized with its \ peers..." >>= fun () -> - Shell_services.Monitor.bootstrapped cctxt + Shell_services.Monitor.bootstrapped cctxt >>=? fun _ -> + cctxt#message "Node synchronized." >>= fun () -> + return_unit module Endorser = struct @@ -36,6 +38,7 @@ module Endorser = struct Client_baking_blocks.monitor_heads ~next_protocols:(Some [Proto_alpha.hash]) cctxt `Main >>=? fun block_stream -> + cctxt#message "Endorser started." >>= fun () -> Client_baking_endorsement.create cctxt ~delay delegates block_stream >>=? fun () -> ignore min_date; return_unit @@ -56,6 +59,7 @@ module Baker = struct Client_baking_blocks.monitor_heads ~next_protocols:(Some [Proto_alpha.hash]) cctxt `Main >>=? fun block_stream -> + cctxt#message "Baker started." >>= fun () -> Client_baking_forge.create cctxt ?fee_threshold ?max_priority ~max_waiting_time ~context_path delegates block_stream >>=? fun () -> ignore min_date; @@ -70,6 +74,7 @@ module Accuser = struct Client_baking_blocks.monitor_valid_blocks ~next_protocols:(Some [Proto_alpha.hash]) cctxt ~chains:[ `Main ] () >>=? fun valid_blocks_stream -> + cctxt#message "Accuser started." >>= fun () -> Client_baking_denunciation.create cctxt ~preserved_levels valid_blocks_stream >>=? fun () -> return_unit