diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-01-05 00:16:15 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-01-05 00:16:15 +0800 |
commit | 65f14ef166d7fd3ea30f50366d55777b54fe305f (patch) | |
tree | 6de40faba33caecc38171377a9ca8d4834562f5b /common/logger.go | |
parent | c7fdbd64be6228aa87b14f8953311c88cc14b4ff (diff) | |
download | dexon-consensus-65f14ef166d7fd3ea30f50366d55777b54fe305f.tar dexon-consensus-65f14ef166d7fd3ea30f50366d55777b54fe305f.tar.gz dexon-consensus-65f14ef166d7fd3ea30f50366d55777b54fe305f.tar.bz2 dexon-consensus-65f14ef166d7fd3ea30f50366d55777b54fe305f.tar.lz dexon-consensus-65f14ef166d7fd3ea30f50366d55777b54fe305f.tar.xz dexon-consensus-65f14ef166d7fd3ea30f50366d55777b54fe305f.tar.zst dexon-consensus-65f14ef166d7fd3ea30f50366d55777b54fe305f.zip |
core: fix stuffs (#401)
* Remove block recycling mechanism
* Return directly when previous DKG is not finished.
* Adjust some logging level
* Skip pulling when hashes to pull is empty
Diffstat (limited to 'common/logger.go')
-rw-r--r-- | common/logger.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/common/logger.go b/common/logger.go index 29eac35..3328e93 100644 --- a/common/logger.go +++ b/common/logger.go @@ -29,6 +29,7 @@ import "log" // }) type Logger interface { // Info logs info level logs. + Trace(msg string, ctx ...interface{}) Debug(msg string, ctx ...interface{}) Info(msg string, ctx ...interface{}) Warn(msg string, ctx ...interface{}) @@ -38,6 +39,10 @@ type Logger interface { // NullLogger logs nothing. type NullLogger struct{} +// Trace implements Logger interface. +func (logger *NullLogger) Trace(msg string, ctx ...interface{}) { +} + // Debug implements Logger interface. func (logger *NullLogger) Debug(msg string, ctx ...interface{}) { } @@ -66,6 +71,11 @@ func composeVargs(msg string, ctxs []interface{}) []interface{} { return args } +// Trace implements Logger interface. +func (logger *SimpleLogger) Trace(msg string, ctx ...interface{}) { + log.Println(composeVargs(msg, ctx)...) +} + // Debug implements Logger interface. func (logger *SimpleLogger) Debug(msg string, ctx ...interface{}) { log.Println(composeVargs(msg, ctx)...) @@ -98,6 +108,11 @@ func NewCustomLogger(logger *log.Logger) *CustomLogger { } } +// Trace implements Logger interface. +func (logger *CustomLogger) Trace(msg string, ctx ...interface{}) { + logger.logger.Println(composeVargs(msg, ctx)...) +} + // Debug implements Logger interface. func (logger *CustomLogger) Debug(msg string, ctx ...interface{}) { logger.logger.Println(composeVargs(msg, ctx)...) |