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

Improve logger

This commit is contained in:
wsdjeg 2017-02-02 14:48:36 +08:00
parent b84796485f
commit bc7bbc4a11
3 changed files with 60 additions and 13 deletions

View File

@ -1,19 +1,15 @@
### Expected behavior, english is recommend ## Expected behavior, english is recommend
### Environment Information ## Environment Information
- OS: - OS:
- vim version: - vim version:
- neovim version: - neovim version:
### The reproduce ways from Vim starting (Required!) ## The reproduce ways from Vim starting (Required!)
### Output of the ":message" command, and ":echo SpaceVim#logger#viewLog()" ## Output of the ":message" command, and ":echo SpaceVim#logger#viewLog()"
```log please post log below, if you want me reproduce your issue quickly, post your custom config here will be better.
please post log here:
```

View File

@ -0,0 +1,41 @@
function! SpaceVim#health#python#check() abort
let result = ['SpaceVim python support check report:']
if has('nvim')
call add(result, 'Checking +python3:')
if has('python3')
call add(result, ' SUCCEED!')
else
call add(result, ' Failed : to support +python3, you need run `pip3 install neovim`')
endif
call add(result, 'Checking +python:')
if has('python')
call add(result, ' SUCCEED!')
else
call add(result, ' Failed : to support +python, you need run `pip2 install neovim`')
endif
else
call add(result, 'Checking +python3:')
if has('python3')
call add(result, ' SUCCEED!')
else
if !WINDOWS()
call add(result, ' Failed : to support +python3, Please install vim-gik, or build from sources.')
else
call add(result, ' Failed : to support +python3, install vim from https://github.com/vim/vim-win32-installer/releases')
call add(result, ' install python3, make sure you have `python` in your path.')
endif
endif
call add(result, 'Checking +python:')
if has('python')
call add(result, ' SUCCEED!')
else
if !WINDOWS()
call add(result, ' Failed : to support +python, Please install vim-gik, or build from sources.')
else
call add(result, ' Failed : to support +python3, install vim from https://github.com/vim/vim-win32-installer/releases')
call add(result, ' install python3, make sure you have `python` in your path.')
endif
endif
endif
return result
endfunction

View File

@ -47,19 +47,29 @@ endfunction
function! SpaceVim#logger#viewLog(...) abort function! SpaceVim#logger#viewLog(...) abort
let info = "SpaceVim Options :\n\n" let info = "### SpaceVim Options :\n\n"
let info .= "```viml\n"
let info .= join(SpaceVim#options#list(), "\n") let info .= join(SpaceVim#options#list(), "\n")
let info .= "\n" let info .= "\n```\n"
let info .= "\n\n"
let info .= "### SpaceVim Health checking :\n\n"
let info .= SpaceVim#health#report()
let info .= "\n\n"
let info .= "### SpaceVim runtime log :\n\n"
let info .= "```log\n"
let l = a:0 > 0 ? a:1 : 1 let l = a:0 > 0 ? a:1 : 1
if filereadable(s:logger_file) if filereadable(s:logger_file)
let logs = readfile(s:logger_file, '') let logs = readfile(s:logger_file, '')
return info . join(filter(logs, "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \[" . s:levels[l] . "\]'"), "\n") let info .= join(filter(logs, "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \[" . s:levels[l] . "\]'"), "\n")
else else
let info .= '[ SpaceVim ] : logger file ' . s:logger_file . ' does not exists, only log for current process will be shown!' let info .= '[ SpaceVim ] : logger file ' . s:logger_file . ' does not exists, only log for current process will be shown!'
let info .= join(filter(s:log_temp, "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \[" . s:levels[l] . "\]'"), "\n") let info .= join(filter(s:log_temp, "v:val =~# '\[ SpaceVim \] \[\d\d\:\d\d\:\d\d\] \[" . s:levels[l] . "\]'"), "\n")
return info
endif endif
let info .= "\n```\n"
return info
endfunction endfunction
"" ""