fix: use the correct API for the log-viewer (#1564)

This commit is contained in:
kylo252 2021-09-17 08:29:35 +02:00 committed by GitHub
parent d610502f91
commit 9257e68c05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View file

@ -1,5 +1,6 @@
local M = {}
local utils = require "utils"
local Log = require "core.log"
M.config = function()
lvim.builtin["terminal"] = {
@ -81,7 +82,6 @@ end
M._exec_toggle = function(exec)
local binary = M._split(exec)[1]
if vim.fn.executable(binary) ~= 1 then
local Log = require "core.log"
Log:error("Unable to run executable " .. binary .. ". Please make sure it is installed properly.")
return
end
@ -92,12 +92,13 @@ end
local function get_log_path(name)
--handle custom paths not managed by Plenary.log
local logger = require "core.log"
local file
if name == "nvim" then
file = utils.join_paths(get_cache_dir(), "log")
file = utils.join_paths(vim.fn.stdpath "cache", "log")
elseif name == "packer.nvim" then
file = utils.join_paths(vim.fn.stdpath "cache", "packer.nvim.log")
else
file = logger:new({ plugin = name }):get_path()
file = Log:get_path()
end
if utils.is_file(file) then
return file