From a0f550b922b692ca40febd89560f44701e2869db Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Tue, 8 Jan 2019 15:36:33 -0800 Subject: [PATCH] start using logging singleton --- api/services/explorer/service.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/services/explorer/service.go b/api/services/explorer/service.go index 6d814e27b..d7b30a942 100644 --- a/api/services/explorer/service.go +++ b/api/services/explorer/service.go @@ -12,6 +12,7 @@ import ( "github.com/ethereum/go-ethereum/rlp" "github.com/gorilla/mux" "github.com/harmony-one/harmony/core/types" + "github.com/harmony-one/harmony/internal/utils" ) // Constants for explorer service. @@ -32,7 +33,7 @@ func GetExplorerPort(nodePort string) string { if port, err := strconv.Atoi(nodePort); err == nil { return fmt.Sprintf("%d", port-explorerPortDifference) } - Log.Error("error on parsing.") + utils.GetLogInstance().Error("error on parsing.") return "" } @@ -60,7 +61,7 @@ func (s *Service) Run() { s.router.Path("/address").HandlerFunc(s.GetExplorerAddress) // Do serving now. - fmt.Println("Listening to:", GetExplorerPort(s.Port)) + utils.GetLogInstance().Info("Listening to ", "port: ", GetExplorerPort(s.Port)) log.Fatal(http.ListenAndServe(addr, s.router)) } @@ -80,7 +81,8 @@ func (s *Service) GetAccountBlocks(from, to int) []*types.Block { } block := new(types.Block) if rlp.DecodeBytes(data, block) != nil { - Log.Error("Error on getting from db") + + utils.GetLogInstance().Error("Error on getting from db") os.Exit(1) } blocks = append(blocks, block)