aboutsummaryrefslogtreecommitdiffstats
path: root/logger
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-01-28 23:11:24 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-01-28 23:11:24 +0800
commit528dcc3814aa1ee5bfcf3812aa4085f45a6623c4 (patch)
tree89ee7b6627e61ab6af52f32abef5595ce34b926b /logger
parentae1a137ce7daa885938e010dccd8436f8570329f (diff)
parent3750d835a1697f6784c727074cc959dda33cdcf3 (diff)
downloadgo-tangerine-528dcc3814aa1ee5bfcf3812aa4085f45a6623c4.tar
go-tangerine-528dcc3814aa1ee5bfcf3812aa4085f45a6623c4.tar.gz
go-tangerine-528dcc3814aa1ee5bfcf3812aa4085f45a6623c4.tar.bz2
go-tangerine-528dcc3814aa1ee5bfcf3812aa4085f45a6623c4.tar.lz
go-tangerine-528dcc3814aa1ee5bfcf3812aa4085f45a6623c4.tar.xz
go-tangerine-528dcc3814aa1ee5bfcf3812aa4085f45a6623c4.tar.zst
go-tangerine-528dcc3814aa1ee5bfcf3812aa4085f45a6623c4.zip
Merge pull request #2151 from fjl/debug-api
internal/debug: APIs for profiling and tracing
Diffstat (limited to 'logger')
-rw-r--r--logger/glog/glog.go22
1 files changed, 14 insertions, 8 deletions
diff --git a/logger/glog/glog.go b/logger/glog/glog.go
index b8eaf9359..14e405955 100644
--- a/logger/glog/glog.go
+++ b/logger/glog/glog.go
@@ -138,25 +138,28 @@ func SetV(v int) {
logging.verbosity.set(Level(v))
}
-// SetVmodule sets the global verbosity patterns.
-func SetVmodule(pat string) error {
- return logging.vmodule.Set(pat)
-}
-
// SetToStderr sets the global output style
func SetToStderr(toStderr bool) {
+ logging.mu.Lock()
logging.toStderr = toStderr
+ logging.mu.Unlock()
}
-// GetTraceLocation returns the global TraceLocation object
+// GetTraceLocation returns the global TraceLocation flag.
func GetTraceLocation() *TraceLocation {
return &logging.traceLocation
}
+// GetVModule returns the global verbosity pattern flag.
func GetVModule() *moduleSpec {
return &logging.vmodule
}
+// GetVerbosity returns the global verbosity level flag.
+func GetVerbosity() *Level {
+ return &logging.verbosity
+}
+
// get returns the value of the severity.
func (s *severity) get() severity {
return severity(atomic.LoadInt32((*int32)(s)))
@@ -407,9 +410,13 @@ var errTraceSyntax = errors.New("syntax error: expect file.go:234")
func (t *TraceLocation) Set(value string) error {
if value == "" {
// Unset.
+ logging.mu.Lock()
t.line = 0
t.file = ""
+ logging.mu.Unlock()
+ return nil
}
+
fields := strings.Split(value, ":")
if len(fields) != 2 {
return errTraceSyntax
@@ -449,8 +456,7 @@ func init() {
// Default stderrThreshold is ERROR.
logging.stderrThreshold = errorLog
-
- logging.setVState(0, nil, false)
+ logging.setVState(3, nil, false)
go logging.flushDaemon()
}