From 405423108fc31981c40116a827e845a1179c9053 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 9 Aug 2021 19:02:37 +0200 Subject: feat: Add an async logger using plenary (#1207) Co-authored-by: rebuilt --- lua/utils/init.lua | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'lua/utils') diff --git a/lua/utils/init.lua b/lua/utils/init.lua index df472c66..208871bf 100644 --- a/lua/utils/init.lua +++ b/lua/utils/init.lua @@ -1,4 +1,6 @@ local utils = {} +local Log = require "core.log" +local uv = vim.loop -- recursive Print (structure, limit, separator) local function r_inspect_settings(structure, limit, separator) @@ -68,6 +70,9 @@ function utils.toggle_autoformat() }, }, } + if Log:get_default() then + Log:get_default().info "Format on save active" + end end if not lvim.format_on_save then @@ -76,6 +81,9 @@ function utils.toggle_autoformat() :autocmd! autoformat endif ]] + if Log:get_default() then + Log:get_default().info "Format on save off" + end end end @@ -91,6 +99,7 @@ function utils.reload_lv_config() vim.cmd ":PackerInstall" require("keymappings").setup() -- vim.cmd ":PackerClean" + Log:get_default().info "Reloaded configuration" end function utils.check_lsp_client_active(name) @@ -157,10 +166,12 @@ function utils.gsub_args(args) return args end -function utils.lvim_log(msg) - if lvim.debug then - vim.notify(msg, vim.log.levels.DEBUG) - end +--- Checks whether a given path exists and is a file. +--@param filename (string) path to check +--@returns (bool) +function utils.is_file(filename) + local stat = uv.fs_stat(filename) + return stat and stat.type == "file" or false end return utils -- cgit v1.2.3