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 ...interface{})
- func (g *Logger) ErrorDepth(depth int, args ...interface{})
- func (g *Logger) Errorf(format string, args ...interface{})
- func (g *Logger) Errorln(args ...interface{})
- func (g *Logger) Fatal(args ...interface{})
- func (g *Logger) FatalDepth(depth int, args ...interface{})
- func (g *Logger) Fatalf(format string, args ...interface{})
- func (g *Logger) Fatalln(args ...interface{})
- func (g *Logger) Info(args ...interface{})
- func (g *Logger) InfoDepth(depth int, args ...interface{})
- func (g *Logger) Infof(format string, args ...interface{})
- func (g *Logger) Infoln(args ...interface{})
- func (g *Logger) Log(level logrus.Level, args ...interface{})
- func (g *Logger) LogDepth(level logrus.Level, depth int, args ...interface{})
- func (g *Logger) Logf(level logrus.Level, format string, args ...interface{})
- func (g *Logger) Logln(level logrus.Level, args ...interface{})
- func (g *Logger) V(l int) bool
- func (g *Logger) Warning(args ...interface{})
- func (g *Logger) WarningDepth(depth int, args ...interface{})
- func (g *Logger) Warningf(format string, args ...interface{})
- func (g *Logger) Warningln(args ...interface{})
- 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) Error ¶
func (g *Logger) Error(args ...interface{})
Error implements grpclog.Entry.LoggerV2's Error.
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) Errorln ¶
func (g *Logger) Errorln(args ...interface{})
Errorln implements grpclog.Entry.LoggerV2's Errorln.
func (*Logger) Fatal ¶
func (g *Logger) Fatal(args ...interface{})
Fatal implements grpclog.Entry.LoggerV2's Fatal.
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) Fatalln ¶
func (g *Logger) Fatalln(args ...interface{})
Fatalln implements grpclog.Entry.LoggerV2's Fatalln.
func (*Logger) Info ¶
func (g *Logger) Info(args ...interface{})
Info implements grpclog.Entry.LoggerV2's Info.
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) Infoln ¶
func (g *Logger) Infoln(args ...interface{})
Infoln implements grpclog.Entry.LoggerV2's Infoln.
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) Warning ¶
func (g *Logger) Warning(args ...interface{})
Warning implements grpclog.Entry.LoggerV2's Warn.
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.