diff options
author | zelig <viktor.tron@gmail.com> | 2015-03-21 17:20:47 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-03-22 10:16:54 +0800 |
commit | 78cff9e3a4c71d003c5ab3f5747ccae1dbc959fe (patch) | |
tree | 0bdc1bb55b9bd73730f9de658e1d87273482761a /logger/loggers.go | |
parent | 7f85608f30a2e34005c8d15566849229c758c2f1 (diff) | |
download | dexon-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.go')
-rw-r--r-- | logger/loggers.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/logger/loggers.go b/logger/loggers.go index 25263853a..42c8cbc07 100644 --- a/logger/loggers.go +++ b/logger/loggers.go @@ -28,7 +28,6 @@ const ( InfoLevel DebugLevel DebugDetailLevel - JsonLevel = 1000 ) // A Logger prints messages prefixed by a given tag. It provides named @@ -43,11 +42,11 @@ func NewLogger(tag string) *Logger { } func (logger *Logger) Sendln(level LogLevel, v ...interface{}) { - logMessageC <- message{level, logger.tag + fmt.Sprintln(v...)} + logMessageC <- stdMsg{level, logger.tag + fmt.Sprintln(v...)} } func (logger *Logger) Sendf(level LogLevel, format string, v ...interface{}) { - logMessageC <- message{level, logger.tag + fmt.Sprintf(format, v...)} + logMessageC <- stdMsg{level, logger.tag + fmt.Sprintf(format, v...)} } // Errorln writes a message with ErrorLevel. @@ -129,6 +128,6 @@ func (logger *JsonLogger) LogJson(v JsonLog) { } jsontxt, _ := json.Marshal(obj) - logMessageC <- message{JsonLevel, string(jsontxt)} + logMessageC <- (jsonMsg(jsontxt)) } |