aboutsummaryrefslogtreecommitdiffstats
path: root/lua/conform/log.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/conform/log.lua')
-rw-r--r--lua/conform/log.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/lua/conform/log.lua b/lua/conform/log.lua
index 3e31fd2..20d91e1 100644
--- a/lua/conform/log.lua
+++ b/lua/conform/log.lua
@@ -83,6 +83,13 @@ local function initialize()
end
end
+---Override the file handler e.g. for tests
+---@param handler fun(line: string)
+function Log.set_handler(handler)
+ write = handler
+ initialized = true
+end
+
function Log.log(level, msg, ...)
if Log.level <= level then
initialize()