From f2442d9bd5c0f9a4145208c329112a7798baea62 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 30 Sep 2021 17:45:43 +0200 Subject: prosodyctl: Add support for -v/--verbose to enable debug logging More convenient than the environment variable. --- util/startup.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/startup.lua b/util/startup.lua index 52832988..9d0253bc 100644 --- a/util/startup.lua +++ b/util/startup.lua @@ -22,7 +22,7 @@ local default_gc_params = { minor_threshold = 20, major_threshold = 50; }; -local short_params = { D = "daemonize", F = "no-daemonize" }; +local short_params = { D = "daemonize", F = "no-daemonize", v = "verbose" }; local value_params = { config = true }; function startup.parse_args() @@ -440,7 +440,9 @@ end -- Override logging config (used by prosodyctl) function startup.force_console_logging() original_logging_config = config.get("*", "log"); - config.set("*", "log", { { levels = { min = os.getenv("PROSODYCTL_LOG_LEVEL") or "info" }, to = "console" } }); + local log_level = os.getenv("PROSODYCTL_LOG_LEVEL"); + if not log_level and prosody.opts.verbose then log_level = "debug"; end + config.set("*", "log", { { levels = { min = log_level or "info" }, to = "console" } }); end function startup.switch_user() -- cgit v1.2.3