1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:00:04 +08:00

Add log func

This commit is contained in:
wsdjeg 2017-04-13 23:02:15 +08:00
parent 22b80e3b7b
commit 81766efa5f
2 changed files with 16 additions and 2 deletions

View 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

View File

@ -42,7 +42,7 @@ endfunction
function! s:wite(msg) abort
if !isdirectory(expand('~/.cache/SpaceVim/'))
call mkdir('~/.cache/SpaceVim/', 'p')
call mkdir(expand('~/.cache/SpaceVim/'), 'p')
endif
let flags = filewritable(s:logger_file) ? 'a' : ''
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 .= "```log\n"
let l = a:0 > 0 ? a:1 : 1
let l = s:logger_level
if filereadable(s:logger_file)
let logs = readfile(s:logger_file, '')
let info .= join(filter(logs,