1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:00:04 +08:00
This commit is contained in:
wsdjeg 2017-01-08 18:38:45 +08:00
parent c046df4956
commit 65d8e06356
5 changed files with 31 additions and 14 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<users> <users>
<user>14716157352C631AD40087A3D69C499B</user> <user>14716157352C631AD40087A3D69C499B</user>
</users> </users>

View File

@ -1,26 +1,42 @@
let s:logger_level = 0 let s:logger_level = 1
let s:levels = ['Info', 'Warn', 'Error'] let s:levels = ['Info', 'Warn', 'Error']
let s:logger_file = expand('~/.SpaceVim/.SpaceVim.log') let s:logger_file = expand('~/.SpaceVim/.SpaceVim.log')
"" ""
" @public " @public
" Set debug level of SpaceVim, by default it is 0. " Set debug level of SpaceVim, by default it is 1. all message will be logged.
" "
" 0 : log all the message. " 1 : log all the message.
" "
" 1 : log warning and error message " 2 : log warning and error message
" "
" 2 : log error message only " 3 : log error message only
function! SpaceVim#logger#setLevel(level) abort function! SpaceVim#logger#setLevel(level) abort
let s:logger_level = a:level let s:logger_level = a:level
endfunction endfunction
function! SpaceVim#logger#info(msg) abort
if g:spacevim_enable_debug && s:logger_level <= 1
call s:wite(s:warpMsg(a:msg, 1))
endif
endfunction
function! SpaceVim#logger#warn(msg) abort
if g:spacevim_enable_debug && s:logger_level <= 2
call s:wite(s:warpMsg(a:msg, 2))
endif
endfunction
function! SpaceVim#logger#error(msg) abort
if g:spacevim_enable_debug && s:logger_level <= 3
call s:wite(s:warpMsg(a:msg, 3))
endif
endfunction
function! s:wite(msg) abort function! s:wite(msg) abort
call writefile([a:msg], s:logger_file, 'a') call writefile([a:msg], s:logger_file, 'a')
endfunction endfunction
function! SpaceVim#logger#info(msg) abort
call s:wite(s:warpMsg(a:msg, 1))
endfunction
function! SpaceVim#logger#viewLog(...) abort function! SpaceVim#logger#viewLog(...) abort
let l = a:0 > 0 ? a:1 : 0 let l = a:0 > 0 ? a:1 : 0

View File

@ -1,3 +1,4 @@
scriptencoding utf-8
let s:plugins = {} let s:plugins = {}
let s:plugins.core = [ let s:plugins.core = [

View File

@ -128,13 +128,13 @@ SpaceVim#Layer({layer}) *SpaceVim#Layer()*
autocompletion. unite : Unite centric work-flow autocompletion. unite : Unite centric work-flow
SpaceVim#logger#setLevel({level}) *SpaceVim#logger#setLevel()* SpaceVim#logger#setLevel({level}) *SpaceVim#logger#setLevel()*
Set debug level of SpaceVim, by default it is 0. Set debug level of SpaceVim, by default it is 1. all message will be logged.
0 : log all the message. 1 : log all the message.
1 : log warning and error message 2 : log warning and error message
2 : log error message only 3 : log error message only
SpaceVim#logger#setOutput({file}) *SpaceVim#logger#setOutput()* SpaceVim#logger#setOutput({file}) *SpaceVim#logger#setOutput()*
Set log output file of SpaceVim. by default it is Set log output file of SpaceVim. by default it is

View File

@ -16,4 +16,4 @@
<lastmod>2017-01-08T05:59:47+00:00</lastmod> <lastmod>2017-01-08T05:59:47+00:00</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
</urlset> </urlset>