style: debug formatting

This commit is contained in:
Folke Lemaitre 2023-01-04 00:27:31 +01:00
parent 1c854d7a6d
commit b2673f1057
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 5 additions and 5 deletions

View File

@ -118,7 +118,7 @@ end
---@param msg string|table
---@param level? number
---@param opts? {lang?:string, title?:string}
---@param opts? {lang:string, title:string}
function M.log(msg, level, opts)
if M.debug then
msg = vim.deepcopy(msg)
@ -208,7 +208,7 @@ function M.load(modkey, modpath)
entry.hash = hash
if M.debug then
M.log("`" .. modpath .. "`", nil, { title = "Cache.load" })
M.log("`" .. modpath .. "`", vim.log.levels.WARN, { title = "Cache.load" })
end
chunk, err = M._loadfile(entry.modpath)

View File

@ -216,7 +216,7 @@ function M.lsmod(modname, fn)
end
---@param msg string|string[]
---@param opts? {lang?:string, title?:string}
---@param opts? {lang:string, title:string}
function M.notify(msg, level, opts)
if vim.in_fast_event() then
vim.schedule(function()
@ -268,14 +268,14 @@ end
---@param msg string|table
---@param level? number
---@param opts? {lang?:string, title?:string}
---@param opts? {lang:string, title:string}
function M.debug(msg, level, opts)
if not require("lazy.core.config").options.debug then
return
end
opts = opts or {}
if type(msg) == "string" then
M.notify(msg, level)
M.notify(msg, level, opts)
else
opts.lang = "lua"
M.notify(vim.inspect(msg), level, opts)