aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-09-30 17:45:43 +0200
committerKim Alvefur <zash@zash.se>2021-09-30 17:45:43 +0200
commitf2442d9bd5c0f9a4145208c329112a7798baea62 (patch)
tree595d4e3a41401e728b730b1afe15c84501b7e76a /util
parent3841a9187c95c758f0feb49db0eea6c611611ae0 (diff)
downloadprosody-f2442d9bd5c0f9a4145208c329112a7798baea62.tar.gz
prosody-f2442d9bd5c0f9a4145208c329112a7798baea62.zip
prosodyctl: Add support for -v/--verbose to enable debug logging
More convenient than the environment variable.
Diffstat (limited to 'util')
-rw-r--r--util/startup.lua6
1 files changed, 4 insertions, 2 deletions
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()