mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 20:30:05 +08:00
feat(logger): add millisecond info
This commit is contained in:
parent
6ce3947d48
commit
ae098bab41
@ -22,6 +22,7 @@ local M = {
|
||||
-- 2 : log warn, error messages
|
||||
-- 3 : log error messages
|
||||
M.levels = {'Info ', 'Warn ', 'Error', 'Debug'}
|
||||
M.clock = fn.reltime()
|
||||
|
||||
function M.set_silent(sl)
|
||||
M.silent = sl
|
||||
@ -40,7 +41,12 @@ function M._build_msg(msg, l)
|
||||
local time = fn.strftime('%H:%M:%S')
|
||||
-- error(string.format("Tried to call API function with vim.fn: use vim.api.%s instead", key))
|
||||
-- local log = '[ ' .. M.name .. ' ] [' .. time .. '] [ ' .. M.levels[l] .. '] ' .. msg
|
||||
local log = string.format('[ %s ] [%s] [ %s ] %s', M.name, time, M.levels[l], msg)
|
||||
local log = string.format('[ %s ] [%s] [%00.3f] [ %s ] %s',
|
||||
M.name,
|
||||
time,
|
||||
fn.reltimefloat(fn.reltime(M.clock)),
|
||||
M.levels[l],
|
||||
msg)
|
||||
return log
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user