Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
NewContext adds Logger to the Context.
func ReplaceGrpcLogger ¶
func ReplaceGrpcLogger(l Logger)
ReplaceGrpcLogger sets the given Logger as a gRPC-level logger v2. This should be called *before* any other initialization, preferably from init() functions.
func StreamServerInterceptor ¶
func StreamServerInterceptor(l Logger) grpc.StreamServerInterceptor
StreamServerInterceptor returns a new streaming server interceptor that adds Logger to the context.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(l Logger) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptors that adds Logger to the context.
Types ¶
type Field ¶
type Field struct { K string V interface{} }
Field contains key-value parameter for log prefix.
type Logger ¶
type Logger interface { // Set updates logger's additional fields. Set(fields ...Field) // With returns a copy of the logger with additional fields. With(fields ...Field) Logger // Trace prints a log message with "trace" log level. Trace(args ...interface{}) // Tracef prints a log message with "trace" log level and specified format. Tracef(format string, args ...interface{}) // Debug prints a log message with "debug" log level. Debug(args ...interface{}) // Debugf prints a log message with "debug" log level and specified format. Debugf(format string, args ...interface{}) // Info prints a log message with "info" log level. Info(args ...interface{}) // Infof prints a log message with "info" log level and specified format. Infof(format string, args ...interface{}) // Warning prints a log message with "warning" log level. Warning(args ...interface{}) // Warningf prints a log message with "warning" log level and specified format. Warningf(format string, args ...interface{}) // Error prints a log message with "error" log level. Error(args ...interface{}) // Errorf prints a log message with "error" log level and specified format. Errorf(format string, args ...interface{}) // Panic prints a log message with "panic" log level. Then calls panic(). Panic(args ...interface{}) // Panicf prints a log message with "error" log level and specified format. Then calls panic(). Panicf(format string, args ...interface{}) }
Logger interface is responsible for various logging systems.
func FromContext ¶
FromContext gets Logger from the Context.
Click to show internal directories.
Click to hide internal directories.