From 65d8e06356a93d59bda94651aceb35037c7c34c8 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 8 Jan 2017 18:38:45 +0800 Subject: [PATCH] Fix lint --- BingSiteAuth.xml | 2 +- autoload/SpaceVim/logger.vim | 32 ++++++++++++++++++++++++-------- autoload/SpaceVim/plugins.vim | 1 + doc/SpaceVim.txt | 8 ++++---- sitemap.xml | 2 +- 5 files changed, 31 insertions(+), 14 deletions(-) diff --git a/BingSiteAuth.xml b/BingSiteAuth.xml index f130d5ab9..04a43a6cf 100644 --- a/BingSiteAuth.xml +++ b/BingSiteAuth.xml @@ -1,4 +1,4 @@ 14716157352C631AD40087A3D69C499B - \ No newline at end of file + diff --git a/autoload/SpaceVim/logger.vim b/autoload/SpaceVim/logger.vim index 0cf8f9650..a90888031 100644 --- a/autoload/SpaceVim/logger.vim +++ b/autoload/SpaceVim/logger.vim @@ -1,26 +1,42 @@ -let s:logger_level = 0 +let s:logger_level = 1 let s:levels = ['Info', 'Warn', 'Error'] let s:logger_file = expand('~/.SpaceVim/.SpaceVim.log') + "" " @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 let s:logger_level = a:level 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 call writefile([a:msg], s:logger_file, 'a') endfunction -function! SpaceVim#logger#info(msg) abort - call s:wite(s:warpMsg(a:msg, 1)) -endfunction function! SpaceVim#logger#viewLog(...) abort let l = a:0 > 0 ? a:1 : 0 diff --git a/autoload/SpaceVim/plugins.vim b/autoload/SpaceVim/plugins.vim index 90b85ba23..521dcb8bd 100644 --- a/autoload/SpaceVim/plugins.vim +++ b/autoload/SpaceVim/plugins.vim @@ -1,3 +1,4 @@ +scriptencoding utf-8 let s:plugins = {} let s:plugins.core = [ diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 7c2efd39a..7740df783 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -128,13 +128,13 @@ SpaceVim#Layer({layer}) *SpaceVim#Layer()* autocompletion. unite : Unite centric work-flow 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()* Set log output file of SpaceVim. by default it is diff --git a/sitemap.xml b/sitemap.xml index f20f74309..5bdd1751d 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -16,4 +16,4 @@ 2017-01-08T05:59:47+00:00 daily - \ No newline at end of file +