From 892c91e3ac00a67d5e929ac943246af364ca1a79 Mon Sep 17 00:00:00 2001 From: Pierre Chambart Date: Wed, 27 Jun 2018 02:06:09 +0200 Subject: [PATCH] Fix some more logging name leak The section list is only useful for functor instantiated before command line argument parsing. --- src/lib_shell/worker.ml | 2 +- src/lib_stdlib/logging.ml | 10 ++++++++-- src/lib_stdlib/logging.mli | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib_shell/worker.ml b/src/lib_shell/worker.ml index 52d139b29..6102b526c 100644 --- a/src/lib_shell/worker.ml +++ b/src/lib_shell/worker.ml @@ -351,7 +351,7 @@ module Make let levels = [ Logging.Debug ; Info ; Notice ; Warning ; Error ; Fatal ] in List.map (fun l -> l, Ring.create limits.backlog_size) levels in - let module Logger = Logging.Make(struct let name = id_name end) in + let module Logger = Logging.Make_unregistered(struct let name = id_name end) in let w = { limits ; parameters ; name ; canceler ; table ; buffer ; logger = (module Logger) ; state = None ; id ; diff --git a/src/lib_stdlib/logging.ml b/src/lib_stdlib/logging.ml index cf0132dd7..5739e9ca8 100644 --- a/src/lib_stdlib/logging.ml +++ b/src/lib_stdlib/logging.ml @@ -45,9 +45,8 @@ let ign_log_f let sections = ref [] -module Make(S : sig val name: string end) : LOG = struct +module Make_unregistered(S : sig val name: string end) : LOG = struct - let () = sections := S.name :: !sections let section = Lwt_log_core.Section.make S.name let debug fmt = ign_log_f ~section ~level:Lwt_log_core.Debug fmt @@ -66,6 +65,13 @@ module Make(S : sig val name: string end) : LOG = struct end +module Make(S : sig val name: string end) : LOG = struct + + let () = sections := S.name :: !sections + include Make_unregistered(S) + +end + module Core = Make(struct let name = "core" end) type level = Lwt_log_core.level = diff --git a/src/lib_stdlib/logging.mli b/src/lib_stdlib/logging.mli index 706b656b6..4f66c5cd0 100644 --- a/src/lib_stdlib/logging.mli +++ b/src/lib_stdlib/logging.mli @@ -28,6 +28,7 @@ end module Core : LOG module Make(S: sig val name: string end) : LOG +module Make_unregistered(S: sig val name: string end) : LOG type level = Lwt_log_core.level = | Debug