aboutsummaryrefslogtreecommitdiffstats
path: root/lua/conform/log.lua
diff options
context:
space:
mode:
authorSteven Arcangeli <stevearc@stevearc.com>2023-09-12 20:10:05 -0700
committerSteven Arcangeli <stevearc@stevearc.com>2023-09-12 20:10:05 -0700
commit00a528818463b10d84699b2e0f4a960d5a4aeb5c (patch)
treeb1c809b69934279b8655e64724b1ec6a31f7486d /lua/conform/log.lua
parentdd5b2f2f7ca01c2f28239cbbc7f97e6f9024cd94 (diff)
fix: modify diff calculation to handle end-of-file newlines better (#35)
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()