Skip to content

Commit 92bd3d8

Browse files
committed
feat: support runtime log via logger.nvim
1 parent 7485fbf commit 92bd3d8

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lua/flygrep.lua

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ if not ok then
1515
ok, cmp = pcall(require, 'cmp')
1616
end
1717

18+
local log = require('flygrep.logger')
19+
1820
local grep_root_dir = '.'
1921

2022
local grep_timer_id = -1
@@ -474,6 +476,7 @@ function M.open(opt)
474476
else
475477
grep_root_dir = vim.fn.getcwd()
476478
end
479+
log.info('flygrep cwd:' .. grep_root_dir)
477480
open_win()
478481
end
479482

lua/flygrep/logger.lua

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
local M = {}
2+
local logger
3+
function M.info(msg)
4+
if not logger then
5+
pcall(function()
6+
logger = require('logger').derive('flygrep')
7+
logger.info(msg)
8+
end)
9+
else
10+
logger.info(msg)
11+
end
12+
end
13+
14+
return M

0 commit comments

Comments
 (0)