mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-03 12:53:29 +08:00
util/log: SetDebugLogging
This commit is contained in:
@ -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) {
|
|||||||
}
|
}
|
||||||
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() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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, "")
|
||||||
|
Reference in New Issue
Block a user