From a0cda75dd5de93f1533972465afec307252d1add Mon Sep 17 00:00:00 2001 From: Smirnov Oleksandr Date: Fri, 3 May 2024 21:40:59 +0300 Subject: [PATCH] refactor(log): some types --- lua/gopher/_utils/log.lua | 10 ++++++---- lua/gopher/init.lua | 3 +-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lua/gopher/_utils/log.lua b/lua/gopher/_utils/log.lua index c00d686..0702b16 100644 --- a/lua/gopher/_utils/log.lua +++ b/lua/gopher/_utils/log.lua @@ -16,10 +16,6 @@ local c = require "gopher.config" ---@field error fun(...) ---@field fmt_error fun(...) ----@type Gopher.Logger ----@diagnostic disable-next-line: missing-fields -local log = {} - local config = { -- Name of the plugin. Prepended to log messages name = c.___plugin_name, @@ -49,6 +45,12 @@ local config = { -- Can limit the number of decimals displayed for floats float_precision = 0.01, } + +---@type Gopher.Logger +---@diagnostic disable-next-line: missing-fields +local log = {} + +---@return string function log.get_outfile() return table.concat { (vim.fn.has "nvim-0.8.0" == 1) and vim.fn.stdpath "log" or vim.fn.stdpath "cache", diff --git a/lua/gopher/init.lua b/lua/gopher/init.lua index 57c19ea..3edefcc 100644 --- a/lua/gopher/init.lua +++ b/lua/gopher/init.lua @@ -24,9 +24,8 @@ local gopher = {} ---@usage `require("gopher").setup {}` (replace `{}` with your `config` table) gopher.setup = function(user_config) log.debug "setting up config" - log.debug(vim.inspect(user_config)) - require("gopher.config").setup(user_config) + log.debug(vim.inspect(user_config)) end ---@toc_entry Install dependencies