From 0152571eb570c5ac9e347dfb0c1aeb25ce28c950 Mon Sep 17 00:00:00 2001 From: Jacobo de Vera Date: Mon, 7 Apr 2014 02:35:45 +0200 Subject: [PATCH] Add multiple lines separately to the log --- autoload/vundle/installer.vim | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index bc2f41d..c96e078 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -187,8 +187,8 @@ func! vundle#installer#delete(bang, dir_name) abort call s:log('') call s:log('Plugin '.a:dir_name) - call s:log('$ '.cmd) - call s:log('> '.out) + call s:log(cmd, '$ ') + call s:log(out, '> ') if 0 != v:shell_error return 'error' @@ -237,8 +237,8 @@ func! s:sync(bang, bundle) abort let out = s:system(cmd) call s:log('') call s:log('Plugin '.a:bundle.name_spec) - call s:log('$ '.cmd) - call s:log('> '.out) + call s:log(cmd, '$ ') + call s:log(out, '> ') if 0 != v:shell_error return 'error' @@ -278,8 +278,13 @@ func! s:system(cmd) abort return system(a:cmd) endf -func! s:log(str) abort - let fmt = '%y%m%d %H:%M:%S' - call add(g:vundle_log, '['.strftime(fmt).'] '.a:str) +func! s:log(str, ...) abort + let prefix = a:0 > 0 ? a:1 : '' + let fmt = '%Y-%m-%d %H:%M:%S' + let lines = split(a:str, '\n', 1) + let time = strftime(fmt) + for line in lines + call add(g:vundle_log, '['. time .'] '. prefix . line) + endfor return a:str endf