From b76e759361832b45a6fe96da3ada9729b695fec1 Mon Sep 17 00:00:00 2001 From: James Deikun Date: Thu, 28 Jun 2018 23:24:39 -0400 Subject: [PATCH] Make all logging level checks the same shape. see https://gitlab.com/tezos/tezos/merge_requests/411#note_83833997 --- src/lib_stdlib/logging.ml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lib_stdlib/logging.ml b/src/lib_stdlib/logging.ml index 75e2b5fb4..2a48aefe4 100644 --- a/src/lib_stdlib/logging.ml +++ b/src/lib_stdlib/logging.ml @@ -105,34 +105,34 @@ module Make_semantic(S : MESSAGE) : SEMLOG = struct let log_f ~level = - if level >= Lwt_log_core.Section.level section then + if level < Lwt_log_core.Section.level section then + fun format ?(tags=Tag.empty) -> + Format.ikfprintf + (fun _ -> call_taps { section = Section ; level ; text = None ; tags }; Lwt.return_unit) + Format.std_formatter + format + else fun format ?(tags=Tag.empty) -> Format.kasprintf (fun text -> call_taps { section = Section ; level ; text = Some text ; tags }; Lwt_log_core.log ~section ~level text) format - else - fun format ?(tags=Tag.empty) -> - Format.ikfprintf - (fun _ -> call_taps { section = Section ; level ; text = None ; tags }; Lwt.return_unit) - Format.std_formatter - format let ign_log_f ~level = - if level >= Lwt_log_core.Section.level section then + if level < Lwt_log_core.Section.level section then + fun format ?(tags=Tag.empty) -> + Format.ikfprintf + (fun _ -> call_taps { section = Section ; level ; text = None ; tags }) + Format.std_formatter + format + else fun format ?(tags=Tag.empty) -> Format.kasprintf (fun text -> call_taps { section = Section ; level ; text = Some text ; tags }; Lwt_log_core.ign_log ~section ~level text) format - else - fun format ?(tags=Tag.empty) -> - Format.ikfprintf - (fun _ -> call_taps { section = Section ; level ; text = None ; tags }) - Format.std_formatter - format let debug f = f (ign_log_f ~level:Lwt_log_core.Debug) ?tags:(Some Tag.empty) let log_info f = f (ign_log_f ~level:Lwt_log_core.Info) ?tags:(Some Tag.empty)