Documentation
¶
Index ¶
- Constants
- type Config
- type ContextAttrFunc
- type Logger
- func (l *Logger) LogPolicyCRUDFailure(ctx context.Context, params audit.PolicyEventParams)
- func (l *Logger) LogPolicyCRUDSuccess(ctx context.Context, params audit.PolicyEventParams)
- func (l *Logger) Trace(msg string, args ...any)
- func (l *Logger) TraceContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) With(key string, value string) *Logger
Constants ¶
View Source
const (
LevelTrace = slog.Level(-8)
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Level string `mapstructure:"level" json:"level" default:"info"`
Output string `mapstructure:"output" json:"output" default:"stdout"`
Type string `mapstructure:"type" json:"type" default:"json"`
// TraceCorrelation adds the active trace and span IDs to log and audit
// records. No-op unless tracing is enabled via `server.trace`. Nil means enabled.
TraceCorrelation *bool `mapstructure:"trace_correlation" json:"trace_correlation" default:"true"`
// AuditTimeout is the audit processing budget. Non-positive values use five seconds.
AuditTimeout time.Duration `mapstructure:"audit_timeout" json:"audit_timeout" yaml:"audit_timeout" default:"5s"`
// AuditProcessor overrides audit delivery for Go callers and is never serialized.
AuditProcessor audit.Processor `mapstructure:"-" json:"-" yaml:"-"`
// ContextAttrs derive attributes from each record's context. Go callers only.
ContextAttrs []ContextAttrFunc `mapstructure:"-" json:"-" yaml:"-"`
}
type ContextAttrFunc ¶ added in v0.27.0
ContextAttrFunc derives log attributes from a record's context. It returns nil when the context carries nothing to add.
type Logger ¶
func CreateTestLogger ¶
func CreateTestLogger() *Logger
func (*Logger) LogPolicyCRUDFailure ¶ added in v0.28.0
func (l *Logger) LogPolicyCRUDFailure(ctx context.Context, params audit.PolicyEventParams)
LogPolicyCRUDFailure records a failed policy operation and logs any audit error.
func (*Logger) LogPolicyCRUDSuccess ¶ added in v0.28.0
func (l *Logger) LogPolicyCRUDSuccess(ctx context.Context, params audit.PolicyEventParams)
LogPolicyCRUDSuccess records a successful policy operation and logs any audit error.
func (*Logger) TraceContext ¶
Click to show internal directories.
Click to hide internal directories.