1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-14 10:45:42 +08:00

fix(mail): fix mail logger

This commit is contained in:
Shidong Wang 2021-10-23 16:32:42 +08:00
parent 5ec1b3beb5
commit 1cc4282c99
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
4 changed files with 83 additions and 75 deletions

View File

@ -12,7 +12,7 @@ function! mail#client#connect(ip, port)
\ 'on_exit' : function('s:on_exit'),
\ }
\ )
call mail#client#logger#info('mail client job id:' . s:job_id)
endfunction
" Wed, 06 Sep 2017 02:55:41 +0000 ===> 2017-09-06
@ -61,6 +61,7 @@ function! s:parser(data) abort
endfunction
function! s:on_stdout(id, data, event) abort
call mail#client#logger#info('STDOUT: ' . string(a:data))
call s:parser(a:data)
endfunction
@ -84,7 +85,11 @@ endfunction
function! mail#client#send(command)
call mail#client#logger#info('Send command: ' . a:command)
if s:job_id >= 0
call s:JOB.send(s:job_id, a:command)
else
call mail#client#logger#info('skipped!, job id is:' . s:job_id)
endif
endfunction
function! mail#client#open()

View File

@ -1,11 +1,4 @@
let s:LOGGER = SpaceVim#api#import('logger')
let g:wsd = keys(s:LOGGER)
call s:LOGGER.set_name('vim-mail')
call s:LOGGER.set_level(1)
let s:LOGGER.silent = 0
let s:LOGGER =SpaceVim#logger#derive('mail')
function! mail#client#logger#info(msg)
call s:LOGGER.info(a:msg)
@ -20,9 +13,3 @@ function! mail#client#logger#warn(msg)
call s:LOGGER.warn(a:msg)
endfunction
function! mail#client#logger#view()
call s:LOGGER.view()
endfunction

View File

@ -4,13 +4,13 @@
let s:BUFFER = SpaceVim#api#import('vim#buffer')
let s:bufnr = 0
let s:bufnr = -1
let s:win_name = 'home'
let s:win_dir = 'INBOX'
let s:win_unseen = {}
function! mail#client#win#open()
if s:bufnr == 0
if s:bufnr ==# -1
split __VIM_MAIL__
let s:bufnr = bufnr('%')
setlocal buftype=nofile nobuflisted nolist noswapfile nowrap cursorline nospell nomodifiable nowrap norelativenumber number

View File

@ -0,0 +1,16 @@
let s:LOGGER =SpaceVim#logger#derive('vim-mail')
function! mail#logger#info(msg)
call s:LOGGER.info(a:msg)
endfunction
function! mail#logger#error(msg)
call s:LOGGER.error(a:msg)
endfunction
function! mail#logger#warn(msg)
call s:LOGGER.warn(a:msg)
endfunction