Changeset

11828:024ac556e907

prosodyctl: Add support for -v/--verbose to enable debug logging More convenient than the environment variable.
author Kim Alvefur <zash@zash.se>
date Thu, 30 Sep 2021 17:45:43 +0200
parents 11827:2359519260ec
children 11829:4fad0ca42f66
files util/startup.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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()