rdev/internal/logging/fields.go
jordan d69da6d627 feat: add structured logging infrastructure and SDLC extensions
Major changes:
- Add internal/logging package with field constants, context propagation,
  sensitive data auto-redaction, and per-component log levels
- Add worker timeout constants (TimeoutQuickOp, TimeoutHealthCheck, etc.)
- Extend SDLC with callback handlers, generate endpoints, and executor
- Add new cookbook trees for aeries and slackpath progression
- Add skeleton templates for queue, realtime, and microservices
- Add worker component template with async job processing
- Refactor services and handlers to use new logging infrastructure
- Split component.go into component_infra.go and component_listing.go

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 22:56:04 -07:00

73 lines
2.0 KiB
Go

// Package logging provides enterprise-grade structured logging for rdev.
// It wraps slog with standardized field names, context propagation,
// automatic sensitive data redaction, and per-component log levels.
package logging
// Standard field names for structured logging.
// Using constants ensures consistent field names across the codebase,
// making logs queryable and reducing typos.
const (
// Request/trace context
FieldRequestID = "request_id"
FieldTraceID = "trace_id"
FieldSpanID = "span_id"
// User/auth context
FieldUserID = "user_id"
FieldAPIKeyID = "api_key_id"
FieldAPIKeyTag = "api_key_tag"
// Project context
FieldProjectID = "project_id"
FieldProjectName = "project_name"
// Component identification
FieldComponent = "component"
FieldHandler = "handler"
FieldService = "service"
FieldWorker = "worker"
FieldAdapter = "adapter"
// Operation context
FieldOperation = "operation"
FieldAction = "action"
FieldMethod = "method"
FieldPath = "path"
FieldStatus = "status"
// Error handling - ALWAYS use "error", never "err" or "e"
FieldError = "error"
FieldErrorCode = "error_code"
FieldErrorType = "error_type"
FieldStackTrace = "stack_trace"
// Performance/timing
FieldDuration = "duration_ms"
FieldStartTime = "start_time"
FieldEndTime = "end_time"
FieldRetryCount = "retry_count"
// Resource identifiers
FieldPodName = "pod_name"
FieldNamespace = "namespace"
FieldContainerID = "container_id"
FieldBuildID = "build_id"
FieldDeploymentID = "deployment_id"
FieldWorkID = "work_id"
FieldQueueName = "queue_name"
// HTTP context
FieldHTTPMethod = "http_method"
FieldHTTPPath = "http_path"
FieldHTTPStatus = "http_status"
FieldHTTPRemoteAddr = "http_remote_addr"
FieldHTTPUserAgent = "http_user_agent"
FieldHTTPHost = "http_host"
// Audit context
FieldAuditAction = "audit_action"
FieldAuditResource = "audit_resource"
FieldAuditResult = "audit_result"
FieldAuditDetails = "audit_details"
)