提交 ac2be0b6 作者: Juan Batiz-Benet

util/log: SetDebugLogging

上级 477f5c88
...@@ -12,8 +12,6 @@ import ( ...@@ -12,8 +12,6 @@ import (
"syscall" "syscall"
"time" "time"
// TODO rm direct reference to go-logging
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-logging"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
manet "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net" manet "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
...@@ -147,7 +145,7 @@ func (i *cmdInvocation) Run(ctx context.Context) (output io.Reader, err error) { ...@@ -147,7 +145,7 @@ func (i *cmdInvocation) Run(ctx context.Context) (output io.Reader, err error) {
} }
if debug || u.GetenvBool("DEBUG") || os.Getenv("IPFS_LOGGING") == "debug" { if debug || u.GetenvBool("DEBUG") || os.Getenv("IPFS_LOGGING") == "debug" {
u.Debug = true u.Debug = true
u.SetAllLoggers(logging.DEBUG) u.SetDebugLogging()
} }
// if debugging, let's profile. // if debugging, let's profile.
......
...@@ -70,6 +70,11 @@ func SetupLogging() { ...@@ -70,6 +70,11 @@ func SetupLogging() {
} }
// SetDebugLogging calls SetAllLoggers with logging.DEBUG
func SetDebugLogging() {
SetAllLoggers(logging.DEBUG)
}
// SetAllLoggers changes the logging.Level of all loggers to lvl // SetAllLoggers changes the logging.Level of all loggers to lvl
func SetAllLoggers(lvl logging.Level) { func SetAllLoggers(lvl logging.Level) {
logging.SetLevel(lvl, "") logging.SetLevel(lvl, "")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论