logging

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxRecordBytes = 16 * 1024

Variables

This section is empty.

Functions

func ValidRequestID added in v0.32.0

func ValidRequestID(value string) bool

func WithRequestID added in v0.32.0

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

WithRequestID records a previously validated request ID for downstream operational events. Invalid values are deliberately omitted.

Types

type Component added in v0.32.0

type Component string
const (
	ComponentProcess        Component = "process"
	ComponentHTTP           Component = "http"
	ComponentAuthentication Component = "authentication"
	ComponentWebhook        Component = "webhook"
	ComponentEmail          Component = "email"
	ComponentChallenge      Component = "challenge"
	ComponentQueue          Component = "queue"
	ComponentMaintenance    Component = "maintenance"
	ComponentConfiguration  Component = "configuration"
	ComponentDatabase       Component = "database"
	ComponentCache          Component = "cache"
	ComponentProvider       Component = "provider"
	ComponentOperator       Component = "operator"
	ComponentOther          Component = "other"
)

type Config added in v0.32.0

type Config struct {
	Level       string
	Environment string
	Version     string
	InstanceID  string
	Writer      io.Writer
	Now         func() time.Time
}

type ErrorCode added in v0.32.0

type ErrorCode string
const (
	ErrorInvalidRequest        ErrorCode = "invalid_request"
	ErrorInvalidCredentials    ErrorCode = "invalid_credentials"
	ErrorAccessDenied          ErrorCode = "access_denied"
	ErrorRateLimited           ErrorCode = "rate_limited"
	ErrorConflict              ErrorCode = "conflict"
	ErrorNotFound              ErrorCode = "not_found"
	ErrorStorageUnavailable    ErrorCode = "storage_unavailable"
	ErrorDependencyUnavailable ErrorCode = "dependency_unavailable"
	ErrorProviderRejected      ErrorCode = "provider_rejected"
	ErrorDeliveryFailed        ErrorCode = "delivery_failed"
	ErrorTimeout               ErrorCode = "timeout"
	ErrorAttemptsExhausted     ErrorCode = "attempts_exhausted"
	ErrorDeadlineExceeded      ErrorCode = "deadline_exceeded"
	ErrorContractViolation     ErrorCode = "contract_violation"
	ErrorConfigurationInvalid  ErrorCode = "configuration_invalid"
	ErrorLeaseLost             ErrorCode = "lease_lost"
	ErrorResourceCleanup       ErrorCode = "resource_cleanup"
	ErrorInternalFailure       ErrorCode = "internal_failure"
	ErrorOther                 ErrorCode = "other"
)

type Event added in v0.32.0

type Event string
const (
	EventProcessLifecycle      Event = "process_lifecycle"
	EventConfigurationStatus   Event = "configuration_status"
	EventRequestCompleted      Event = "request_completed"
	EventAuthenticationOutcome Event = "authentication_outcome"
	EventWebhookDelivery       Event = "webhook_delivery"
	EventQueueOutcome          Event = "queue_outcome"
	EventWorkerOutcome         Event = "worker_outcome"
	EventMaintenanceOutcome    Event = "maintenance_outcome"
	EventInternalOperation     Event = "internal_operation"
	EventLogRecordDropped      Event = "log_record_dropped"
)

type Field added in v0.32.0

type Field struct {
	// contains filtered or unexported fields
}

func Attempt added in v0.32.0

func Attempt(value int) Field

func ComponentField added in v0.32.0

func ComponentField(value Component) Field

func Duration added in v0.32.0

func Duration(value time.Duration) Field

func Enabled added in v0.32.0

func Enabled(value bool) Field

func ErrorCodeField added in v0.32.0

func ErrorCodeField(value ErrorCode) Field

func FailedCount added in v0.32.0

func FailedCount(value int64) Field

func Generation added in v0.32.0

func Generation(value int64) Field

func ItemCount added in v0.32.0

func ItemCount(value int64) Field

func Method added in v0.32.0

func Method(value string) Field

func ModeField added in v0.32.0

func ModeField(value Mode) Field

func OperationField added in v0.32.0

func OperationField(value Operation) Field

func OutcomeField added in v0.32.0

func OutcomeField(value Outcome) Field

func QueueField added in v0.32.0

func QueueField(value Queue) Field

func RequestID added in v0.32.0

func RequestID(value string) Field

func RequestSize added in v0.32.0

func RequestSize(value int64) Field

func ResponseSize added in v0.32.0

func ResponseSize(value int64) Field

func RetriedCount added in v0.32.0

func RetriedCount(value int64) Field

func Retryable added in v0.32.0

func Retryable(value bool) Field

func Route added in v0.32.0

func Route(value string) Field

func StatusClassField added in v0.32.0

func StatusClassField(value int) Field

func StatusCode added in v0.32.0

func StatusCode(value int) Field

func WorkerCount added in v0.32.0

func WorkerCount(value int) Field

func WorkerField added in v0.32.0

func WorkerField(value Worker) Field

type Level added in v0.32.0

type Level string
const (
	LevelDebug Level = "debug"
	LevelInfo  Level = "info"
	LevelWarn  Level = "warn"
	LevelError Level = "error"
)

type Logger added in v0.32.0

type Logger struct {
	// contains filtered or unexported fields
}

func Discard added in v0.32.0

func Discard() *Logger

func New

func New(cfg Config) (*Logger, error)

func (*Logger) Debug added in v0.32.0

func (l *Logger) Debug(event Event, fields ...Field)

func (*Logger) Error added in v0.32.0

func (l *Logger) Error(event Event, fields ...Field)

func (*Logger) Info added in v0.32.0

func (l *Logger) Info(event Event, fields ...Field)

func (*Logger) Log added in v0.32.0

func (l *Logger) Log(ctx context.Context, level Level, event Event, fields ...Field)

func (*Logger) StandardLogger added in v0.32.0

func (l *Logger) StandardLogger(component Component, operation Operation) *log.Logger

StandardLogger safely adapts libraries that require the standard library logger. The library-controlled message is discarded rather than admitted as an unbounded field.

func (*Logger) Warn added in v0.32.0

func (l *Logger) Warn(event Event, fields ...Field)

type Mode added in v0.32.0

type Mode string
const (
	ModeImmediate Mode = "immediate"
	ModeExpiry    Mode = "expiry"
	ModeEnabled   Mode = "enabled"
	ModeDisabled  Mode = "disabled"
	ModeOther     Mode = "other"
)

type Operation added in v0.32.0

type Operation string
const (
	OperationStartup            Operation = "startup"
	OperationShutdown           Operation = "shutdown"
	OperationServeHTTP          Operation = "serve_http"
	OperationRequest            Operation = "request"
	OperationLogin              Operation = "login"
	OperationSignup             Operation = "signup"
	OperationReauthenticate     Operation = "reauthenticate"
	OperationAccountRecovery    Operation = "account_recovery"
	OperationAccountUpdate      Operation = "account_update"
	OperationProviderLink       Operation = "provider_link"
	OperationPasskey            Operation = "passkey"
	OperationRateLimit          Operation = "rate_limit"
	OperationContractValidation Operation = "contract_validation"
	OperationWebhookPublish     Operation = "webhook_publish"
	OperationWebhookDeliver     Operation = "webhook_deliver"
	OperationWebhookListen      Operation = "webhook_listen"
	OperationClaim              Operation = "claim"
	OperationDeliver            Operation = "deliver"
	OperationRetry              Operation = "retry"
	OperationRecover            Operation = "recover"
	OperationCleanup            Operation = "cleanup"
	OperationSnapshot           Operation = "snapshot"
	OperationLease              Operation = "lease"
	OperationConfiguration      Operation = "configuration"
	OperationTransportSecurity  Operation = "transport_security"
	OperationRevocation         Operation = "revocation"
	OperationResourceClose      Operation = "resource_close"
	OperationOther              Operation = "other"
)

type Outcome added in v0.32.0

type Outcome string
const (
	OutcomeStarted        Outcome = "started"
	OutcomeStopping       Outcome = "stopping"
	OutcomeStopped        Outcome = "stopped"
	OutcomeSucceeded      Outcome = "succeeded"
	OutcomeDenied         Outcome = "denied"
	OutcomeFailed         Outcome = "failed"
	OutcomeDegraded       Outcome = "degraded"
	OutcomeRetryScheduled Outcome = "retry_scheduled"
	OutcomeExhausted      Outcome = "exhausted"
	OutcomeRecovered      Outcome = "recovered"
	OutcomeSkipped        Outcome = "skipped"
	OutcomeIncomplete     Outcome = "incomplete"
	OutcomeClientError    Outcome = "client_error"
	OutcomeServerError    Outcome = "server_error"
	OutcomeOther          Outcome = "other"
)

type Queue added in v0.32.0

type Queue string
const (
	QueueEmail   Queue = "email"
	QueueWebhook Queue = "webhook"
	QueueOther   Queue = "other"
)

type StatusClass added in v0.32.0

type StatusClass string
const (
	StatusInformational StatusClass = "informational"
	StatusSuccess       StatusClass = "success"
	StatusRedirect      StatusClass = "redirect"
	StatusClientError   StatusClass = "client_error"
	StatusServerError   StatusClass = "server_error"
	StatusUnknown       StatusClass = "unknown"
)

type Worker added in v0.32.0

type Worker string
const (
	WorkerEmail   Worker = "email"
	WorkerWebhook Worker = "webhook"
	WorkerOther   Worker = "other"
)

Jump to

Keyboard shortcuts

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