improve logger
This commit is contained in:
@ -66,7 +66,8 @@ function logger:log(level, message, ...)
|
|||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
if not logger.silent then
|
if not logger.silent then
|
||||||
if level == "error" then
|
if level == "error" then
|
||||||
vim.api.nvim_echo({ { string.format("[dep] %s", message) } }, true, { err = true })
|
vim.api.nvim_echo({ { string.format("[dep] %s", message) } }, true,
|
||||||
|
{ err = true })
|
||||||
elseif logger.stage_colors[level] then
|
elseif logger.stage_colors[level] then
|
||||||
vim.api.nvim_echo({
|
vim.api.nvim_echo({
|
||||||
{ "[dep]", "Identifier" },
|
{ "[dep]", "Identifier" },
|
||||||
@ -78,7 +79,8 @@ function logger:log(level, message, ...)
|
|||||||
|
|
||||||
-- write to the pipe if it's open
|
-- write to the pipe if it's open
|
||||||
if logger.pipe then
|
if logger.pipe then
|
||||||
logger.pipe:write(string.format("[%s] %s:%s: %s\n", os.date("%T"), source.short_src:gsub('.*%/', ''), source.currentline, message))
|
logger.pipe:write(string.format("[%s] %s:%s: %s\n", os.date("%T"),
|
||||||
|
source.short_src:gsub('.*%/', ''), source.currentline, message))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user