1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-02 03:28:25 +08:00

util/log: SetDebugLogging

This commit is contained in:
Juan Batiz-Benet
2014-12-11 01:52:06 -08:00
parent 477f5c8838
commit ac2be0b68b
2 changed files with 6 additions and 3 deletions

View File

@ -12,8 +12,6 @@ import (
"syscall"
"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"
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) {
}
if debug || u.GetenvBool("DEBUG") || os.Getenv("IPFS_LOGGING") == "debug" {
u.Debug = true
u.SetAllLoggers(logging.DEBUG)
u.SetDebugLogging()
}
// if debugging, let's profile.

View File

@ -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
func SetAllLoggers(lvl logging.Level) {
logging.SetLevel(lvl, "")