sdk: also print test agent logs in verbose mode (#8616)
This commit is contained in:
parent
b57a5b4911
commit
a14a31ccf1
|
@ -25,8 +25,8 @@ func LoggerWithOutput(t testing.TB, output io.Writer) hclog.InterceptLogger {
|
||||||
var sendTestLogsToStdout = os.Getenv("NOLOGBUFFER") == "1"
|
var sendTestLogsToStdout = os.Getenv("NOLOGBUFFER") == "1"
|
||||||
|
|
||||||
// NewLogBuffer returns an io.Writer which buffers all writes. When the test
|
// NewLogBuffer returns an io.Writer which buffers all writes. When the test
|
||||||
// ends, t.Failed is checked. If the test has failed all log output is printed
|
// ends, t.Failed is checked. If the test has failed or has been run in verbose
|
||||||
// to stdout.
|
// mode all log output is printed to stdout.
|
||||||
//
|
//
|
||||||
// Set the env var NOLOGBUFFER=1 to disable buffering, resulting in all log
|
// Set the env var NOLOGBUFFER=1 to disable buffering, resulting in all log
|
||||||
// output being written immediately to stdout.
|
// output being written immediately to stdout.
|
||||||
|
@ -36,7 +36,7 @@ func NewLogBuffer(t CleanupT) io.Writer {
|
||||||
}
|
}
|
||||||
buf := &logBuffer{buf: new(bytes.Buffer)}
|
buf := &logBuffer{buf: new(bytes.Buffer)}
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
if t.Failed() {
|
if t.Failed() || testing.Verbose() {
|
||||||
buf.Lock()
|
buf.Lock()
|
||||||
defer buf.Unlock()
|
defer buf.Unlock()
|
||||||
buf.buf.WriteTo(os.Stdout)
|
buf.buf.WriteTo(os.Stdout)
|
||||||
|
|
Loading…
Reference in New Issue