log

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestIDKey contextKey = "request_id"
	OperationKey contextKey = "operation"
)

Variables

This section is empty.

Functions

func BoolField

func BoolField(key string, value bool) zap.Field

func Debug

func Debug(msg string, fields ...zap.Field)

func DebugCtx

func DebugCtx(ctx context.Context, msg string, fields ...zap.Field)

Context-aware logging functions

func Debugf

func Debugf(format string, args ...any)

func DebugfCtx

func DebugfCtx(ctx context.Context, format string, args ...any)

func Default

func Default() *zap.Logger

func DurationField

func DurationField(key string, value time.Duration) zap.Field

func Error

func Error(msg string, fields ...zap.Field)

func ErrorCtx

func ErrorCtx(ctx context.Context, msg string, fields ...zap.Field)

func ErrorField

func ErrorField(err error) zap.Field

func Errorf

func Errorf(format string, args ...any)

func ErrorfCtx

func ErrorfCtx(ctx context.Context, format string, args ...any)

func Fatal

func Fatal(msg string, fields ...zap.Field)

func Fatalf

func Fatalf(format string, args ...any)

func GenerateRequestID

func GenerateRequestID() string

GenerateRequestID creates a new random request ID

func GetContextFields

func GetContextFields(ctx context.Context) []zap.Field

GetContextFields extracts logging fields from context

func Info

func Info(msg string, fields ...zap.Field)

func InfoCtx

func InfoCtx(ctx context.Context, msg string, fields ...zap.Field)

func Infof

func Infof(format string, args ...any)

func InfofCtx

func InfofCtx(ctx context.Context, format string, args ...any)

func IntField

func IntField(key string, value int) zap.Field

func LogMCPToolComplete

func LogMCPToolComplete(ctx context.Context, toolName string, duration time.Duration, resultSummary string)

LogMCPToolComplete logs successful completion of an MCP tool execution

func LogMCPToolError

func LogMCPToolError(ctx context.Context, toolName string, duration time.Duration, err error)

LogMCPToolError logs failed MCP tool execution

func LogMCPToolStart

func LogMCPToolStart(ctx context.Context, toolName string, params map[string]interface{})

LogMCPToolStart logs the start of an MCP tool execution

func Logger

func Logger() *zap.Logger

func Panic

func Panic(msg string, fields ...zap.Field)

func SanitizeURL

func SanitizeURL(rawURL string) string

SanitizeURL removes sensitive information from URLs for logging

func SanitizedURLField

func SanitizedURLField(key, rawURL string) zap.Field

func SetDefault

func SetDefault(logger *zap.Logger)

func StringField

func StringField(key, value string) zap.Field

Helper functions for common field types

func Warn

func Warn(msg string, fields ...zap.Field)

func WarnCtx

func WarnCtx(ctx context.Context, msg string, fields ...zap.Field)

func Warnf

func Warnf(format string, args ...any)

func WarnfCtx

func WarnfCtx(ctx context.Context, format string, args ...any)

func WithMCPContext

func WithMCPContext(ctx context.Context, toolName string) (context.Context, string)

WithMCPContext creates a new context with request ID and operation for MCP tool logging

func WithOperation

func WithOperation(ctx context.Context, operation string) context.Context

WithOperation adds an operation name to the context

func WithRequestID

func WithRequestID(ctx context.Context, requestID string) context.Context

WithRequestID adds a request ID to the context

Types

This section is empty.

Jump to

Keyboard shortcuts

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