Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGormLogger ¶ added in v1.6.0
func NewGormLogger(l Logger) gormLogger
func SetRedisLogger ¶ added in v1.30.0
func SetRedisLogger(logger Logger)
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a Logger builder.
func NewBuilder ¶
NewBuilder initializes a Logger builder with the given configuration.
func (*Builder) BuildTestLogger ¶
BuildTestLogger returns a Logger instance that will write into the bytes buffer passed as parameter. BuildTestLogger is only for testing.
type Config ¶
type Config struct { ConsoleEnabled bool `mapstructure:"console_enabled"` ConsoleJSONFormat bool `mapstructure:"console_json_format"` ConsoleLevel string `mapstructure:"console_level"` FileEnabled bool `mapstructure:"file_enabled"` FileJSONFormat bool `mapstructure:"file_json_format"` FileLevel string `mapstructure:"file_level"` FileLocation string `mapstructure:"file_location"` FileName string `mapstructure:"file_name"` }
Config stores the configuration for the logger. For some loggers there can only be one level across writers, for such the level of Console is picked by default.
type Fields ¶
type Fields map[string]interface{}
Fields is the struct that that stores key/value pairs for structured logs.
type Level ¶
type Level string
const ( // Panic level, highest level of severity. Logs and then calls // panic with the message passed to Debug, Info, ... Panic Level = "panic" // Fatal level. Logs and then calls `logger.Exit(1)`. It will // exit even if the logging level is set to Panic. Fatal Level = "fatal" // Error level. Logs. Used for errors that should definitely be // noted. Commonly used for hooks to send errors to an error // tracking service. Error Level = "error" // Warn level. Non-critical entries that deserve eyes. Warn Level = "warn" // Info level. General operational entries about what's going on // inside the application. Info Level = "info" // Debug level. Usually only enabled when debugging. Very // verbose logging. Debug Level = "debug" // Trace level. Designates finer-grained informational events // than the Debug. Trace Level = "trace" )
type Logger ¶
type Logger interface { // Panicf logs a message at level Panic. Panicf(format string, args ...interface{}) // Fatalf logs a message at level Fatal. Fatalf(format string, args ...interface{}) // Errorf logs a message at level Error. Errorf(format string, args ...interface{}) // Warnf logs a message at level Warning. Warnf(format string, args ...interface{}) // Infof logs a message at level Info. Infof(format string, args ...interface{}) // Debugf logs a message at level Debug. Debugf(format string, args ...interface{}) // Trace logs a message at level Trace. Tracef(format string, args ...interface{}) // WithFields creates an entry from the logger and adds multiple // fields to it. This is simply a helper for `WithField`, // invoking it once for each field. // // Note that it doesn't log until you call Debug, Print, Info, // Warn, Fatal or Panic on the Entry it returns. WithFields(keyValues Fields) Logger // WithError sets an error field value with logurs.Errorkey key. WithError(err error) Logger }
Logger is the interface that defines the API/contract exposed by the SDK Logger.
type RedisLogger ¶ added in v1.30.0
type RedisLogger struct {
// contains filtered or unexported fields
}
func NewRedisLogger ¶ added in v1.30.0
func NewRedisLogger(l Logger) *RedisLogger
Source Files ¶
Click to show internal directories.
Click to hide internal directories.