feat(log): add warn log level (#18898)
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
This commit is contained in:
parent
14037aef00
commit
d55985637e
@ -24,6 +24,7 @@ Each entry must include the Github issue reference in the following format:
|
||||
|
||||
* [#18916](https://github.com/cosmos/cosmos-sdk/pull/18916) Introduce an option for setting hooks.
|
||||
* [#18429](https://github.com/cosmos/cosmos-sdk/pull/18429) Support customization of log json marshal.
|
||||
* [#18898](https://github.com/cosmos/cosmos-sdk/pull/18898) Add `WARN` level.
|
||||
|
||||
## [v1.2.1](https://github.com/cosmos/cosmos-sdk/releases/tag/log/v1.2.1) - 2023-08-25
|
||||
|
||||
|
||||
@ -40,6 +40,10 @@ type Logger interface {
|
||||
// The key of the tuple must be a string.
|
||||
Info(msg string, keyVals ...any)
|
||||
|
||||
// Warn takes a message and a set of key/value pairs and logs with level WARN.
|
||||
// The key of the tuple must be a string.
|
||||
Warn(msg string, keyVals ...any)
|
||||
|
||||
// Error takes a message and a set of key/value pairs and logs with level ERR.
|
||||
// The key of the tuple must be a string.
|
||||
Error(msg string, keyVals ...any)
|
||||
@ -140,6 +144,12 @@ func (l zeroLogWrapper) Info(msg string, keyVals ...interface{}) {
|
||||
l.Logger.Info().Fields(keyVals).Msg(msg)
|
||||
}
|
||||
|
||||
// Info takes a message and a set of key/value pairs and logs with level INFO.
|
||||
// The key of the tuple must be a string.
|
||||
func (l zeroLogWrapper) Warn(msg string, keyVals ...interface{}) {
|
||||
l.Logger.Warn().Fields(keyVals).Msg(msg)
|
||||
}
|
||||
|
||||
// Error takes a message and a set of key/value pairs and logs with level DEBUG.
|
||||
// The key of the tuple must be a string.
|
||||
func (l zeroLogWrapper) Error(msg string, keyVals ...interface{}) {
|
||||
@ -176,6 +186,7 @@ func NewNopLogger() Logger {
|
||||
type nopLogger struct{}
|
||||
|
||||
func (nopLogger) Info(string, ...any) {}
|
||||
func (nopLogger) Warn(string, ...any) {}
|
||||
func (nopLogger) Error(string, ...any) {}
|
||||
func (nopLogger) Debug(string, ...any) {}
|
||||
func (nopLogger) With(...any) Logger { return nopLogger{} }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user