forked from cerc-io/plugeth
log: disable logs by default
This commit is contained in:
parent
38e273597c
commit
43362ab4fb
16
log/root.go
16
log/root.go
@ -2,28 +2,16 @@ package log
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/log/term"
|
|
||||||
"github.com/mattn/go-colorable"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
root *logger
|
root = &logger{[]interface{}{}, new(swapHandler)}
|
||||||
StdoutHandler = StreamHandler(os.Stdout, LogfmtFormat())
|
StdoutHandler = StreamHandler(os.Stdout, LogfmtFormat())
|
||||||
StderrHandler = StreamHandler(os.Stderr, LogfmtFormat())
|
StderrHandler = StreamHandler(os.Stderr, LogfmtFormat())
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if term.IsTty(os.Stdout.Fd()) {
|
root.SetHandler(DiscardHandler())
|
||||||
StdoutHandler = StreamHandler(colorable.NewColorableStdout(), TerminalFormat())
|
|
||||||
}
|
|
||||||
|
|
||||||
if term.IsTty(os.Stderr.Fd()) {
|
|
||||||
StderrHandler = StreamHandler(colorable.NewColorableStderr(), TerminalFormat())
|
|
||||||
}
|
|
||||||
|
|
||||||
root = &logger{[]interface{}{}, new(swapHandler)}
|
|
||||||
root.SetHandler(LvlFilterHandler(LvlInfo, StdoutHandler))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns a new logger with the given context.
|
// New returns a new logger with the given context.
|
||||||
|
Loading…
Reference in New Issue
Block a user