Avoid :redir inside execute()

This was happening when starting vim with `let g:gitgutter_log = 1`
and generated E930.
This commit is contained in:
Andy Stewart
2023-06-03 09:56:17 +01:00
parent 538fba90fb
commit 621b9e77ff

View File

@@ -75,23 +75,21 @@ function! gitgutter#debug#log(message, ...) abort
endif endif
endif endif
execute 'redir >> '.s:log_file
if s:new_log_session if s:new_log_session
let s:start = reltime() let s:start = reltime()
silent echo "\n==== start log session ====" call writefile(['==== start log session ===='], s:log_file, 'a')
endif endif
let elapsed = reltimestr(reltime(s:start)).' ' let elapsed = reltimestr(reltime(s:start)).' '
silent echo '' call writefile([''], s:log_file, 'a')
" callers excluding this function " callers excluding this function
silent echo elapsed.expand('<sfile>')[:-22].':' call writefile([elapsed.expand('<sfile>')[:-22].':'], s:log_file, 'a')
silent echo elapsed.s:format_for_log(a:message) call writefile([elapsed.s:format_for_log(a:message)], s:log_file, 'a')
if a:0 && !empty(a:1) if a:0 && !empty(a:1)
for msg in a:000 for msg in a:000
silent echo elapsed.s:format_for_log(msg) call writefile([elapsed.s:format_for_log(msg)], s:log_file, 'a')
endfor endfor
endif endif
redir END
let s:new_log_session = 0 let s:new_log_session = 0
endif endif