Mercurial > prosody-hg
comparison 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 |
| parents | ac654fb19203 |
| children | 858d40d675ee |
comparison
equal
deleted
inserted
replaced
| 12242:202319a990e7 | 12243:73ecfe811526 |
|---|---|
| 468 | 468 |
| 469 -- Override logging config (used by prosodyctl) | 469 -- Override logging config (used by prosodyctl) |
| 470 function startup.force_console_logging() | 470 function startup.force_console_logging() |
| 471 original_logging_config = config.get("*", "log"); | 471 original_logging_config = config.get("*", "log"); |
| 472 local log_level = os.getenv("PROSODYCTL_LOG_LEVEL"); | 472 local log_level = os.getenv("PROSODYCTL_LOG_LEVEL"); |
| 473 if not log_level and prosody.opts.verbose then log_level = "debug"; end | 473 if not log_level then |
| 474 if prosody.opts.verbose then | |
| 475 log_level = "debug"; | |
| 476 elseif prosody.opts.quiet then | |
| 477 log_level = "error"; | |
| 478 end | |
| 479 end | |
| 474 config.set("*", "log", { { levels = { min = log_level or "info" }, to = "console" } }); | 480 config.set("*", "log", { { levels = { min = log_level or "info" }, to = "console" } }); |
| 475 end | 481 end |
| 476 | 482 |
| 477 function startup.switch_user() | 483 function startup.switch_user() |
| 478 -- Switch away from root and into the prosody user -- | 484 -- Switch away from root and into the prosody user -- |
