cosmos-sdk/schema/logutil/logger.go
2024-07-09 11:20:31 +00:00

36 lines
1.2 KiB
Go

// Package logutil defines the Logger interface expected by indexer implementations.
// It is implemented by cosmossdk.io/log which is not imported to minimize dependencies.
package logutil
// Logger is the logger interface expected by indexer implementations.
type Logger interface {
// 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.
Info(msg string, keyVals ...interface{})
// 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 ...interface{})
// 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 ...interface{})
// Debug takes a message and a set of key/value pairs and logs with level DEBUG.
// The key of the tuple must be a string.
Debug(msg string, keyVals ...interface{})
}
// NoopLogger is a logger that doesn't do anything.
type NoopLogger struct{}
func (n NoopLogger) Info(string, ...interface{}) {}
func (n NoopLogger) Warn(string, ...interface{}) {}
func (n NoopLogger) Error(string, ...interface{}) {}
func (n NoopLogger) Debug(string, ...interface{}) {}
var _ Logger = NoopLogger{}