From de6efc650cad1192649a4ad59e8c3dd5b59e29f0 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 3 Apr 2023 12:52:27 +0800 Subject: [PATCH] fix(logger): fix derived logger --- autoload/SpaceVim/logger.vim | 4 ++++ bundle/tagbar/autoload/tagbar.vim | 8 ++++---- bundle/tagbar/autoload/tagbar/log.vim | 4 ++-- lua/spacevim/logger.lua | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/autoload/SpaceVim/logger.vim b/autoload/SpaceVim/logger.vim index 418fdf5cd..20ef15c0d 100644 --- a/autoload/SpaceVim/logger.vim +++ b/autoload/SpaceVim/logger.vim @@ -234,6 +234,10 @@ else let self._debug_mode = 0 endfunction + function! s:derive.debug_enabled() abort + return self._debug_mode + endfunction + function! SpaceVim#logger#derive(name) abort let s:derive.derive_name = printf('%' . strdisplaywidth(s:LOGGER.get_name()) . 'S', a:name) return deepcopy(s:derive) diff --git a/bundle/tagbar/autoload/tagbar.vim b/bundle/tagbar/autoload/tagbar.vim index 4a897593c..ec3921ebf 100644 --- a/bundle/tagbar/autoload/tagbar.vim +++ b/bundle/tagbar/autoload/tagbar.vim @@ -1278,7 +1278,7 @@ function! s:ProcessFile(fname, ftype) abort let ctags_output = s:ExecuteCtagsOnFile(tempfile, a:fname, typeinfo) - if !tagbar#log#enabled() + if !tagbar#log#debug_enabled() call delete(tempfile) endif else @@ -1404,7 +1404,7 @@ function! s:ExecuteCtagsOnFile(fname, realfname, typeinfo) abort \ ] " verbose if debug enabled - if tagbar#log#enabled() + if tagbar#log#debug_enabled() let ctags_args += [ '-V' ] endif @@ -3155,7 +3155,7 @@ function! s:ExecuteCtags(ctags_cmd) abort set shellcmdflag=/s\ /c endif - if tagbar#log#enabled() + if tagbar#log#debug_enabled() silent 5verbose let ctags_output = system(a:ctags_cmd) call tagbar#log#debug(v:statusmsg) call tagbar#log#debug('Exit code: ' . v:shell_error) @@ -4052,7 +4052,7 @@ endfunction " tagbar#printfileinfo() {{{2 function! tagbar#printfileinfo() abort - if !tagbar#log#enabled() + if !tagbar#log#debug_enabled() echo 'Tagbar debug is disabled - unable to print fileinfo to tagbar log' return endif diff --git a/bundle/tagbar/autoload/tagbar/log.vim b/bundle/tagbar/autoload/tagbar/log.vim index 78e64e571..6bb189f84 100644 --- a/bundle/tagbar/autoload/tagbar/log.vim +++ b/bundle/tagbar/autoload/tagbar/log.vim @@ -30,6 +30,6 @@ function! tagbar#log#info(msg) abort call s:LOGGER.info(a:msg) endfunction -function! tagbar#log#enabled() abort - return s:LOGGER.enabled() +function! tagbar#log#debug_enabled() abort + return s:LOGGER.debug_enabled() endfunction diff --git a/lua/spacevim/logger.lua b/lua/spacevim/logger.lua index 18450f4ef..699dd6da2 100644 --- a/lua/spacevim/logger.lua +++ b/lua/spacevim/logger.lua @@ -139,7 +139,7 @@ function M.derive(name) function derive.stop_debug() derive._debug_mode = false end - function derive.enabled() -- {{{ + function derive.debug_enabled() -- {{{ return derive._debug_mode end -- }}}