feat(notify): add notify.threshold (#1693)

* feat: configurable notification level

add `notify.threshold` to setup opts

* feat: configurable notification level: add threshold example doc

* feat: configurable notification level: log always comes last

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
kylo252
2022-11-01 00:24:40 +01:00
committed by GitHub
parent ada2c6441d
commit 6ca6f99e76
19 changed files with 120 additions and 66 deletions

View File

@@ -1,4 +1,5 @@
local uv = vim.loop
local notify = require "nvim-tree.notify"
local log = require "nvim-tree.log"
local utils = require "nvim-tree.utils"
@@ -47,7 +48,7 @@ function Event:start()
self._fs_event, _, name = uv.new_fs_event()
if not self._fs_event then
self._fs_event = nil
utils.notify.warn(string.format("Could not initialize an fs_event watcher for path %s : %s", self._path, name))
notify.warn(string.format("Could not initialize an fs_event watcher for path %s : %s", self._path, name))
return false
end
@@ -64,7 +65,7 @@ function Event:start()
rc, _, name = self._fs_event:start(self._path, FS_EVENT_FLAGS, event_cb)
if rc ~= 0 then
utils.notify.warn(string.format("Could not start the fs_event watcher for path %s : %s", self._path, name))
notify.warn(string.format("Could not start the fs_event watcher for path %s : %s", self._path, name))
return false
end
@@ -88,7 +89,7 @@ function Event:destroy()
if self._fs_event then
local rc, _, name = self._fs_event:stop()
if rc ~= 0 then
utils.notify.warn(string.format("Could not stop the fs_event watcher for path %s : %s", self._path, name))
notify.warn(string.format("Could not stop the fs_event watcher for path %s : %s", self._path, name))
end
self._fs_event = nil
end