mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
Disable logging during unit tests (#5861)
This commit is contained in:
parent
b6ca39ea48
commit
11b8e292a7
@ -37,6 +37,9 @@ var (
|
||||
colorRed = color.New(color.FgRed).SprintfFunc()
|
||||
)
|
||||
|
||||
// Disable disables all logging, false by default. (used for "go test")
|
||||
var Disable = false
|
||||
|
||||
var trimStrings []string
|
||||
|
||||
// Level type
|
||||
@ -79,6 +82,9 @@ type Console interface {
|
||||
}
|
||||
|
||||
func consoleLog(console Console, msg string, args ...interface{}) {
|
||||
if Disable {
|
||||
return
|
||||
}
|
||||
if jsonFlag {
|
||||
console.json(msg, args...)
|
||||
} else if quiet {
|
||||
@ -221,6 +227,10 @@ func getTrace(traceLevel int) []string {
|
||||
|
||||
// LogIf :
|
||||
func LogIf(ctx context.Context, err error) {
|
||||
if Disable {
|
||||
return
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ func init() {
|
||||
// Set system resources to maximum.
|
||||
setMaxResources()
|
||||
|
||||
logger.EnableQuiet()
|
||||
logger.Disable = true
|
||||
}
|
||||
|
||||
// concurreny level for certain parallel tests.
|
||||
|
Loading…
Reference in New Issue
Block a user