@@ -11,12 +11,10 @@ for k, v in pairs(vim.log.levels) do
1111end
1212
1313function LogHandler .new (opts )
14- vim .validate ({
15- type = { opts .type , " string" },
16- handle = { opts .handle , " function" },
17- formatter = { opts .formatter , " function" },
18- level = { opts .level , " number" , true },
19- })
14+ vim .validate (" type" , opts .type , " string" )
15+ vim .validate (" handle" , opts .handle , " function" )
16+ vim .validate (" formatter" , opts .formatter , " function" )
17+ vim .validate (" level" , opts .level , " number" , true )
2018 return setmetatable ({
2119 type = opts .type ,
2220 handle = opts .handle ,
5553--- @return CodeCompanion.LogHandler
5654local function create_file_handler (opts )
5755 local a = require (" plenary.async" )
58- vim .validate ({
59- filename = { opts .filename , " string" },
60- })
56+ vim .validate (" filename" , opts .filename , " string" )
6157 local ok , stdpath = pcall (vim .fn .stdpath , " log" )
6258 if not ok then
6359 stdpath = vim .fn .stdpath (" cache" )
152148--- @param opts table
153149--- @return CodeCompanion.LogHandler
154150local function create_handler (opts )
155- vim .validate ({
156- type = { opts .type , " string" },
157- })
151+ vim .validate (" type" , opts .type , " string" )
158152 if not opts .formatter then
159153 opts .formatter = default_formatter
160154 end
@@ -180,10 +174,8 @@ local Logger = {}
180174
181175--- @param opts CodeCompanion.LoggerArgs
182176function Logger .new (opts )
183- vim .validate ({
184- handlers = { opts .handlers , " table" },
185- level = { opts .level , " number" , true },
186- })
177+ vim .validate (" handlers" , opts .handlers , " table" )
178+ vim .validate (" level" , opts .level , " number" , true )
187179 local handlers = {}
188180 for _ , defn in ipairs (opts .handlers ) do
189181 table.insert (handlers , create_handler (defn ))
0 commit comments