1
0
Fork 0
mirror of https://github.com/jiriks74/presence.nvim synced 2025-06-19 19:38:57 +02:00

Fix various verbiage and style inconsistencies

This commit is contained in:
Andrew Kwon 2021-02-27 16:44:00 -08:00
parent 66bd159dd3
commit bb149540fd
3 changed files with 42 additions and 53 deletions
lua/lib

View file

@ -1,7 +1,6 @@
local Log = {}
Log.codes = {}
Log.levels = {
{ "debug", "Comment" },
{ "info", "None" },
@ -9,22 +8,11 @@ Log.levels = {
{ "error", "ErrorMsg" },
}
function Log.new(options)
options = options or {}
local logger = vim.deepcopy(Log)
logger.options = options
logger.options.level = options.level
return logger
function Log:init(options)
self.level = options.level
return self
end
setmetatable(Log, {
__call = function(_, ...)
return Log.new(...)
end,
})
-- Initialize logger with log functions for each level
for i = 1, #Log.levels do
local level, hl = unpack(Log.levels[i])
@ -33,7 +21,7 @@ for i = 1, #Log.levels do
Log[level] = function(self, message)
-- Skip if log level is not set or the log is below the configured or default level
if not self.options.level or self.codes[level] < self.codes[self.options.level] then
if not self.level or self.codes[level] < self.codes[self.level] then
return
end