aboutsummaryrefslogtreecommitdiffstats
path: root/core/types/position.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-10-19 18:39:17 +0800
committerGitHub <noreply@github.com>2018-10-19 18:39:17 +0800
commit1f7491df37caf974ffa0c824c4c02a8fe2aafcd9 (patch)
tree55c6e653c3d78ab34e3fbe8627ba1c0a62cb53a8 /core/types/position.go
parentbec97aadfa95ebb42ef042bd53c7976ae410c496 (diff)
downloaddexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar.gz
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar.bz2
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar.lz
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar.xz
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar.zst
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.zip
core: initial commit for logger (#228)
* Replace "log.*" with logger. * Add simple logger to log with log package. * Add debug logs to all calls to these interfaces: - core.Application - core.Governance - core.Network * Add Stringer to these types: - types.DKGComplaint - types.AgreementResult - types.DKGMasterPublicKey - types.DKGFinalize
Diffstat (limited to 'core/types/position.go')
-rw-r--r--core/types/position.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/types/position.go b/core/types/position.go
index 4e254ba..51de405 100644
--- a/core/types/position.go
+++ b/core/types/position.go
@@ -17,7 +17,10 @@
package types
-import "errors"
+import (
+ "errors"
+ "fmt"
+)
// ErrComparePositionOnDifferentChains raised when attempting to
// compare two positions with different chain ID.
@@ -31,6 +34,10 @@ type Position struct {
Height uint64 `json:"height"`
}
+func (pos *Position) String() string {
+ return fmt.Sprintf("pos[%d:%d:%d]", pos.ChainID, pos.Round, pos.Height)
+}
+
// Equal checks if two positions are equal, it panics when their chainIDs
// are different.
func (pos *Position) Equal(other *Position) bool {