mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +08:00
Add log func
This commit is contained in:
parent
22b80e3b7b
commit
81766efa5f
14
autoload/SpaceVim/custom.vim
Normal file
14
autoload/SpaceVim/custom.vim
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
function! SpaceVim#custom#profile(dict) abort
|
||||||
|
for key in keys(a:dict)
|
||||||
|
call s:set(key, a:dict[key])
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:set(key,val) abort
|
||||||
|
if !exists('g:spacevim_' . a:key)
|
||||||
|
call SpaceVim#logger#warn('no option named ' . a:key)
|
||||||
|
else
|
||||||
|
exe 'let ' . 'g:spacevim_' . a:key . '=' . a:val
|
||||||
|
endif
|
||||||
|
endfunction
|
@ -42,7 +42,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:wite(msg) abort
|
function! s:wite(msg) abort
|
||||||
if !isdirectory(expand('~/.cache/SpaceVim/'))
|
if !isdirectory(expand('~/.cache/SpaceVim/'))
|
||||||
call mkdir('~/.cache/SpaceVim/', 'p')
|
call mkdir(expand('~/.cache/SpaceVim/'), 'p')
|
||||||
endif
|
endif
|
||||||
let flags = filewritable(s:logger_file) ? 'a' : ''
|
let flags = filewritable(s:logger_file) ? 'a' : ''
|
||||||
call writefile([a:msg], s:logger_file, flags)
|
call writefile([a:msg], s:logger_file, flags)
|
||||||
@ -63,7 +63,7 @@ function! SpaceVim#logger#viewLog(...) abort
|
|||||||
let info .= "### SpaceVim runtime log :\n\n"
|
let info .= "### SpaceVim runtime log :\n\n"
|
||||||
let info .= "```log\n"
|
let info .= "```log\n"
|
||||||
|
|
||||||
let l = a:0 > 0 ? a:1 : 1
|
let l = s:logger_level
|
||||||
if filereadable(s:logger_file)
|
if filereadable(s:logger_file)
|
||||||
let logs = readfile(s:logger_file, '')
|
let logs = readfile(s:logger_file, '')
|
||||||
let info .= join(filter(logs,
|
let info .= join(filter(logs,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user