
audit
Index
- Variables
- func Log(ctx context.Context, event string, attrs …slog.Attr)
- func NewID() string
- func RequestID(ctx context.Context) string
- func WithRequestID(ctx context.Context, id string) context.Context
Variables
OnEvent is an optional callback invoked on each audit event for metrics integration. Set this to a function that increments a Prometheus counter.
func Log
Log emits a structured audit log entry at INFO level. The entry includes the audit marker, event name, and request ID from context. Additional attributes are appended after the base fields.
func NewID
NewID generates a random 16-byte request ID encoded as 32 hex characters.
func RequestID
RequestID extracts the request ID from the context, or returns an empty string if none is set.
func WithRequestID
WithRequestID returns a new context carrying the given request ID.
Generated by gomarkdoc