feat: add logger (#64)
* refactor(health): keep in mind new way of health check (#63) * feat(log): add logger module * refactor(utils): remove unused code * refactor(log, utils): get plugin name from config * refactor(logger): add some type annotations * refactor(utils): log notifications * feat: LOGGER™ * feat(config): TYPES * refactor(log): dont give a thing about var that is not even declared * feat(log): add easy way to open log * refactor(log): some types * update types * docs: regen * fix(log): make setting log level by config work * feat(iferr): write error to log file if occur * feat(gotests): add logger
This commit is contained in:
parent
65fa148661
commit
fbf6441f3d
10 changed files with 213 additions and 31 deletions
|
|
@ -4,6 +4,7 @@
|
|||
---@usage execute `:GoIfErr` near any err variable to insert the check
|
||||
|
||||
local c = require "gopher.config"
|
||||
local log = require "gopher._utils.log"
|
||||
local iferr = {}
|
||||
|
||||
-- That's Lua implementation: github.com/koron/iferr
|
||||
|
|
@ -14,6 +15,7 @@ function iferr.iferr()
|
|||
local data = vim.fn.systemlist((c.commands.iferr .. " -pos " .. boff), vim.fn.bufnr "%")
|
||||
if vim.v.shell_error ~= 0 then
|
||||
error("iferr failed: " .. data)
|
||||
log.error("failed. output: " .. data)
|
||||
end
|
||||
|
||||
vim.fn.append(pos, data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue