fix(log): remove LSP warnings from log.lua

Minor changes to log.lua to remove potential issues made apparent by the
LSP.
This commit is contained in:
Robert Morrison 2023-04-17 18:38:11 +01:00
parent 5a8b28066c
commit 1b8db9afc2
Signed by: robert
GPG Key ID: 73E012EB3F4EC696

View File

@ -2,6 +2,7 @@
-- --
-- Inspired by rxi/log.lua -- Inspired by rxi/log.lua
-- Modified by tjdevries and can be found at github.com/tjdevries/vlog.nvim -- Modified by tjdevries and can be found at github.com/tjdevries/vlog.nvim
-- Further modified by sherlock5512 as part of these dotfiles
-- --
-- This library is free software; you can redistribute it and/or modify it -- This library is free software; you can redistribute it and/or modify it
-- under the terms of the MIT license. See LICENSE for details. -- under the terms of the MIT license. See LICENSE for details.
@ -109,6 +110,7 @@ log.new = function(config, standalone)
vim.cmd(string.format("echohl %s", level_config.hl)) vim.cmd(string.format("echohl %s", level_config.hl))
end end
---@diagnostic disable-next-line: missing-parameter -- This function can be called with only two parameters
local split_console = vim.split(console_string, "\n") local split_console = vim.split(console_string, "\n")
for _, v in ipairs(split_console) do for _, v in ipairs(split_console) do
vim.cmd(string.format([[echom "[%s] %s"]], config.plugin, vim.fn.escape(v, '"'))) vim.cmd(string.format([[echom "[%s] %s"]], config.plugin, vim.fn.escape(v, '"')))
@ -121,7 +123,7 @@ log.new = function(config, standalone)
-- Output to log file -- Output to log file
if config.use_file then if config.use_file then
local fp = io.open(outfile, "a") local fp = assert(io.open(outfile, "a"),"Could not open " .. outfile .. "!")
local str = string.format("[%-6s%s] %s: %s\n", local str = string.format("[%-6s%s] %s: %s\n",
nameupper, os.date(), lineinfo, msg) nameupper, os.date(), lineinfo, msg)
fp:write(str) fp:write(str)