diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-11-20 17:42:00 -0600 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-11-20 17:55:00 -0600 |
commit | 71350cce28b45246efba144dc2d19f3ec9c65431 (patch) | |
tree | c5f54e706f5377f4a4e4726029931e271bc58f9d /nvim/.config | |
parent | 3e42386b02a0eb36804e14b1335f0762cea7c156 (diff) |
fix(nvim): fix bug in logging
Diffstat (limited to 'nvim/.config')
-rw-r--r-- | nvim/.config/nvim/lua/tobyvin.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/nvim/.config/nvim/lua/tobyvin.lua b/nvim/.config/nvim/lua/tobyvin.lua index 4b97462..ccd6a17 100644 --- a/nvim/.config/nvim/lua/tobyvin.lua +++ b/nvim/.config/nvim/lua/tobyvin.lua @@ -5,7 +5,13 @@ end setmetatable(log, { __call = function(t, msg, level, opts) - pcall(t[level], msg, level, opts) + local log_level = vim.F.if_nil(level, 2) + 1 + local log_msg = {} + if opts and opts.title then + table.insert(log_msg, opts.title) + end + table.insert(log_msg, msg) + pcall(t[log_level], table.concat(log_msg, ": ")) vim.api.nvim_exec_autocmds("User", { pattern = "Notify", data = { msg, level, opts }, |