Documentation ¶
Index ¶
- Variables
- func GetRealIP(ctx context.Context) string
- func GetReqID(ctx context.Context) string
- func LoggerMiddleware() grpc.UnaryServerInterceptor
- func RealIPMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (_ interface{}, err error)
- func RecoveryMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (_ interface{}, err error)
- func RequestIDMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (_ interface{}, err error)
- func WithReqID(ctx context.Context, reqID string) context.Context
- type LoggerV2
- func (l *LoggerV2) Error(args ...interface{})
- func (l *LoggerV2) Errorf(format string, args ...interface{})
- func (l *LoggerV2) Errorln(args ...interface{})
- func (l *LoggerV2) Fatal(args ...interface{})
- func (l *LoggerV2) Fatalf(format string, args ...interface{})
- func (l *LoggerV2) Fatalln(args ...interface{})
- func (l *LoggerV2) Info(args ...interface{})
- func (l *LoggerV2) Infof(format string, args ...interface{})
- func (l *LoggerV2) Infoln(args ...interface{})
- func (l *LoggerV2) V(level int) bool
- func (l *LoggerV2) Warning(args ...interface{})
- func (l *LoggerV2) Warningf(format string, args ...interface{})
- func (l *LoggerV2) Warningln(args ...interface{})
Constants ¶
This section is empty.
Variables ¶
var Logger = NewLoggerV2(&log.Logger)
var RealIPHeader = "x-real-ip"
var RequestIDHeader = "x-request-id"
Functions ¶
func LoggerMiddleware ¶
func LoggerMiddleware() grpc.UnaryServerInterceptor
func RealIPMiddleware ¶
func RealIPMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error)
func RecoveryMiddleware ¶
func RecoveryMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error)
func RequestIDMiddleware ¶
func RequestIDMiddleware(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error)
Types ¶
type LoggerV2 ¶
type LoggerV2 struct {
// contains filtered or unexported fields
}
func NewLoggerV2 ¶
func NewLoggerV2(logger *log.ServiceLogger) *LoggerV2
func (*LoggerV2) Error ¶
func (l *LoggerV2) Error(args ...interface{})
Error logs to ERROR log. Arguments are handled in the manner of fmt.Print.
func (*LoggerV2) Errorf ¶
Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf.
func (*LoggerV2) Errorln ¶
func (l *LoggerV2) Errorln(args ...interface{})
Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println.
func (*LoggerV2) Fatal ¶
func (l *LoggerV2) Fatal(args ...interface{})
Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print. gRPC ensures that all Fatal logs will exit with os.Exit(1). Implementations may also call os.Exit() with a non-zero exit code.
func (*LoggerV2) Fatalf ¶
Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. gRPC ensures that all Fatal logs will exit with os.Exit(1). Implementations may also call os.Exit() with a non-zero exit code.
func (*LoggerV2) Fatalln ¶
func (l *LoggerV2) Fatalln(args ...interface{})
Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println. gRPC ensures that all Fatal logs will exit with os.Exit(1). Implementations may also call os.Exit() with a non-zero exit code.
func (*LoggerV2) Info ¶
func (l *LoggerV2) Info(args ...interface{})
Info logs to INFO log. Arguments are handled in the manner of fmt.Print.
func (*LoggerV2) Infoln ¶
func (l *LoggerV2) Infoln(args ...interface{})
Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println.
func (*LoggerV2) Warning ¶
func (l *LoggerV2) Warning(args ...interface{})
Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print.