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

docs(logger): update doc for :h SpaceVim#logger#derive

This commit is contained in:
wsdjeg 2023-09-16 16:00:55 +08:00
parent 2425ef85e2
commit 69acc16f48
2 changed files with 19 additions and 2 deletions

View File

@ -89,12 +89,20 @@ if has('nvim-0.5.0')
" 6. stop_debug(): stop debug mode of derived logger. " 6. stop_debug(): stop debug mode of derived logger.
" 7. debug_enabled(): return true or false. " 7. debug_enabled(): return true or false.
" "
" Example: > " This function can be used in vim script and lua.
"
" Vim script Example: >
" let s:LOGGER = SpaceVim#logger#derive('myplug') " let s:LOGGER = SpaceVim#logger#derive('myplug')
" "
" call s:LOGGER.info('hello world') " call s:LOGGER.info('hello world')
" < " <
" "
" Lua Example: >
" local log = require('spacevim.logger').derive('myplug')
"
" log.info('hello world')
" <
"
" The this info message will be write to SpaceVim's runtime log: " The this info message will be write to SpaceVim's runtime log:
" > " >
" [ myplug ] [00:02:54:051] [ Info ] hello world " [ myplug ] [00:02:54:051] [ Info ] hello world

View File

@ -1724,13 +1724,22 @@ SpaceVim#logger#derive({name}) *SpaceVim#logger#derive()*
6. stop_debug(): stop debug mode of derived logger. 6. stop_debug(): stop debug mode of derived logger.
7. debug_enabled(): return true or false. 7. debug_enabled(): return true or false.
Example: This function can be used in vim script and lua.
Vim script Example:
> >
let s:LOGGER = SpaceVim#logger#derive('myplug') let s:LOGGER = SpaceVim#logger#derive('myplug')
call s:LOGGER.info('hello world') call s:LOGGER.info('hello world')
< <
Lua Example:
>
local log = require('spacevim.logger').derive('myplug')
log.info('hello world')
<
The this info message will be write to SpaceVim's runtime log: The this info message will be write to SpaceVim's runtime log:
> >
[ myplug ] [00:02:54:051] [ Info ] hello world [ myplug ] [00:02:54:051] [ Info ] hello world