# HG changeset patch # User Kim Alvefur # Date 1633016743 -7200 # Node ID 024ac556e9077ce5d05c92c51ab3b538c883b623 # Parent 2359519260ecba597aa5822e1076f7da278a8fdb prosodyctl: Add support for -v/--verbose to enable debug logging More convenient than the environment variable. diff -r 2359519260ec -r 024ac556e907 util/startup.lua --- a/util/startup.lua Thu Sep 30 17:37:05 2021 +0200 +++ b/util/startup.lua Thu Sep 30 17:45:43 2021 +0200 @@ -22,7 +22,7 @@ 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 @@ -- 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()