Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions block/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ func (m *Manager) publishBlockInternal(ctx context.Context) error {
m.logger.Info("no batch retrieved from sequencer, skipping block production")
return nil
}
m.logger.Debug("creating empty block, height: ", newHeight)
m.logger.Info("creating empty block, height: ", newHeight)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with other log statements in this file and for better machine-readability, it's best to use structured logging with key-value pairs instead of concatenating values into the message string.

Suggested change
m.logger.Info("creating empty block, height: ", newHeight)
m.logger.Info("creating empty block", "height", newHeight)

} else {
m.logger.Warn("failed to get transactions from batch", "error", err)
return nil
Expand All @@ -665,8 +665,7 @@ func (m *Manager) publishBlockInternal(ctx context.Context) error {
if batchData.Before(lastHeaderTime) {
return fmt.Errorf("timestamp is not monotonically increasing: %s < %s", batchData.Time, m.getLastBlockTime())
}
m.logger.Info("creating and publishing block", "height", newHeight)
m.logger.Debug("block info", "num_tx", len(batchData.Transactions))
m.logger.Info("creating and publishing block", "height", newHeight, "num_tx", len(batchData.Transactions))
}

header, data, err = m.createBlock(ctx, newHeight, lastSignature, lastHeaderHash, batchData)
Expand Down
2 changes: 1 addition & 1 deletion block/submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func submitToDA[T any](
// Record successful DA submission
m.recordDAMetrics("submission", DAModeSuccess)

m.logger.Info(fmt.Sprintf("successfully submitted %s to DA layer", itemType), "gasPrice", gasPrice, "count", res.SubmittedCount)
m.logger.Info(fmt.Sprintf("successfully submitted %s to DA layer with gasPrice %v and count %d", itemType, gasPrice, res.SubmittedCount))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change moves away from structured logging by formatting all values into the message string. Structured logging with key-value pairs is generally preferred as it makes logs easier to parse, query, and analyze automatically. The previous implementation was better in this regard.

To maintain structured logging and improve consistency, consider using a static message and passing all dynamic values as key-value pairs.

Suggested change
m.logger.Info(fmt.Sprintf("successfully submitted %s to DA layer with gasPrice %v and count %d", itemType, gasPrice, res.SubmittedCount))
m.logger.Info("successfully submitted to DA layer", "itemType", itemType, "gasPrice", gasPrice, "count", res.SubmittedCount)

if res.SubmittedCount == uint64(remLen) {
submittedAll = true
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/cmd/run_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ func SetupLogger(config rollconf.LogConfig) logging.EventLogger {

logging.SetupLogging(logCfg)

// Suppress noisy external component logs by default, unless debug logging is enabled
if logCfg.Level != logging.LevelDebug {
_ = logging.SetLogLevel("header/store", "FATAL")
_ = logging.SetLogLevel("header/sync", "FATAL")
_ = logging.SetLogLevel("header/p2p", "FATAL")
}

// Return a logger instance for the "main" subsystem
return logging.Logger("main")
}
Expand Down
Loading