Diff

util/startup.lua @ 12243:73ecfe811526

util.startup: Teach prosodyctl to be --quiet as complement to --verbose Original motivation was tiresome warnings about Lua 5.4 not being supported yet. Can still be handy to tweak log level, e.g. to prevent logging to interfere with command output.
author Kim Alvefur <zash@zash.se>
date Sun, 28 Nov 2021 23:07:35 +0100
parent 12160:ac654fb19203
child 12244:858d40d675ee
line wrap: on
line diff
--- a/util/startup.lua	Wed Feb 02 18:30:54 2022 +0100
+++ b/util/startup.lua	Sun Nov 28 23:07:35 2021 +0100
@@ -470,7 +470,13 @@
 function startup.force_console_logging()
 	original_logging_config = config.get("*", "log");
 	local log_level = os.getenv("PROSODYCTL_LOG_LEVEL");
-	if not log_level and prosody.opts.verbose then log_level = "debug"; end
+	if not log_level then
+		if prosody.opts.verbose then
+			log_level = "debug";
+		elseif prosody.opts.quiet then
+			log_level = "error";
+		end
+	end
 	config.set("*", "log", { { levels = { min = log_level or "info" }, to = "console" } });
 end