Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lua/rush/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local keyevent = require("keyevent.keyevent")
local log = require("keyevent.log")
local log = require("rush.log")

local M = {}

Expand Down Expand Up @@ -143,7 +143,6 @@ local function remove_metakeymap(bufnr)
local ok, result =
pcall(vim.keymap.del, mode, motion, { buffer = bufnr })
if not ok then
log.error({ mode, motion, bufnr })
log.error(result)
end
end
Expand Down
43 changes: 43 additions & 0 deletions lua/rush/log.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
local ok, logger = pcall(require, "kibi2.logger")

local names = {
"setup",
"debug",
"info",
"warn",
"error",
"probe",
"watch",
"assert",
}

if not ok then
local noop = function() end
logger = {}
for _, name in ipairs(names) do
logger[name] = noop
end
logger.new = noop
logger.is_debug = noop
end

-- =============================================================================

local M = {}
local log = logger.new() or {}

-- =============================================================================
-- Public API

for _, name in ipairs(names) do
M[name] = function(...)
logger[name](log, ...)
end
end

---@return boolean
function M.is_debug()
return logger.is_debug(log) == true
end

return M
2 changes: 1 addition & 1 deletion tests/backend/nvim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ backend_run() {
[ -f run.env ] && . run.env
env \
NVIM_APPNAME="${NVIM_APPNAME:-}" \
NVIM_TIRENVI_DEV=1 \
NVIM_KIBI2_DEV=1 \
$TEST_BIN --headless -u NONE -n \
--cmd "set rtp+=$ROOT_DIR/.deps/keyevent.nvim" \
-c "lua require('luacov')" \
Expand Down
Loading