diff options
author | zelig <viktor.tron@gmail.com> | 2014-07-15 01:50:06 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-07-15 01:50:06 +0800 |
commit | 3d5db7288f134fef7e51b25776007705f6663654 (patch) | |
tree | edda6e8fd23584327473058411df9cd2c53241f4 /ethlog/loggers.go | |
parent | dc11b5c55e2888a7a3dac51fedc3864d112136ce (diff) | |
parent | 8845fb7eae3e51fd3e55c47c377bf1a9e0cfe2a9 (diff) | |
download | dexon-3d5db7288f134fef7e51b25776007705f6663654.tar.gz dexon-3d5db7288f134fef7e51b25776007705f6663654.tar.zst dexon-3d5db7288f134fef7e51b25776007705f6663654.zip |
merge upstream
Diffstat (limited to 'ethlog/loggers.go')
-rw-r--r-- | ethlog/loggers.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ethlog/loggers.go b/ethlog/loggers.go index 4e950cadd..f13186102 100644 --- a/ethlog/loggers.go +++ b/ethlog/loggers.go @@ -97,7 +97,6 @@ func Reset() { } <-status } - logSystems = nil } // waits until log messages are drained (dispatched to log writers) @@ -116,6 +115,7 @@ func NewLogger(tag string) *Logger { } func AddLogSystem(logSystem LogSystem) { + var mutex = &sync.Mutex{} mutex.Lock() defer mutex.Unlock() if logSystems == nil { @@ -128,14 +128,16 @@ func AddLogSystem(logSystem LogSystem) { } func (logger *Logger) sendln(level LogLevel, v ...interface{}) { - if logSystems != nil { - send(newPrintlnLogMessage(level, logger.tag, v...)) + if logMessages != nil { + msg := newPrintlnLogMessage(level, logger.tag, v...) + logMessages <- msg } } func (logger *Logger) sendf(level LogLevel, format string, v ...interface{}) { - if logSystems != nil { - send(newPrintfLogMessage(level, logger.tag, format, v...)) + if logMessages != nil { + msg := newPrintfLogMessage(level, logger.tag, format, v...) + logMessages <- msg } } |