diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff9f72c16038..b953a65ac1f7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -855,7 +855,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.21" check-latest: true cache: true cache-dependency-path: log/go.sum diff --git a/log/CHANGELOG.md b/log/CHANGELOG.md index f3ddac1f50b8..533ee90be555 100644 --- a/log/CHANGELOG.md +++ b/log/CHANGELOG.md @@ -22,10 +22,11 @@ Each entry must include the Github issue reference in the following format: ## [Unreleased] -### Improvements +## [v1.5.0](https://github.com/cosmos/cosmos-sdk/releases/tag/log/v1.4.1) - 2024-11-07 -* [#22233](https://github.com/cosmos/cosmos-sdk/pull/22233) Use sonic json library for faster json handling -* [#22347](https://github.com/cosmos/cosmos-sdk/pull/22347) Add cosmossdk.io/log/slog to allow using a standard library log/slog-backed logger. +* [#22466](https://github.com/cosmos/cosmos-sdk/pull/22466) Disable coloring in testing logger. +* [#22233](https://github.com/cosmos/cosmos-sdk/pull/22233) Use sonic json library for faster json handling. +* [#22347](https://github.com/cosmos/cosmos-sdk/pull/22347) Add `cosmossdk.io/log/slog` to allow using a standard library log/slog-backed logger. This required to bump the minimum go version of `cosmossdk.io/log` to 1.21. ## [v1.4.1](https://github.com/cosmos/cosmos-sdk/releases/tag/log/v1.4.1) - 2024-08-16 diff --git a/log/go.mod b/log/go.mod index 292e5d973e6f..abaf6ec03577 100644 --- a/log/go.mod +++ b/log/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/log -go 1.20 +go 1.21 require ( github.com/bytedance/sonic v1.12.3 diff --git a/log/testing.go b/log/testing.go index f31f6e5182f4..0e82eced62ba 100644 --- a/log/testing.go +++ b/log/testing.go @@ -1,6 +1,10 @@ package log -import "github.com/rs/zerolog" +import ( + "time" + + "github.com/rs/zerolog" +) // TestingT is the interface required for logging in tests. // It is a subset of testing.T to avoid a direct dependency on the testing package. @@ -39,15 +43,18 @@ func NewTestLoggerError(t TestingT) Logger { } func newTestLogger(t TestingT, lvl zerolog.Level) Logger { - cw := zerolog.NewConsoleWriter() - cw.Out = zerolog.TestWriter{ - T: t, - // Normally one would use zerolog.ConsoleTestWriter - // to set the option on NewConsoleWriter, - // but the zerolog source for that is hardcoded to Frame=6. - // With Frame=6, all source locations are printed as "logger.go", - // but Frame=7 prints correct source locations. - Frame: 7, + cw := zerolog.ConsoleWriter{ + NoColor: true, + TimeFormat: time.Kitchen, + Out: zerolog.TestWriter{ + T: t, + // Normally one would use zerolog.ConsoleTestWriter + // to set the option on NewConsoleWriter, + // but the zerolog source for that is hardcoded to Frame=6. + // With Frame=6, all source locations are printed as "logger.go", + // but Frame=7 prints correct source locations. + Frame: 7, + }, } return NewCustomLogger(zerolog.New(cw).Level(lvl)) }