Skip to content

Commit

Permalink
improving logs
Browse files Browse the repository at this point in the history
  • Loading branch information
srene committed May 16, 2024
1 parent 36c45d0 commit 068f5dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions block/produce.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

// ProduceBlockLoop is calling publishBlock in a loop as long as we're synced.
func (m *Manager) ProduceBlockLoop(ctx context.Context) {
m.logger.Debug("Started produce loop")
m.logger.Info("Started block producer loop.")

ticker := time.NewTicker(m.Conf.BlockTime)
defer ticker.Stop()
Expand All @@ -37,18 +37,18 @@ func (m *Manager) ProduceBlockLoop(ctx context.Context) {

block, commit, err := m.ProduceAndGossipBlock(ctx, produceEmptyBlock)
if errors.Is(err, context.Canceled) {
m.logger.Error("produce and gossip: context canceled", "error", err)
m.logger.Error("Produce and gossip: context canceled.", "error", err)
return
}
if errors.Is(err, types.ErrSkippedEmptyBlock) {
continue
}
if errors.Is(err, ErrNonRecoverable) {
m.logger.Error("produce and gossip: non-recoverable", "error", err) // TODO: flush? or don't log at all?
m.logger.Error("Produce and gossip: non-recoverable.", "error", err) // TODO: flush? or don't log at all?
panic(fmt.Errorf("produce and gossip block: %w", err))
}
if err != nil {
m.logger.Error("produce and gossip: uncategorized, assuming recoverable", "error", err)
m.logger.Error("Produce and gossip: uncategorized, assuming recoverable.", "error", err)
continue
}

Expand All @@ -59,7 +59,7 @@ func (m *Manager) ProduceBlockLoop(ctx context.Context) {
if 0 < len(block.Data.Txs) {
nextEmptyBlock = time.Now().Add(m.Conf.MaxProofTime)
} else {
m.logger.Info("produced empty block")
m.logger.Info("Produced empty block.")
}

// Send the size to the accumulated size channel
Expand Down Expand Up @@ -122,7 +122,7 @@ func (m *Manager) produceBlock(allowEmpty bool) (*types.Block, *types.Commit, er
if err != nil {
return nil, nil, fmt.Errorf("load commit after load block: height: %d: %w: %w", newHeight, err, ErrNonRecoverable)
}
m.logger.Info("using pending block", "height", newHeight)
m.logger.Info("Using pending block.", "height", newHeight)
} else if !errors.Is(err, store.ErrKeyNotFound) {
return nil, nil, fmt.Errorf("load block: height: %d: %w: %w", newHeight, err, ErrNonRecoverable)
} else {
Expand Down Expand Up @@ -163,7 +163,7 @@ func (m *Manager) produceBlock(allowEmpty bool) (*types.Block, *types.Commit, er
return nil, nil, fmt.Errorf("apply block: %w: %w", err, ErrNonRecoverable)
}

m.logger.Info("block created", "height", newHeight, "num_tx", len(block.Data.Txs))
m.logger.Info("Block created.", "height", newHeight, "num_tx", len(block.Data.Txs))
types.RollappBlockSizeBytesGauge.Set(float64(len(block.Data.Txs)))
types.RollappBlockSizeTxsGauge.Set(float64(len(block.Data.Txs)))
types.RollappHeightGauge.Set(float64(newHeight))
Expand Down
4 changes: 2 additions & 2 deletions block/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (m *Manager) HandleSubmissionTrigger() error {
}

resultSubmitToDA := m.DAClient.SubmitBatch(nextBatch)
m.logger.Info("batch submitted to DA", "start height", nextBatch.StartHeight, "end height", nextBatch.EndHeight)
m.logger.Info("Submitted batch to DA", "start height", nextBatch.StartHeight, "end height", nextBatch.EndHeight)
if resultSubmitToDA.Code != da.StatusSuccess {
return fmt.Errorf("submit next batch to da: %s", resultSubmitToDA.Message)
}
Expand All @@ -135,7 +135,7 @@ func (m *Manager) HandleSubmissionTrigger() error {
if err != nil {
return fmt.Errorf("sl client submit batch: start height: %d: inclusive end height: %d: %w", startHeight, actualEndHeight, err)
}
m.logger.Info("batch submitted to SL", "start height", resultSubmitToDA, "end height", nextBatch.EndHeight)
m.logger.Info("Submitted batch to SL.", "start height", resultSubmitToDA, "end height", nextBatch.EndHeight)

m.UpdateSyncParams(actualEndHeight)
return nil
Expand Down

0 comments on commit 068f5dc

Please sign in to comment.