aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_util.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-08-24 10:45:38 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-08-24 10:45:38 +0100
commit6e5b3bd6f946073d0bd15885170b920dc9394bc2 (patch)
treeb80d12a5edab0f6fb8227efe76360e4e2c43ceba /lualib/lua_util.lua
parent4341e843322919ea4aab895f03e1897fcb86d789 (diff)
downloadrspamd-6e5b3bd6f946073d0bd15885170b920dc9394bc2.tar.gz
rspamd-6e5b3bd6f946073d0bd15885170b920dc9394bc2.zip
[Minor] Detect logger's debug level in lua debug utilities
Diffstat (limited to 'lualib/lua_util.lua')
-rw-r--r--lualib/lua_util.lua25
1 files changed, 12 insertions, 13 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua
index 929488929..c4a925ed8 100644
--- a/lualib/lua_util.lua
+++ b/lualib/lua_util.lua
@@ -1051,27 +1051,26 @@ exports.shallowcopy = function(orig)
end
-- Debugging support
-local unconditional_debug = false
+local logger = require "rspamd_logger"
+local unconditional_debug = logger.log_level() == 'debug'
local debug_modules = {}
local debug_aliases = {}
local log_level = 384 -- debug + forced (1 << 7 | 1 << 8)
exports.init_debug_logging = function(config)
- local logger = require "rspamd_logger"
-- Fill debug modules from the config
- local logging = config:get_all_opt('logging')
- if logging then
- local log_level_str = logging.level
- if log_level_str then
- if log_level_str == 'debug' then
- unconditional_debug = true
+ if not unconditional_debug then
+ local log_config = config:get_all_opt('logging')
+ if log_config then
+ local log_level_str = log_config.level
+ if log_level_str then
+ if log_level_str == 'debug' then
+ unconditional_debug = true
+ end
end
- end
-
- if not unconditional_debug then
- if logging.debug_modules then
- for _,m in ipairs(logging.debug_modules) do
+ if log_config.debug_modules then
+ for _,m in ipairs(log_config.debug_modules) do
debug_modules[m] = true
logger.infox(config, 'enable debug for Lua module %s', m)
end