diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-02-22 20:10:07 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-02-23 18:16:44 +0800 |
commit | d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851 (patch) | |
tree | 17c93170551d3eeabe2935de1765f157007f0dc2 /internal/debug/api.go | |
parent | 47af53f9aaf9aa7b12cd976eb150ccf3d64da6fd (diff) | |
download | dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.gz dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.zst dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.zip |
all: blidly swap out glog to our log15, logs need rework
Diffstat (limited to 'internal/debug/api.go')
-rw-r--r-- | internal/debug/api.go | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/internal/debug/api.go b/internal/debug/api.go index 96091541b..01126b41b 100644 --- a/internal/debug/api.go +++ b/internal/debug/api.go @@ -22,6 +22,7 @@ package debug import ( "errors" + "fmt" "io" "os" "os/user" @@ -33,8 +34,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/log" ) // Handler is the global debugging handler. @@ -51,23 +51,22 @@ type HandlerT struct { traceFile string } -// Verbosity sets the glog verbosity ceiling. -// The verbosity of individual packages and source files -// can be raised using Vmodule. +// Verbosity sets the log verbosity ceiling. The verbosity of individual packages +// and source files can be raised using Vmodule. func (*HandlerT) Verbosity(level int) { - glog.SetV(level) + glogger.Verbosity(log.Lvl(level)) } -// Vmodule sets the glog verbosity pattern. See package -// glog for details on pattern syntax. +// Vmodule sets the log verbosity pattern. See package log for details on the +// pattern syntax. func (*HandlerT) Vmodule(pattern string) error { - return glog.GetVModule().Set(pattern) + return glogger.Vmodule(pattern) } -// BacktraceAt sets the glog backtrace location. -// See package glog for details on pattern syntax. +// BacktraceAt sets the log backtrace location. See package log for details on +// the pattern syntax. func (*HandlerT) BacktraceAt(location string) error { - return glog.GetTraceLocation().Set(location) + return glogger.BacktraceAt(location) } // MemStats returns detailed runtime memory statistics. @@ -112,7 +111,7 @@ func (h *HandlerT) StartCPUProfile(file string) error { } h.cpuW = f h.cpuFile = file - glog.V(logger.Info).Infoln("CPU profiling started, writing to", h.cpuFile) + log.Info(fmt.Sprint("CPU profiling started, writing to", h.cpuFile)) return nil } @@ -124,7 +123,7 @@ func (h *HandlerT) StopCPUProfile() error { if h.cpuW == nil { return errors.New("CPU profiling not in progress") } - glog.V(logger.Info).Infoln("done writing CPU profile to", h.cpuFile) + log.Info(fmt.Sprint("done writing CPU profile to", h.cpuFile)) h.cpuW.Close() h.cpuW = nil h.cpuFile = "" @@ -180,7 +179,7 @@ func (*HandlerT) Stacks() string { func writeProfile(name, file string) error { p := pprof.Lookup(name) - glog.V(logger.Info).Infof("writing %d %s profile records to %s", p.Count(), name, file) + log.Info(fmt.Sprintf("writing %d %s profile records to %s", p.Count(), name, file)) f, err := os.Create(expandHome(file)) if err != nil { return err |