summaryrefslogtreecommitdiffstats
path: root/lualib/lua_util.lua
diff options
context:
space:
mode:
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