aboutsummaryrefslogtreecommitdiffstats
path: root/logger/loggers_test.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-21 17:20:47 +0800
committerzelig <viktor.tron@gmail.com>2015-03-22 10:16:54 +0800
commit78cff9e3a4c71d003c5ab3f5747ccae1dbc959fe (patch)
tree0bdc1bb55b9bd73730f9de658e1d87273482761a /logger/loggers_test.go
parent7f85608f30a2e34005c8d15566849229c758c2f1 (diff)
downloaddexon-78cff9e3a4c71d003c5ab3f5747ccae1dbc959fe.tar
dexon-78cff9e3a4c71d003c5ab3f5747ccae1dbc959fe.tar.gz
dexon-78cff9e3a4c71d003c5ab3f5747ccae1dbc959fe.tar.bz2
dexon-78cff9e3a4c71d003c5ab3f5747ccae1dbc959fe.tar.lz
dexon-78cff9e3a4c71d003c5ab3f5747ccae1dbc959fe.tar.xz
dexon-78cff9e3a4c71d003c5ab3f5747ccae1dbc959fe.tar.zst
dexon-78cff9e3a4c71d003c5ab3f5747ccae1dbc959fe.zip
independent flag for json structured logging
- logjson flag remove logformat flag - passed to eth Config - logsystem not a field of Ethereum - LogSystem does not need to expose GetLogLevel/SetLogLevel - message struct just implements more generic LogMsg interface - LogMsg is a fmt.Stringer with Level() - jsonMsg ([]byte) implements LogMsg - remove "raw" systems - move level logic inside StdLogSystem - logsystems only print their kind of msg: jsonLogSystem prints jsonMsg, StdLogSystem prints stdMsg
Diffstat (limited to 'logger/loggers_test.go')
-rw-r--r--logger/loggers_test.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/logger/loggers_test.go b/logger/loggers_test.go
index adc4df016..276b65b78 100644
--- a/logger/loggers_test.go
+++ b/logger/loggers_test.go
@@ -15,9 +15,11 @@ type TestLogSystem struct {
level LogLevel
}
-func (ls *TestLogSystem) LogPrint(level LogLevel, msg string) {
+func (ls *TestLogSystem) LogPrint(msg LogMsg) {
ls.mutex.Lock()
- ls.output += msg
+ if ls.level >= msg.Level() {
+ ls.output += msg.String()
+ }
ls.mutex.Unlock()
}
@@ -47,9 +49,9 @@ type blockedLogSystem struct {
unblock chan struct{}
}
-func (ls blockedLogSystem) LogPrint(level LogLevel, msg string) {
+func (ls blockedLogSystem) LogPrint(msg LogMsg) {
<-ls.unblock
- ls.LogSystem.LogPrint(level, msg)
+ ls.LogSystem.LogPrint(msg)
}
func TestLoggerFlush(t *testing.T) {