Make all logging level checks the same shape.
see https://gitlab.com/tezos/tezos/merge_requests/411#note_83833997
This commit is contained in:
parent
135cb2c326
commit
b76e759361
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user