1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-15 08:09:11 +08:00

fix(logger): fix logger api

This commit is contained in:
Shidong Wang 2021-11-05 19:10:16 +08:00
parent 35bb6cb72d
commit 76428f5d28
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848

View File

@ -29,7 +29,7 @@ let s:self = {
"1 : log all messages
"2 : log warning and error messages
"3 : log error messages only
let s:levels = ['Info', 'Warn', 'Error']
let s:levels = ['Info', 'Warn', 'Error', 'Debug']
function! SpaceVim#api#logger#get() abort
return deepcopy(s:self)
@ -84,6 +84,18 @@ function! s:self.warn(msg, ...) abort
call self.write(log)
endfunction
function! s:self.debug(msg) abort
if self.level > 0
return
endif
let time = strftime('%H:%M:%S')
let log = '[ ' . self.name . ' ] [' . time . '] [ ' . s:levels[3] . ' ] ' . a:msg
if !self.silent && self.verbose >= 4
echom log
endif
call self.write(log)
endfunction
function! s:self.info(msg) abort
if self.level > 1
return