logger

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RequestIDCtxKey = "requestID"
	RequestIDMDKey  = "x-request-id"
)

Variables

This section is empty.

Functions

func ClientLoggingInterceptor

func ClientLoggingInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

func ClientRequestIDInterceptor

func ClientRequestIDInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

func ClientStreamInterceptor

func ClientStreamInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error)

func Init added in v0.3.3

func Init(cfg Config)

func InitEarlyFromEnv added in v0.3.3

func InitEarlyFromEnv()

func ServerLoggingInterceptor

func ServerLoggingInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)

func ServerRequestIDInterceptor

func ServerRequestIDInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)

func ServerStreamLoggingInterceptor

func ServerStreamLoggingInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func ServerStreamRequestIDInterceptor

func ServerStreamRequestIDInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

Types

type Config added in v0.3.3

type Config struct {
	Level   LogLevel
	Env     string
	Service string
	Version string
}

type LogLevel added in v0.0.4

type LogLevel string
const (
	LogLevelInfo  LogLevel = "INFO"
	LogLevelDebug LogLevel = "DEBUG"
	LogLevelTrace LogLevel = "TRACE"
	LogLevelError LogLevel = "ERROR"
	LogLevelWarn  LogLevel = "WARN"
	LogLevelFatal LogLevel = "FATAL"
	LogLevelPanic LogLevel = "PANIC"
)

func (LogLevel) String added in v0.0.4

func (s LogLevel) String() string

func (LogLevel) ToLogrusLevel added in v0.0.4

func (s LogLevel) ToLogrusLevel() logrus.Level

func (*LogLevel) UnmarshalText added in v0.0.4

func (s *LogLevel) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL