2017-04-14 22:30:45 +08:00
|
|
|
Execute ( SpaceVim api: logger ):
|
|
|
|
new
|
|
|
|
let log = SpaceVim#api#import('logger')
|
|
|
|
call log.set_name('TestLog')
|
|
|
|
AssertEqual log.name, 'TestLog'
|
|
|
|
call log.info('info test')
|
|
|
|
call log.warn('info test')
|
|
|
|
call log.error('info test')
|
|
|
|
AssertEqual len(log.temp), 3
|
|
|
|
call log.set_level(2)
|
|
|
|
call log.info('info test')
|
|
|
|
call log.warn('info test')
|
|
|
|
call log.error('info test')
|
|
|
|
AssertEqual len(log.temp), 5
|
|
|
|
call log.set_level(3)
|
|
|
|
call log.info('info test')
|
|
|
|
call log.warn('info test')
|
|
|
|
call log.error('info test')
|
|
|
|
AssertEqual len(log.temp), 6
|
2017-04-14 22:58:36 +08:00
|
|
|
AssertEqual len(split(log.view(1), "\n")), 7
|
|
|
|
AssertEqual len(split(log.view(2), "\n")), 6
|
|
|
|
AssertEqual len(split(log.view(3), "\n")), 4
|