From d0992649ed647f638796a4bc14769f3fbe107705 Mon Sep 17 00:00:00 2001 From: bd21 Date: Mon, 9 Oct 2023 22:41:20 -0700 Subject: [PATCH] improve logging --- cmd/noble/listener.go | 9 ++------- cmd/process.go | 2 +- cmd/root.go | 3 ++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cmd/noble/listener.go b/cmd/noble/listener.go index d148b2a..13c9efd 100644 --- a/cmd/noble/listener.go +++ b/cmd/noble/listener.go @@ -16,10 +16,7 @@ import ( func StartListener(cfg config.Config, logger log.Logger, processingQueue chan *types.MessageState) { // set up client - logger.Info(fmt.Sprintf( - "Starting Noble listener at block %d looking back %d blocks", - cfg.Networks.Source.Noble.StartBlock, - cfg.Networks.Source.Noble.LookbackPeriod)) + logger.Info(fmt.Sprintf("Starting Noble listener at block %d", cfg.Networks.Source.Noble.StartBlock)) var wg sync.WaitGroup wg.Add(1) @@ -31,7 +28,6 @@ func StartListener(cfg config.Config, logger log.Logger, processingQueue chan *t // history for currentBlock <= chainTip { - fmt.Println(fmt.Sprintf("1 added block to queue: %d", currentBlock)) blockQueue <- currentBlock currentBlock++ } @@ -42,7 +38,6 @@ func StartListener(cfg config.Config, logger log.Logger, processingQueue chan *t chainTip = GetNobleChainTip(cfg) if chainTip >= currentBlock { for i := currentBlock; i <= chainTip; i++ { - fmt.Println(fmt.Sprintf("2 added block to queue: %d", i)) blockQueue <- i } currentBlock = chainTip + 1 @@ -85,9 +80,9 @@ func StartListener(cfg config.Config, logger log.Logger, processingQueue chan *t for _, tx := range response.Result.Txs { parsedMsg, err := types.NobleLogToMessageState(tx) if err != nil { - logger.Debug("unable to parse Noble log into MessageState, skipping") continue } + logger.Info(fmt.Sprintf("New stream msg from %d with tx hash %s", parsedMsg.SourceDomain, parsedMsg.SourceTxHash)) processingQueue <- parsedMsg } } diff --git a/cmd/process.go b/cmd/process.go index 2e61365..17ef6f6 100644 --- a/cmd/process.go +++ b/cmd/process.go @@ -140,7 +140,7 @@ func StartProcessor(cfg config.Config, logger log.Logger, processingQueue chan * continue } msg.DestTxHash = response.To().Hex() - logger.Info(fmt.Sprintf("Successfully broadcast %s to Ethereum: %s", msg.SourceTxHash, msg.DestTxHash)) + logger.Info(fmt.Sprintf("Successfully broadcast %s to Ethereum. Tx hash: %s", msg.SourceTxHash, msg.DestTxHash)) case 4: // noble response, err := noble.Broadcast(cfg, logger, msg, sequenceMap) if err != nil { diff --git a/cmd/root.go b/cmd/root.go index 96c2712..960fdee 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -68,6 +68,7 @@ func init() { os.Exit(1) } minter.MinterAddress = address + Cfg.Networks.Minters[0] = minter case 4: keyBz, err := hex.DecodeString(minter.MinterPrivateKey) if err != nil { @@ -81,8 +82,8 @@ func init() { os.Exit(1) } minter.MinterAddress = address + Cfg.Networks.Minters[4] = minter } - } // Set default listener blocks