chore: fix grammatical errors in log package comments (#25155)
This commit is contained in:
parent
7032eadf9b
commit
cff39886e5
@ -33,7 +33,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
|
||||
### Changes
|
||||
|
||||
* [#24568](https://github.com/cosmos/cosmos-sdk/pull/24568) Registering the same error code twice no longer will panic - a warning error will be logged to `stderr`.
|
||||
* [#24568](https://github.com/cosmos/cosmos-sdk/pull/24568) Registering the same error code twice will no longer panic - a warning error will be logged to `stderr`.
|
||||
|
||||
## [v1.0.2](https://github.com/cosmos/cosmos-sdk/releases/tag/errors%2Fv1.0.2)
|
||||
|
||||
|
||||
@ -6,24 +6,24 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// SuccessABCICode declares an ABCI response use 0 to signal that the
|
||||
// SuccessABCICode declares an ABCI response uses 0 to signal that the
|
||||
// processing was successful and no error is returned.
|
||||
SuccessABCICode uint32 = 0
|
||||
|
||||
// All unclassified errors that do not provide an ABCI code are clubbed
|
||||
// under an internal error code and a generic message instead of
|
||||
// detailed error string.
|
||||
// a detailed error string.
|
||||
internalABCICodespace = UndefinedCodespace
|
||||
internalABCICode uint32 = 1
|
||||
)
|
||||
|
||||
// ABCIInfo returns the ABCI error information as consumed by the tendermint
|
||||
// client. Returned codespace, code, and log message should be used as a ABCI response.
|
||||
// client. Returned codespace, code, and log message should be used as an ABCI response.
|
||||
// Any error that does not provide ABCICode information is categorized as error
|
||||
// with code 1, codespace UndefinedCodespace
|
||||
// When not running in a debug mode all messages of errors that do not provide
|
||||
// ABCICode information are replaced with generic "internal error". Errors
|
||||
// without an ABCICode information as considered internal.
|
||||
// without an ABCICode information are considered internal.
|
||||
func ABCIInfo(err error, debug bool) (codespace string, code uint32, log string) {
|
||||
if errIsNil(err) {
|
||||
return "", SuccessABCICode, ""
|
||||
|
||||
@ -65,7 +65,7 @@ func (s *abciTestSuite) TestABCInfo() {
|
||||
wantSpace: UndefinedCodespace,
|
||||
},
|
||||
// This is hard to test because of attached stacktrace. This
|
||||
// case is tested in an another test.
|
||||
// case is tested in another test.
|
||||
// "wrapped stdlib is a full message in debug mode": {
|
||||
// err: Wrap(io.EOF, "cannot read file"),
|
||||
// debug: true,
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
/*
|
||||
Package errors implements custom error interfaces for cosmos-sdk.
|
||||
|
||||
Error declarations should be generic and cover broad range of cases. Each
|
||||
Error declarations should be generic and cover a broad range of cases. Each
|
||||
returned error instance can wrap a generic error declaration to provide more
|
||||
details.
|
||||
|
||||
This package provides a broad range of errors declared that fits all common
|
||||
cases. If an error is very specific for an extension it can be registered outside
|
||||
This package provides a broad range of errors declared that fit all common
|
||||
cases. If an error is very specific to an extension it can be registered outside
|
||||
of the errors package. If it will be needed by many extensions, please consider
|
||||
registering it in the errors package. To create a new error instance use Register
|
||||
function. You must provide a unique, non zero error code and a short description, for example:
|
||||
|
||||
@ -3,7 +3,7 @@ package errors
|
||||
import "fmt"
|
||||
|
||||
// AssertNil panics on error
|
||||
// Should be only used with interface methods, which require return error, but the
|
||||
// Should only be used with interface methods, which require return error, but the
|
||||
// error is always nil
|
||||
func AssertNil(err error) {
|
||||
if err != nil {
|
||||
|
||||
@ -51,7 +51,7 @@ func trimInternal(st errors.StackTrace) errors.StackTrace {
|
||||
"cosmossdk.io/errors.Wrap",
|
||||
"cosmossdk.io/errors.Wrapf",
|
||||
"cosmossdk.io/errors.WithType",
|
||||
// runtime are added on panics
|
||||
// runtime is added on panics
|
||||
"runtime.",
|
||||
// _test is defined in coverage tests, causing failure
|
||||
// "/_test/"
|
||||
|
||||
@ -20,7 +20,7 @@ func (s *errorsTestSuite) TestStackTrace() {
|
||||
err: Wrap(fmt.Errorf("foo"), "standard"),
|
||||
wantError: "standard: foo",
|
||||
},
|
||||
"Wrapping pkg/errors gives us clean stacktrace": {
|
||||
"Wrapping pkg/errors gives us a clean stacktrace": {
|
||||
err: Wrap(errors.New("bar"), "pkg"),
|
||||
wantError: "pkg: bar",
|
||||
},
|
||||
|
||||
@ -20,7 +20,7 @@ func unsafeConvertStr() []byte {
|
||||
}
|
||||
|
||||
func (s *StringSuite) TestUnsafeStrToBytes() {
|
||||
// we convert in other function to trigger GC. We want to check that
|
||||
// we convert in another function to trigger GC. We want to check that
|
||||
// the underlying array in []bytes is accessible after GC will finish swapping.
|
||||
for range 5 {
|
||||
b := unsafeConvertStr()
|
||||
@ -39,7 +39,7 @@ func unsafeConvertBytes() string {
|
||||
}
|
||||
|
||||
func (s *StringSuite) TestUnsafeBytesToStr() {
|
||||
// we convert in other function to trigger GC. We want to check that
|
||||
// we convert in another function to trigger GC. We want to check that
|
||||
// the underlying array in []bytes is accessible after GC will finish swapping.
|
||||
for range 5 {
|
||||
str := unsafeConvertBytes()
|
||||
|
||||
@ -15,7 +15,7 @@ import (
|
||||
// **Warning**: this is only compatible with following flag types:
|
||||
// 1. the implementations of pflag.Value
|
||||
// 2. the built-in implementations of pflag.SliceValue
|
||||
// 3. the custom implementations of pflag.SliceValue that are split by comma ","
|
||||
// 3. the custom implementatons of pflag.SliceValue that are split by comma ","
|
||||
//
|
||||
// see https://github.com/spf13/cobra/issues/2079#issuecomment-1870115781 for more detail info
|
||||
func ResetArgs(t *testing.T, cmd *cobra.Command) {
|
||||
|
||||
@ -28,7 +28,7 @@ Each entry must include the Github issue reference in the following format:
|
||||
|
||||
## [v1.5.1](https://github.com/cosmos/cosmos-sdk/releases/tag/log/v1.5.1) - 2025-03-07
|
||||
|
||||
* [#23928](https://github.com/cosmos/cosmos-sdk/pull/23928) Bump sonic json library to [v1.3.1](https://github.com/bytedance/sonic/releases/tag/v1.13.1) for Go 1.24 compatibility.
|
||||
* [#23928](https://github.com/cosmos/cosmos-sdk/pull/23928) Bump sonic json library to [v1.13.1](https://github.com/bytedance/sonic/releases/tag/v1.13.1) for Go 1.24 compatibility.
|
||||
|
||||
## [v1.5.0](https://github.com/cosmos/cosmos-sdk/releases/tag/log/v1.5.0) - 2024-11-07
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ func BenchmarkLoggers(b *testing.B) {
|
||||
keyVals: []any{"foo", 1},
|
||||
},
|
||||
{
|
||||
// Small numbers may be optimized, so check if an unusual/larger number performs different.
|
||||
// Small numbers may be optimized, so check if an unusual/larger number performs differently.
|
||||
name: "single largeish int",
|
||||
keyVals: []any{"foo", 123456789},
|
||||
},
|
||||
@ -94,7 +94,7 @@ func BenchmarkLoggers(b *testing.B) {
|
||||
}
|
||||
})
|
||||
|
||||
// The nop logger we use expose in the public API,
|
||||
// The nop logger we expose in the public API,
|
||||
// also useful as a reference for how expensive zerolog is.
|
||||
b.Run("specialized nop logger", func(b *testing.B) {
|
||||
for _, bc := range nopCases {
|
||||
|
||||
@ -202,7 +202,7 @@ func (l zeroLogWrapper) WithContext(keyVals ...interface{}) any {
|
||||
}
|
||||
|
||||
// Impl returns the underlying zerolog logger.
|
||||
// It can be used to used zerolog structured API directly instead of the wrapper.
|
||||
// It can be used to use zerolog structured API directly instead of the wrapper.
|
||||
func (l zeroLogWrapper) Impl() interface{} {
|
||||
return l.Logger
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ func OutputJSONOption() Option {
|
||||
}
|
||||
}
|
||||
|
||||
// ColorOption add option to enable/disable coloring
|
||||
// ColorOption adds an option to enable/disable coloring
|
||||
// of the logs when console writer is in use
|
||||
func ColorOption(val bool) Option {
|
||||
return func(cfg *Config) {
|
||||
@ -79,8 +79,8 @@ func ColorOption(val bool) Option {
|
||||
}
|
||||
|
||||
// TimeFormatOption configures timestamp format of the logger
|
||||
// timestamps disabled if empty.
|
||||
// it is responsibility of the caller to provider correct values
|
||||
// Timestamps are disabled if empty.
|
||||
// It is the responsibility of the caller to provide correct values
|
||||
// Supported formats:
|
||||
// - time.Layout
|
||||
// - time.ANSIC
|
||||
@ -100,14 +100,14 @@ func TimeFormatOption(format string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// TraceOption add option to enable/disable print of stacktrace on error log
|
||||
// TraceOption adds an option to enable/disable print of stacktrace on error log
|
||||
func TraceOption(val bool) Option {
|
||||
return func(cfg *Config) {
|
||||
cfg.StackTrace = val
|
||||
}
|
||||
}
|
||||
|
||||
// HooksOption append hooks to the Logger hooks
|
||||
// HooksOption appends hooks to the Logger hooks
|
||||
func HooksOption(hooks ...zerolog.Hook) Option {
|
||||
return func(cfg *Config) {
|
||||
cfg.Hooks = append(cfg.Hooks, hooks...)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user