Documentation
¶
Index ¶
- func AddEntryToCTX(ctx context.Context, entry *logrus.Entry) context.Context
- func AddFieldsToCTX(ctx context.Context, fields logrus.Fields) context.Context
- func AddSLOGAttrToCTX(ctx context.Context, attrs []slog.Attr) context.Context
- func ClientLoggerUnaryInterceptor(from, to string) grpc.UnaryClientInterceptor
- func Debug(ctx context.Context, v ...interface{})
- func Debugf(ctx context.Context, format string, args ...interface{})
- func Error(ctx context.Context, v ...interface{})
- func Errorf(ctx context.Context, format string, args ...interface{})
- func Fatal(ctx context.Context, v ...interface{})
- func Fatalf(ctx context.Context, format string, args ...interface{})
- func GetEntryFromCTX(ctx context.Context) (*logrus.Entry, bool)
- func GetFieldsFromCTX(ctx context.Context) logrus.Fields
- func GetSLOGAttrFromCTX(ctx context.Context) []slog.Attr
- func Info(ctx context.Context, v ...interface{})
- func Infof(ctx context.Context, format string, args ...interface{})
- func InitLog(out io.Writer)
- func MustGetEntryFromCTX(ctx context.Context) *logrus.Entry
- func NewEntryFormCTXWithFields(ctx context.Context) *logrus.Entry
- func NewFromCTX(ctx context.Context) *logrus.Entry
- func Panic(ctx context.Context, v ...interface{})
- func Panicf(ctx context.Context, format string, args ...interface{})
- func ServerLoggerUnaryInterceptor() ...
- func Trace(ctx context.Context, v ...interface{})
- func Tracef(ctx context.Context, format string, args ...interface{})
- func Warn(ctx context.Context, v ...interface{})
- func Warnf(ctx context.Context, format string, args ...interface{})
- type CTXAttrHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddEntryToCTX ¶
AddEntryToCTX adds entry to ctx
func AddFieldsToCTX ¶
AddFieldsToCTX adds fields to ctx
func AddSLOGAttrToCTX ¶ added in v0.0.9
AddSLOGAttrToCTX adds slog attr to ctx
func ClientLoggerUnaryInterceptor ¶ added in v0.0.9
func ClientLoggerUnaryInterceptor(from, to string) grpc.UnaryClientInterceptor
ClientLoggerUnaryInterceptor returns a new unary client interceptor for log from what to
func GetSLOGAttrFromCTX ¶ added in v0.0.9
GetSLOGAttrFromCTX returns slog attrs from ctx
func InitLog ¶
InitLog initializes logrus logger It uses nested-logrus-formatter It sets log level from LOGLVL env variable data format: 2006|01|02 15:04:05.000
func MustGetEntryFromCTX ¶
MustGetEntryFromCTX returns a *logrus.Entry from ctx if ctx has no *logrus.Entry, returns a new *logrus.Entry
func NewEntryFormCTXWithFields ¶
NewEntryFormCTXWithFields returns a *logrus.Entry with fields from ctx
func NewFromCTX ¶
NewFromCTX returns a new logrus.Entry with fields from ctx
func ServerLoggerUnaryInterceptor ¶
func ServerLoggerUnaryInterceptor() func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
Types ¶
type CTXAttrHandler ¶ added in v0.0.9
func NewCTXAttrHandler ¶ added in v0.0.9
func NewCTXAttrHandler(serviceName string, mainHandler slog.Handler) CTXAttrHandler
NewCTXAttrHandler
is a slog.Handler that adds slog.Attr to slog.Record from context.Context