Skip to content

Commit

Permalink
log: disable logs by default
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Feb 27, 2017
1 parent 38e2735 commit 43362ab
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions log/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,16 @@ package log

import (
"os"

"github.com/ethereum/go-ethereum/log/term"
"github.com/mattn/go-colorable"
)

var (
root *logger
root = &logger{[]interface{}{}, new(swapHandler)}
StdoutHandler = StreamHandler(os.Stdout, LogfmtFormat())
StderrHandler = StreamHandler(os.Stderr, LogfmtFormat())
)

func init() {
if term.IsTty(os.Stdout.Fd()) {
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))
root.SetHandler(DiscardHandler())
}

// New returns a new logger with the given context.
Expand Down

0 comments on commit 43362ab

Please sign in to comment.