Documentation ¶
Overview ¶
Package logruslogger defines logrus-based logging for grpc. Importing this package will install logrus as the logger used by grpclog. Attention, Info -> Debug to mute verbose messages.
Index ¶
- type EmptyLoggerOption
- type Logger
- func (o *Logger) ApplyOptions(options ...LoggerOption) *Logger
- func (g *Logger) Error(args ...any)
- func (g *Logger) ErrorDepth(depth int, args ...any)
- func (g *Logger) Errorf(format string, args ...any)
- func (g *Logger) Errorln(args ...any)
- func (g *Logger) Fatal(args ...any)
- func (g *Logger) FatalDepth(depth int, args ...any)
- func (g *Logger) Fatalf(format string, args ...any)
- func (g *Logger) Fatalln(args ...any)
- func (g *Logger) Info(args ...any)
- func (g *Logger) InfoDepth(depth int, args ...any)
- func (g *Logger) Infof(format string, args ...any)
- func (g *Logger) Infoln(args ...any)
- func (g *Logger) Log(level logrus.Level, args ...any)
- func (g *Logger) LogDepth(level logrus.Level, depth int, args ...any)
- func (g *Logger) Logf(level logrus.Level, format string, args ...any)
- func (g *Logger) Logln(level logrus.Level, args ...any)
- func (g *Logger) V(l int) bool
- func (g *Logger) Warning(args ...any)
- func (g *Logger) WarningDepth(depth int, args ...any)
- func (g *Logger) Warningf(format string, args ...any)
- func (g *Logger) Warningln(args ...any)
- type LoggerOption
- type LoggerOptionFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmptyLoggerOption ¶
type EmptyLoggerOption struct{}
EmptyLoggerOption does not alter the configuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type Logger ¶
type Logger struct { Entry *logrus.Entry LevelTranslator func(level logrus.Level) logrus.Level // contains filtered or unexported fields }
Logger adapts logrus's Logger to be compatible with grpclog.LoggerV2, the experimental grpclog.DepthLoggerV2 and the deprecated grpclog.Logger.
func (*Logger) ApplyOptions ¶
func (o *Logger) ApplyOptions(options ...LoggerOption) *Logger
ApplyOptions call apply() for all options one by one
func (*Logger) ErrorDepth ¶
ErrorDepth acts as Warn but uses depth to determine which call frame to log. ErrorDepth(0, "msg") is the same as Error("msg").
func (*Logger) FatalDepth ¶
FatalDepth acts as Warn but uses depth to determine which call frame to log. FatalDepth(0, "msg") is the same as Fatal("msg").
func (*Logger) InfoDepth ¶
InfoDepth implements grpclog.Entry.LoggerV2's DebugDepth. InfoDepth acts as Info but uses depth to determine which call frame to log. InfoDepth(0, "msg") is the same as Info("msg").
func (*Logger) LogDepth ¶
LogDepth acts as Warn but uses depth to determine which call frame to log. LogDepth(0, "msg") is the same as Log("msg").
func (*Logger) WarningDepth ¶
WarningDepth acts as Warn but uses depth to determine which call frame to log. WarningDepth(0, "msg") is the same as Warn("msg").
type LoggerOption ¶
type LoggerOption interface {
// contains filtered or unexported methods
}
A LoggerOption sets options.
func WithLoggerEntry ¶ added in v1.2.86
func WithLoggerEntry(v *logrus.Entry) LoggerOption
WithLoggerEntry sets Entry in Logger.
func WithLoggerLevelTranslator ¶ added in v1.2.86
func WithLoggerLevelTranslator(v func(level logrus.Level) logrus.Level) LoggerOption
WithLoggerLevelTranslator sets LevelTranslator in Logger.
func WithLoggerVerbose ¶
func WithLoggerVerbose(v int) LoggerOption
WithLoggerVerbose sets verbose in Logger.
type LoggerOptionFunc ¶
type LoggerOptionFunc func(*Logger)
LoggerOptionFunc wraps a function that modifies Logger into an implementation of the LoggerOption interface.