Documentation
¶
Index ¶
- func ClientIP(ip string) zap.Field
- func CorrelationID(id string) zap.Field
- func GetCorrelationID(ctx context.Context) (string, bool)
- func GetRequestID(ctx context.Context) (string, bool)
- func NewChildLogger(parent *zap.Logger, component string) *zap.Logger
- func NewLogger(level, format, filePath string) (*zap.Logger, error)
- func ProjectID(id string) zap.Field
- func RequestFields(requestID, method, path string, statusCode, durationMs int) []zap.Field
- func TokenID(token string) zap.Field
- func WithCorrelationContext(ctx context.Context, logger *zap.Logger) *zap.Logger
- func WithCorrelationID(ctx context.Context, correlationID string) context.Context
- func WithRequestContext(ctx context.Context, logger *zap.Logger) *zap.Logger
- func WithRequestID(ctx context.Context, requestID string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CorrelationID ¶
CorrelationID returns a field for correlation ID
func GetCorrelationID ¶
GetCorrelationID retrieves the correlation ID from context
func GetRequestID ¶
GetRequestID retrieves the request ID from context
func NewChildLogger ¶
NewChildLogger creates a child logger with a component field
func NewLogger ¶
NewLogger creates a zap.Logger with the specified level, format, and optional file output. level can be debug, info, warn, or error. format can be json or console. If filePath is empty, logs are written to stdout.
func RequestFields ¶
RequestFields returns fields for HTTP request logging
func WithCorrelationContext ¶
WithCorrelationContext adds correlation ID from context to logger if present
func WithCorrelationID ¶
WithCorrelationID adds a correlation ID to the context
func WithRequestContext ¶
WithRequestContext adds request ID from context to logger if present
Types ¶
This section is empty.