Skip to content

Commit

Permalink
Merge pull request #2203 from sbromberger/sbromberger/suppress-logging
Browse files Browse the repository at this point in the history
adds options to suppress/customize delve logging; closes #2200
  • Loading branch information
bhcleek committed Mar 31, 2019
2 parents 8675025 + 8440914 commit 94a9279
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions autoload/go/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ function! go#config#DebugCommands() abort
return g:go_debug_commands
endfunction

function! go#config#DebugLogOutput() abort
return get(g:, 'go_debug_log_output', 'debugger, rpc')
endfunction

function! go#config#LspLog() abort
" make sure g:go_lsp_log is set so that it can be added to easily.
let g:go_lsp_log = get(g:, 'go_lsp_log', [])
Expand Down
6 changes: 5 additions & 1 deletion autoload/go/debug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -617,16 +617,20 @@ function! go#debug#Start(is_test, ...) abort
let l:args = ['--'] + a:000[1:]
endif

let l:debugLogOutput = go#config#DebugLogOutput()
let l:shouldLog = debugLogOutput isnot '' ? 1 : 0
let l:cmd = [
\ dlv,
\ (a:is_test ? 'test' : 'debug'),
\ l:pkgname,
\ '--output', tempname(),
\ '--headless',
\ '--api-version', '2',
\ '--log', '--log-output', 'debugger,rpc',
\ '--listen', go#config#DebugAddress(),
\]
if shouldLog
let cmd += ['--log', '--log-output', debugLogOutput]
endif

let buildtags = go#config#BuildTags()
if buildtags isnot ''
Expand Down
10 changes: 10 additions & 0 deletions doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2153,6 +2153,16 @@ Defaults to `127.0.0.1:8181`:
let g:go_debug_address = '127.0.0.1:8181'
<

*'g:go_debug_log_output'*

Specifies log output options for `dlv`. Value should be a single string
of comma-separated options suitable for passing to `dlv`. An empty string
(`''`) will suppress logging entirely.
Default: `'debugger, rpc'`:
>
let g:go_debug_log = 'debugger, rpc'
<

*'g:go_highlight_debug'*

Highlight the current line and breakpoints in the debugger.
Expand Down

0 comments on commit 94a9279

Please sign in to comment.