Skip to content

Commit

Permalink
feat: use vim.notify for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 10, 2021
1 parent 7d9cfcc commit 293118e
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lua/trouble/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,17 @@ function M.count(tab)
return count
end

function M.log(msg, hl)
hl = hl or "MsgArea"
vim.api.nvim_echo({ { "[Trouble] ", hl }, { msg } }, true, {})
end

function M.warn(msg)
M.log(msg, "WarningMsg")
vim.notify(msg, vim.log.levels.WARN, { title = "Trouble" })
end

function M.error(msg)
M.log(msg, "Error")
vim.notify(msg, vim.log.levels.ERROR, { title = "Trouble" })
end

function M.debug(msg)
if config.options.debug then
M.log(msg)
vim.notify(msg, vim.log.levels.DEBUG, { title = "Trouble" })
end
end

Expand Down

0 comments on commit 293118e

Please sign in to comment.