aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-11-28 23:07:35 +0100
committerKim Alvefur <zash@zash.se>2021-11-28 23:07:35 +0100
commit14f31180b5f2f33512deea143a5cd689c175c184 (patch)
tree97b89f6025aa516a321831730edf441e1f9d568b
parent7f2e4b6313b83e95aa165e4b614b554b7552ff46 (diff)
downloadprosody-14f31180b5f2f33512deea143a5cd689c175c184.tar.gz
prosody-14f31180b5f2f33512deea143a5cd689c175c184.zip
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.
-rw-r--r--man/prosodyctl.man8
-rw-r--r--man/prosodyctl.markdown8
-rw-r--r--util/startup.lua8
3 files changed, 21 insertions, 3 deletions
diff --git a/man/prosodyctl.man b/man/prosodyctl.man
index 5c1060f8..f22418cc 100644
--- a/man/prosodyctl.man
+++ b/man/prosodyctl.man
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 2.17.0.1
.\"
-.TH "PROSODYCTL" "1" "2017-09-02" "" ""
+.TH "PROSODYCTL" "1" "2022-02-02" "" ""
.hy
.SH NAME
.PP
@@ -135,6 +135,12 @@ Don\[cq]t drop root privileges.
.TP
\f[B]\f[CB]--help\f[B]\f[R]
Display help text for the specified command.
+.TP
+\f[B]\f[CB]--verbose\f[B]\f[R]
+Increase log level to show debug messages.
+.TP
+\f[B]\f[CB]--quiet\f[B]\f[R]
+Reduce log level to only show errors.
.SH FILES
.TP
\f[B]\f[CB]/etc/prosody/prosody.cfg.lua\f[B]\f[R]
diff --git a/man/prosodyctl.markdown b/man/prosodyctl.markdown
index c9a78452..38540a59 100644
--- a/man/prosodyctl.markdown
+++ b/man/prosodyctl.markdown
@@ -2,7 +2,7 @@
author:
- Dwayne Bent <dbb.1@liqd.org>
- Kim Alvefur
-date: 2017-09-02
+date: 2022-02-02
section: 1
title: PROSODYCTL
---
@@ -137,6 +137,12 @@ details of how these commands work you should see ejabberdctl(8).
`--help`
: Display help text for the specified command.
+`--verbose`
+: Increase log level to show debug messages.
+
+`--quiet`
+: Reduce log level to only show errors.
+
# FILES
`/etc/prosody/prosody.cfg.lua`
diff --git a/util/startup.lua b/util/startup.lua
index 5db1c51a..893a4995 100644
--- a/util/startup.lua
+++ b/util/startup.lua
@@ -470,7 +470,13 @@ end
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