From 5915e98a55c2bf6181f01315708201d32c1e0fd4 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Thu, 10 Jan 2019 11:30:27 +0100 Subject: [PATCH] shell: Better Logging --- src/lib_shell/mempool_peer_worker.ml | 12 +++++++----- src/lib_shell/worker.ml | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib_shell/mempool_peer_worker.ml b/src/lib_shell/mempool_peer_worker.ml index 4360fd130..9f7c32000 100644 --- a/src/lib_shell/mempool_peer_worker.ml +++ b/src/lib_shell/mempool_peer_worker.ml @@ -261,11 +261,13 @@ module Make (Static: STATIC) (Mempool_worker: Mempool_worker.T) let encoding = let open Data_encoding in list Operation_hash.encoding - let pp ppf os = - Format.fprintf ppf - "@[Request:@,%a@]" - (Format.pp_print_list Operation_hash.pp) - os + let pp ppf = function + |[] -> Format.fprintf ppf "@[Request:@, Empty List of Operations@]" + |os -> + Format.fprintf ppf + "@[Request:@,%a@]" + (Format.pp_print_list Operation_hash.pp) + os end module Event = struct diff --git a/src/lib_shell/worker.ml b/src/lib_shell/worker.ml index 5109b995f..78c60d2de 100644 --- a/src/lib_shell/worker.ml +++ b/src/lib_shell/worker.ml @@ -491,7 +491,7 @@ module Make | Ok () -> loop () | Error [Canceled | Exn Lwt_pipe.Closed | Exn Lwt_dropbox.Closed ] -> - Logger.lwt_log_notice "Worker terminated" >>= fun () -> + Logger.lwt_log_notice "@[Worker terminated [%a] @]" Name.pp w.name >>= fun () -> do_close None | Error errs -> begin match w.current_request with