Skip to content

Replace all loggers with package level slog - #3050

Merged
masih merged 19 commits into
mainfrom
masih/slog-stage-3
Mar 12, 2026
Merged

masih merged 19 commits into
mainfrom
masih/slog-stage-3

Conversation

@masih

@masih masih commented Mar 11, 2026 •

Copy link
Copy Markdown
Collaborator

Remove all references of per struct logger instantiation, in favour of singular package level loggers.

Remove now redundant logger interfaces and utilities across modules.

Breaking changes to logging configuration:

--log-format flag is deprecated. Log format is now configured exclusively via the SEI_LOG_FORMAT environment variable (values: "json", "text"). seilog captures the format once at process startup and shares a single handler across all loggers, avoiding an allocation per logger instantiation. Changing format at runtime is not supported by design.

--log-level flag still works but its priority has changed. The resolution order is now:

  1. --log-level CLI flag (highest)
  2. SEI_LOG_LEVEL env var
  3. config.toml log_level setting (lowest)

Per-module level syntax ("consensus:debug,*:info") is no longer accepted by the CLI flag or env var; use seilog.SetLevel() with glob patterns ("tendermint/internal/consensus") instead. A follow up PR will introduce log level change at runtime via seid cli command.

masih added 3 commits March 11, 2026 10:48
Remove all references of per struct logger instantiation, in favour of
singual package level loggers.

Remove now redundant logger interfaces and utilities across modules.
# Conflicts:
#	sei-cosmos/storev2/rootmulti/store.go
#	sei-db/state_db/bench/wrappers/db_implementations.go
#	sei-db/state_db/sc/composite/store_test.go
#	sei-db/state_db/sc/flatkv/lthash_correctness_test.go
#	sei-db/state_db/sc/flatkv/snapshot.go
#	sei-db/state_db/sc/flatkv/snapshot_test.go
#	sei-db/state_db/sc/flatkv/store.go
#	sei-db/state_db/sc/flatkv/store_test.go
#	sei-db/state_db/sc/flatkv/store_write_test.go
@github-actions

github-actions Bot commented Mar 11, 2026 •

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMar 12, 2026, 11:28 AM

@codecov

codecov Bot commented Mar 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.58113% with 386 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.61%. Comparing base (bea6373) to head (ac4f05b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sei-tendermint/internal/consensus/state.go 58.90% 30 Missing ⚠️
sei-db/state_db/sc/memiavl/snapshot.go 35.89% 25 Missing ⚠️
app/benchmark/generator.go 27.58% 21 Missing ⚠️
app/app.go 33.33% 20 Missing ⚠️
sei-cosmos/baseapp/abci.go 29.62% 19 Missing ⚠️
sei-cosmos/server/start.go 0.00% 19 Missing ⚠️
sei-db/state_db/sc/memiavl/db.go 60.86% 18 Missing ⚠️
sei-tendermint/internal/evidence/pool.go 40.00% 18 Missing ⚠️
sei-tendermint/internal/blocksync/reactor.go 44.44% 15 Missing ⚠️
sei-tendermint/internal/mempool/mempool.go 50.00% 11 Missing ⚠️
... and 78 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3050      +/-   ##
==========================================
+ Coverage   58.33%   58.61%   +0.28%     
==========================================
  Files        2079     2079              
  Lines      171899   175308    +3409     
==========================================
+ Hits       100270   102755    +2485     
- Misses      62678    63508     +830     
- Partials     8951     9045      +94     
Flag Coverage Δ
sei-chain-pr 65.49% <55.52%> (?)
sei-db 70.41% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
app/apptesting/test_suite.go 25.84% <100.00%> (-0.83%) ⬇️
app/benchmark/benchmark.go 60.00% <100.00%> (ø)
app/benchmark/logger.go 93.27% <100.00%> (-0.06%) ⬇️
app/test_helpers.go 62.00% <100.00%> (-0.15%) ⬇️
app/upgrades/fork_manager.go 94.87% <100.00%> (-0.13%) ⬇️
cmd/seid/cmd/blocktest.go 0.00% <ø> (ø)
cmd/seid/cmd/snapshot.go 0.00% <ø> (ø)
evmrpc/info.go 76.95% <100.00%> (ø)
evmrpc/server.go 91.50% <100.00%> (-0.05%) ⬇️
evmrpc/stats/tracker.go 91.36% <100.00%> (ø)
... and 165 more

... and 95 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread sei-tendermint/internal/consensus/state.go Dismissed
Comment thread sei-db/state_db/sc/memiavl/db.go Dismissed
Comment thread sei-tendermint/test/e2e/node/main.go Dismissed
@masih
masih marked this pull request as ready for review March 11, 2026 12:53
@masih
masih added this pull request to the merge queue Mar 12, 2026
Merged via the queue into main with commit 8724492 Mar 12, 2026
38 checks passed
@masih
masih deleted the masih/slog-stage-3 branch March 12, 2026 12:21
blindchaser added a commit that referenced this pull request Mar 13, 2026
This commit was inadvertently reverted by the squash-merge of #3039.
Restores the tx ordering check (firstCosmosSeen), len(evmEntries)>0
and len(v2Entries)>0 guards in ProcessTXsWithOCCGiga.

Conflicts with #3050's slog migration resolved by using package-level
logger instead of ctx.Logger().

Made-with: Cursor
blindchaser added a commit that referenced this pull request Mar 13, 2026
This commit was inadvertently reverted by the squash-merge of #3039.
Restores ReceiptStoreConfig in app.toml, readReceiptStoreConfig(),
BackendTypeName(), receipt config tests, and init_test.go.

Conflicts resolved:
- app_config.go: kept both ReceiptStore (from #3035) and Admin (from #3062)
- receipt_store.go: kept BackendTypeName but used #3050's slog convention
- parquet_store_test.go: kept #3053's deterministic pruning test fix

Made-with: Cursor
blindchaser added a commit that referenced this pull request Mar 13, 2026
This commit was inadvertently reverted by the squash-merge of #3039.
Restores the benchmark config changes (BlocksPerCommit=1,
SnapshotInterval=1000, SnapshotMinTimeInterval=60).

The consoleLogger addition from #3046 is dropped because #3050
replaced the logger package with slog, making it unnecessary.

Made-with: Cursor
blindchaser added a commit that referenced this pull request Mar 13, 2026
The cherry-picked tests from #3035 and #3043 still referenced the
old logger package (removed by #3050 slog migration). Fix:
- composite/store_test.go: remove logger import/arg, add CommittedRootHash to mock
- parquet/store_config_test.go: remove dbLogger arg from NewStore
- receipt/parquet_store_test.go: remove dbLogger arg from NewReceiptStore

Made-with: Cursor
github-merge-queue Bot pushed a commit that referenced this pull request Mar 13, 2026
## Summary

The squash-merge of #3039 (`feat(flatkv): add read-only LoadVersion for
state sync`) inadvertently reverted changes from 5 previously-merged
PRs. The `yiren/flatkv-readonly` branch had accumulated stale versions
of files through merge-from-main commits, and when the final
squash-merge landed, those stale versions overwrote the newer code on
`main`.

### PRs reverted by #3039 and restored in this PR

| PR | Title | Key changes lost |
|---|---|---|
| **#2810** | fix(giga): check whether txs follow Giga ordering |
`firstCosmosSeen` tx ordering check, `len(evmEntries) > 0` /
`len(v2Entries) > 0` guards in `ProcessTXsWithOCCGiga` |
| **#3035** | Add receiptdb config option in app.toml |
`ReceiptStoreConfig` in app.toml, `readReceiptStoreConfig()`,
`BackendTypeName()`, receipt config tests |
| **#3043** | Add config to enable lattice hash | `EnableLatticeHash`
config, composite store lattice hash support |
| **#3021** | Background Transaction Generation | `block.go`,
`block_builder.go` for cryptosim benchmark |
| **#3046** | Add console logger and fix memiavl config for benchmark |
`BlocksPerCommit=1`, `SnapshotInterval=1000`,
`SnapshotMinTimeInterval=60` |

### Conflict resolutions

Since several PRs landed after #3039 (notably #3050 slog migration,
#3053 flaky test fix, #3062 admin service), cherry-picks required manual
conflict resolution:

- **`app/app.go`** (#2810): Kept #2810's structural changes, used
`logger.Error` (from #3050) instead of `ctx.Logger().Error`
- **`cmd/seid/cmd/app_config.go`** (#3035): Kept both `ReceiptStore`
(from #3035) and `Admin` (from #3062)
- **`sei-db/ledger_db/receipt/receipt_store.go`** (#3035): Restored
`BackendTypeName` but dropped logger param (superseded by #3050 slog)
- **`sei-db/ledger_db/receipt/parquet_store_test.go`** (#3035): Kept
#3053's deterministic pruning test fix
- **`sei-db/state_db/sc/composite/store_test.go`** (#3043): Merged all
three needed imports
- **`sei-db/common/logger/logger.go`** (#3046): Kept deletion from
#3050; `consoleLogger` is no longer needed with slog
- **`sei-db/state_db/bench/wrappers/db_implementations.go`** (#3046):
Kept #3050's no-logger-param API

---------

Signed-off-by: Cody Littley <cody.littley@seinetwork.io>
Co-authored-by: Cody Littley <56973212+cody-littley@users.noreply.github.com>
Co-authored-by: Cody Littley <cody.littley@seinetwork.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants