Neovim: Write logs to sys journal instead of tmp file.

This commit is contained in:
Dmitry Voronin 2024-10-17 06:11:03 +03:00
parent 58f3680d3c
commit fab1b32e14
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -1,16 +1,14 @@
{ ... }:
{
text = ''
pid = vim.fn.getpid()
-- Disable error messages popup.
-- Instead print them and write to /tmp/NeovimError<PID>.txt
-- Instead print them and write to system journal.
bequiet = function(msg, log_level, opts)
print(string.sub(tostring(msg), 1, vim.v.echospace))
local file = io.open("/tmp/NeovimError"..tostring(pid)..".txt", "a")
file:write(msg.."\n")
file:close()
local log = io.popen("systemd-cat -t nvim", "w")
log:write(tostring(msg))
log:close()
end
vim.notify = bequiet