diff --git a/internal/lsp/regtest/regtest.go b/internal/lsp/regtest/regtest.go index 31806233c4..9ebc673f8c 100644 --- a/internal/lsp/regtest/regtest.go +++ b/internal/lsp/regtest/regtest.go @@ -26,6 +26,7 @@ var ( regtestTimeout = flag.Duration("regtest_timeout", defaultRegtestTimeout(), "if nonzero, default timeout for each regtest; defaults to GOPLS_REGTEST_TIMEOUT") skipCleanup = flag.Bool("regtest_skip_cleanup", false, "whether to skip cleaning up temp directories") printGoroutinesOnFailure = flag.Bool("regtest_print_goroutines", false, "whether to print goroutines info on failure") + printLogs = flag.Bool("regtest_print_logs", false, "whether to print LSP logs") ) func defaultRegtestTimeout() time.Duration { diff --git a/internal/lsp/regtest/runner.go b/internal/lsp/regtest/runner.go index 822a5a315c..3cfeb772a1 100644 --- a/internal/lsp/regtest/runner.go +++ b/internal/lsp/regtest/runner.go @@ -313,7 +313,7 @@ func (r *Runner) Run(t *testing.T, files string, test TestFunc, opts ...RunOptio if t.Failed() && r.PrintGoroutinesOnFailure { pprof.Lookup("goroutine").WriteTo(os.Stderr, 1) } - if t.Failed() || testing.Verbose() { + if t.Failed() || *printLogs { ls.printBuffers(t.Name(), os.Stderr) } // For tests that failed due to a timeout, don't fail to shutdown