mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-12 04:41:22 +00:00
[log] allow for custom color funcs
This commit is contained in:
@ -3,6 +3,8 @@ package log
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/go-kit/kit/log/term"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -29,3 +31,19 @@ func TestingLogger() Logger {
|
||||
|
||||
return _testingLogger
|
||||
}
|
||||
|
||||
// TestingLoggerWithColorFn allow you to provide your own color function. See
|
||||
// TestingLogger for documentation.
|
||||
func TestingLoggerWithColorFn(colorFn func(keyvals ...interface{}) term.FgBgColor) Logger {
|
||||
if _testingLogger != nil {
|
||||
return _testingLogger
|
||||
}
|
||||
|
||||
if testing.Verbose() {
|
||||
_testingLogger = NewTMLoggerWithColorFn(NewSyncWriter(os.Stdout), colorFn)
|
||||
} else {
|
||||
_testingLogger = NewNopLogger()
|
||||
}
|
||||
|
||||
return _testingLogger
|
||||
}
|
||||
|
Reference in New Issue
Block a user