Documentation
¶
Index ¶
- func AgentID(ctx context.Context) string
- func LogWith(ctx context.Context, logger *slog.Logger) *slog.Logger
- func StepID(ctx context.Context) string
- func WithAgentID(ctx context.Context, id string) context.Context
- func WithIDs(ctx context.Context, workflowID, stepID, agentID string) context.Context
- func WithStepID(ctx context.Context, id string) context.Context
- func WithWorkflowID(ctx context.Context, id string) context.Context
- func WorkflowID(ctx context.Context) string
- type CorrelationHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogWith ¶
LogWith returns a logger enriched with correlation IDs from the context. Only non-empty values are added as attributes.
func WithAgentID ¶
WithAgentID returns a context with the agent ID set.
func WithStepID ¶
WithStepID returns a context with the step ID set.
func WithWorkflowID ¶
WithWorkflowID returns a context with the workflow ID set.
func WorkflowID ¶
WorkflowID extracts the workflow ID from the context, or "" if absent.
Types ¶
type CorrelationHandler ¶
type CorrelationHandler struct {
// contains filtered or unexported fields
}
CorrelationHandler wraps an slog.Handler, automatically injecting correlation IDs from the context into every log record. Use with slog.New(NewCorrelationHandler(inner)) so callers can use logger.InfoContext(ctx, ...) and IDs appear automatically.
func NewCorrelationHandler ¶
func NewCorrelationHandler(inner slog.Handler) *CorrelationHandler
NewCorrelationHandler wraps the given handler with automatic correlation ID injection.