Software /
code /
prosody
Comparison
util/startup.lua @ 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 |
parent | 11560:3bbb1af92514 |
child | 11829:4fad0ca42f66 |
comparison
equal
deleted
inserted
replaced
11827:2359519260ec | 11828:024ac556e907 |
---|---|
20 threshold = 105, speed = 500; | 20 threshold = 105, speed = 500; |
21 -- Generational mode defaults | 21 -- Generational mode defaults |
22 minor_threshold = 20, major_threshold = 50; | 22 minor_threshold = 20, major_threshold = 50; |
23 }; | 23 }; |
24 | 24 |
25 local short_params = { D = "daemonize", F = "no-daemonize" }; | 25 local short_params = { D = "daemonize", F = "no-daemonize", v = "verbose" }; |
26 local value_params = { config = true }; | 26 local value_params = { config = true }; |
27 | 27 |
28 function startup.parse_args() | 28 function startup.parse_args() |
29 local opts, err, where = parse_args(arg, { | 29 local opts, err, where = parse_args(arg, { |
30 short_params = short_params, | 30 short_params = short_params, |
438 end | 438 end |
439 | 439 |
440 -- Override logging config (used by prosodyctl) | 440 -- Override logging config (used by prosodyctl) |
441 function startup.force_console_logging() | 441 function startup.force_console_logging() |
442 original_logging_config = config.get("*", "log"); | 442 original_logging_config = config.get("*", "log"); |
443 config.set("*", "log", { { levels = { min = os.getenv("PROSODYCTL_LOG_LEVEL") or "info" }, to = "console" } }); | 443 local log_level = os.getenv("PROSODYCTL_LOG_LEVEL"); |
444 if not log_level and prosody.opts.verbose then log_level = "debug"; end | |
445 config.set("*", "log", { { levels = { min = log_level or "info" }, to = "console" } }); | |
444 end | 446 end |
445 | 447 |
446 function startup.switch_user() | 448 function startup.switch_user() |
447 -- Switch away from root and into the prosody user -- | 449 -- Switch away from root and into the prosody user -- |
448 -- NOTE: This function is only used by prosodyctl. | 450 -- NOTE: This function is only used by prosodyctl. |