Shell: still allow usage of LWT_LOG

Commit b869c264aa introdude `-v level`, which should be equivalent to
setting `LWT_LOG="* -> level`, but it inadvertently drop the support for
`LWT_LOG`. This commit reintroduces support for ` LWT_LOG` which allows
to setup distinct verbosity levels to distinct part of the node :

  LWT_LOG="net -> debug ; rpc -> notice"
This commit is contained in:
Grégoire Henry 2016-11-26 11:52:14 +01:00
parent 2a43eeaa7f
commit 62a1be15b7

View File

@ -102,7 +102,7 @@ module Globals = struct
sandbox#add_hook sandboxed sandbox#add_hook sandboxed
let verbose_param = let verbose_param =
new string_option_cp ~group:cli_group ["verbosity"] ~short_name:"v" (Some "notice") new string_option_cp ~group:cli_group ["verbosity"] ~short_name:"v" None
"Verbosity level (fatal, error, warning, notice, info, debug)" "Verbosity level (fatal, error, warning, notice, info, debug)"
(** File options *) (** File options *)
@ -233,7 +233,9 @@ let init_logger () =
| Some "notice" -> add_rule "*" Notice | Some "notice" -> add_rule "*" Notice
| Some "info" -> add_rule "*" Info | Some "info" -> add_rule "*" Info
| Some "debug" -> add_rule "*" Debug | Some "debug" -> add_rule "*" Debug
| _ -> () | Some level ->
Printf.eprintf "Warning: unknown verbosity level \"%s\".\n%!" level
| None -> ()
end; end;
match Globals.log_kind#get with match Globals.log_kind#get with
| "" | "stderr" -> Logging.init Stderr | "" | "stderr" -> Logging.init Stderr