From 634c398a70f5248e96ca45aac0d4d1ce925e19bf Mon Sep 17 00:00:00 2001 From: James Deikun Date: Thu, 28 Jun 2018 23:00:19 -0400 Subject: [PATCH] Use `text: string option` since text may be absent see https://gitlab.com/tezos/tezos/merge_requests/411#note_83833997 --- src/lib_stdlib/logging.ml | 14 +++++++------- src/lib_stdlib/logging.mli | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib_stdlib/logging.ml b/src/lib_stdlib/logging.ml index 0bf529ce0..b8723ce76 100644 --- a/src/lib_stdlib/logging.ml +++ b/src/lib_stdlib/logging.ml @@ -37,7 +37,7 @@ type log_section = .. type log_message = { section : log_section ; level : level ; - text : string ; + text : string option ; tags : Tag.set ; } @@ -109,13 +109,13 @@ module Make_semantic(S : MESSAGE) : SEMLOG = struct fun format ?(tags=Tag.empty) -> Format.kasprintf (fun text -> - call_taps { section = Section ; level ; text ; tags }; + 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 = "" ; tags }; Lwt.return_unit) + (fun _ -> call_taps { section = Section ; level ; text = None ; tags }; Lwt.return_unit) Format.std_formatter format @@ -124,13 +124,13 @@ module Make_semantic(S : MESSAGE) : SEMLOG = struct fun format ?(tags=Tag.empty) -> Format.kasprintf (fun text -> - call_taps { section = Section ; level ; text ; tags }; + 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 = "" ; tags }) + (fun _ -> call_taps { section = Section ; level ; text = None ; tags }) Format.std_formatter format @@ -187,7 +187,7 @@ module Make_unregistered(S : sig val name: string end) : LOG = struct else Format.kasprintf (fun msg -> - call_taps { section = Section ; level ; text = msg ; tags = Tag.empty }; + call_taps { section = Section ; level ; text = Some msg ; tags = Tag.empty }; Lwt_log_core.log ?exn ~section ?location ?logger ~level msg) format @@ -198,7 +198,7 @@ module Make_unregistered(S : sig val name: string end) : LOG = struct else Format.kasprintf (fun msg -> - call_taps { section = Section ; level ; text = msg ; tags = Tag.empty }; + call_taps { section = Section ; level ; text = Some msg ; tags = Tag.empty }; Lwt_log_core.ign_log ?exn ~section ?location ?logger ~level msg) format diff --git a/src/lib_stdlib/logging.mli b/src/lib_stdlib/logging.mli index 97c269224..68e7c9d2f 100644 --- a/src/lib_stdlib/logging.mli +++ b/src/lib_stdlib/logging.mli @@ -30,7 +30,7 @@ type log_section = private .. type log_message = { section : log_section ; level : level ; - text : string ; + text : string option ; tags : Tag.set ; }