diff options
Diffstat (limited to 'util/logger.lua')
-rw-r--r-- | util/logger.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/util/logger.lua b/util/logger.lua index fb0bc37b..22b7e41b 100644 --- a/util/logger.lua +++ b/util/logger.lua @@ -103,6 +103,21 @@ function setwriter(f) return ok, ret; end +function reset() + for k in pairs(name_sinks) do name_sinks[k] = nil; end + for level, handler_list in pairs(level_sinks) do + -- Clear all handlers for this level + for i = 1, #handler_list do + handler_list[i] = nil; + end + end + for k in pairs(name_patterns) do name_patterns[k] = nil; end + + for _, modify_hook in pairs(modify_hooks) do + modify_hook(); + end +end + function add_level_sink(level, sink_function) if not level_sinks[level] then level_sinks[level] = { sink_function }; |