mirror of
https://github.com/restic/restic.git
synced 2024-12-25 01:06:39 +00:00
1cb11ad8ad
The test case fails from time to time with an Input/Output error while trying to access the snapshots directory.
23 lines
449 B
Go
23 lines
449 B
Go
package debug
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
// TestLogToStderr configures debug to log to stderr if not the debug log is
|
|
// not already configured and returns whether logging was enabled.
|
|
func TestLogToStderr(t testing.TB) bool {
|
|
if opts.isEnabled {
|
|
return false
|
|
}
|
|
opts.logger = log.New(os.Stderr, "", log.LstdFlags)
|
|
opts.isEnabled = true
|
|
return true
|
|
}
|
|
|
|
func TestDisableLog(t testing.TB) {
|
|
opts.logger = nil
|
|
opts.isEnabled = false
|
|
}
|