Documentation
¶
Index ¶
- func NewContext(parent context.Context, l Logger) context.Context
- func ReplaceGrpcLogger(l Logger)
- func StreamServerInterceptor(l Logger) grpc.StreamServerInterceptor
- func UnaryServerInterceptor(l Logger) grpc.UnaryServerInterceptor
- type Field
- type Logger
- type Silent
- func (*Silent) Debug(_ ...interface{})
- func (*Silent) Debugf(_ string, _ ...interface{})
- func (*Silent) Error(_ ...interface{})
- func (*Silent) Errorf(_ string, _ ...interface{})
- func (*Silent) Info(_ ...interface{})
- func (*Silent) Infof(_ string, _ ...interface{})
- func (*Silent) Set(_ ...Field)
- func (*Silent) Trace(_ ...interface{})
- func (*Silent) Tracef(_ string, _ ...interface{})
- func (*Silent) Warning(_ ...interface{})
- func (*Silent) Warningf(_ string, _ ...interface{})
- func (*Silent) With(_ ...Field) Logger
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{})
}
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.