From cdc86965cb38335b97d0bef337e0a53ed7c7f7e3 Mon Sep 17 00:00:00 2001 From: zelig Date: Wed, 25 Feb 2015 20:04:51 +0700 Subject: export Sendln/Sendf in logger --- logger/loggers.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'logger') diff --git a/logger/loggers.go b/logger/loggers.go index 147b2b85f..25263853a 100644 --- a/logger/loggers.go +++ b/logger/loggers.go @@ -42,74 +42,74 @@ func NewLogger(tag string) *Logger { return &Logger{"[" + tag + "] "} } -func (logger *Logger) sendln(level LogLevel, v ...interface{}) { +func (logger *Logger) Sendln(level LogLevel, v ...interface{}) { logMessageC <- message{level, logger.tag + fmt.Sprintln(v...)} } -func (logger *Logger) sendf(level LogLevel, format string, v ...interface{}) { +func (logger *Logger) Sendf(level LogLevel, format string, v ...interface{}) { logMessageC <- message{level, logger.tag + fmt.Sprintf(format, v...)} } // Errorln writes a message with ErrorLevel. func (logger *Logger) Errorln(v ...interface{}) { - logger.sendln(ErrorLevel, v...) + logger.Sendln(ErrorLevel, v...) } // Warnln writes a message with WarnLevel. func (logger *Logger) Warnln(v ...interface{}) { - logger.sendln(WarnLevel, v...) + logger.Sendln(WarnLevel, v...) } // Infoln writes a message with InfoLevel. func (logger *Logger) Infoln(v ...interface{}) { - logger.sendln(InfoLevel, v...) + logger.Sendln(InfoLevel, v...) } // Debugln writes a message with DebugLevel. func (logger *Logger) Debugln(v ...interface{}) { - logger.sendln(DebugLevel, v...) + logger.Sendln(DebugLevel, v...) } // DebugDetailln writes a message with DebugDetailLevel. func (logger *Logger) DebugDetailln(v ...interface{}) { - logger.sendln(DebugDetailLevel, v...) + logger.Sendln(DebugDetailLevel, v...) } // Errorf writes a message with ErrorLevel. func (logger *Logger) Errorf(format string, v ...interface{}) { - logger.sendf(ErrorLevel, format, v...) + logger.Sendf(ErrorLevel, format, v...) } // Warnf writes a message with WarnLevel. func (logger *Logger) Warnf(format string, v ...interface{}) { - logger.sendf(WarnLevel, format, v...) + logger.Sendf(WarnLevel, format, v...) } // Infof writes a message with InfoLevel. func (logger *Logger) Infof(format string, v ...interface{}) { - logger.sendf(InfoLevel, format, v...) + logger.Sendf(InfoLevel, format, v...) } // Debugf writes a message with DebugLevel. func (logger *Logger) Debugf(format string, v ...interface{}) { - logger.sendf(DebugLevel, format, v...) + logger.Sendf(DebugLevel, format, v...) } // DebugDetailf writes a message with DebugDetailLevel. func (logger *Logger) DebugDetailf(format string, v ...interface{}) { - logger.sendf(DebugDetailLevel, format, v...) + logger.Sendf(DebugDetailLevel, format, v...) } // Fatalln writes a message with ErrorLevel and exits the program. func (logger *Logger) Fatalln(v ...interface{}) { - logger.sendln(ErrorLevel, v...) + logger.Sendln(ErrorLevel, v...) Flush() os.Exit(0) } // Fatalf writes a message with ErrorLevel and exits the program. func (logger *Logger) Fatalf(format string, v ...interface{}) { - logger.sendf(ErrorLevel, format, v...) + logger.Sendf(ErrorLevel, format, v...) Flush() os.Exit(0) } -- cgit v1.2.3 From 60a2704b049a2bc8de417c8f50155ec69b071a9e Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 1 Mar 2015 16:09:59 +0100 Subject: Implement eth.miner.new_block event --- logger/types.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'logger') diff --git a/logger/types.go b/logger/types.go index 7ab4a2b8c..86408620e 100644 --- a/logger/types.go +++ b/logger/types.go @@ -1,6 +1,7 @@ package logger import ( + "math/big" "time" ) @@ -53,10 +54,10 @@ func (l *P2PDisconnected) EventName() string { } type EthMinerNewBlock struct { - BlockHash string `json:"block_hash"` - BlockNumber int `json:"block_number"` - ChainHeadHash string `json:"chain_head_hash"` - BlockPrevHash string `json:"block_prev_hash"` + BlockHash string `json:"block_hash"` + BlockNumber *big.Int `json:"block_number"` + ChainHeadHash string `json:"chain_head_hash"` + BlockPrevHash string `json:"block_prev_hash"` LogEvent } -- cgit v1.2.3 From 76af536d0d16e3f0742a46d448b3e0dcb46458f6 Mon Sep 17 00:00:00 2001 From: zelig Date: Tue, 3 Mar 2015 15:37:20 +0700 Subject: block number is *big.Int, remoteID is string --- logger/types.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'logger') diff --git a/logger/types.go b/logger/types.go index 86408620e..d98f0874a 100644 --- a/logger/types.go +++ b/logger/types.go @@ -66,11 +66,11 @@ func (l *EthMinerNewBlock) EventName() string { } type EthChainReceivedNewBlock struct { - BlockHash string `json:"block_hash"` - BlockNumber int `json:"block_number"` - ChainHeadHash string `json:"chain_head_hash"` - BlockPrevHash string `json:"block_prev_hash"` - RemoteId int `json:"remote_id"` + BlockHash string `json:"block_hash"` + BlockNumber *big.Int `json:"block_number"` + ChainHeadHash string `json:"chain_head_hash"` + BlockPrevHash string `json:"block_prev_hash"` + RemoteId string `json:"remote_id"` LogEvent } @@ -79,10 +79,10 @@ func (l *EthChainReceivedNewBlock) EventName() string { } type EthChainNewHead struct { - BlockHash string `json:"block_hash"` - BlockNumber int `json:"block_number"` - ChainHeadHash string `json:"chain_head_hash"` - BlockPrevHash string `json:"block_prev_hash"` + BlockHash string `json:"block_hash"` + BlockNumber *big.Int `json:"block_number"` + ChainHeadHash string `json:"chain_head_hash"` + BlockPrevHash string `json:"block_prev_hash"` LogEvent } -- cgit v1.2.3