Make all logging level checks the same shape.

see https://gitlab.com/tezos/tezos/merge_requests/411#note_83833997
This commit is contained in:
James Deikun 2018-06-28 23:24:39 -04:00 committed by Pierre Boutillier
parent 135cb2c326
commit b76e759361

View File

@ -105,34 +105,34 @@ module Make_semantic(S : MESSAGE) : SEMLOG = struct
let log_f ~level = 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) -> fun format ?(tags=Tag.empty) ->
Format.kasprintf Format.kasprintf
(fun text -> (fun text ->
call_taps { section = Section ; level ; text = Some text ; tags }; call_taps { section = Section ; level ; text = Some text ; tags };
Lwt_log_core.log ~section ~level text) Lwt_log_core.log ~section ~level text)
format 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 = 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) -> fun format ?(tags=Tag.empty) ->
Format.kasprintf Format.kasprintf
(fun text -> (fun text ->
call_taps { section = Section ; level ; text = Some text ; tags }; call_taps { section = Section ; level ; text = Some text ; tags };
Lwt_log_core.ign_log ~section ~level text) Lwt_log_core.ign_log ~section ~level text)
format 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 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) let log_info f = f (ign_log_f ~level:Lwt_log_core.Info) ?tags:(Some Tag.empty)