From b869c264aa12e38cab0e5fbefd97760c19ec6e1c Mon Sep 17 00:00:00 2001 From: Vincent Bernardoff Date: Mon, 7 Nov 2016 16:00:08 +0100 Subject: [PATCH] tezos_node: add -verbosity --- src/node_main.ml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/node_main.ml b/src/node_main.ml index a36c1e12d..f1b63796b 100644 --- a/src/node_main.ml +++ b/src/node_main.ml @@ -101,6 +101,10 @@ module Globals = struct | Some dir -> base_dir#set dir in sandbox#add_hook sandboxed + let verbose_param = + new string_option_cp ~group:cli_group ["verbosity"] ~short_name:"v" (Some "notice") + "Verbosity level (fatal, error, warning, notice, info, debug)" + (** File options *) let file_group = new group @@ -220,6 +224,17 @@ end let init_logger () = let open Logging in + begin + let open Lwt_log_core in + match Globals.verbose_param#get with + | Some "fatal" -> add_rule "*" Fatal + | Some "error" -> add_rule "*" Error + | Some "warning" -> add_rule "*" Warning + | Some "notice" -> add_rule "*" Notice + | Some "info" -> add_rule "*" Info + | Some "debug" -> add_rule "*" Debug + | _ -> () + end; match Globals.log_kind#get with | "" | "stderr" -> Logging.init Stderr | "stdout" -> Logging.init Stdout