Skip to content

chore: Structured JSON logging with configurable log levels #156

Description

@dotunv

Overview

Add structured JSON logging with configurable log levels across the API and worker processes, replacing any ad-hoc console output.

Motivation

Production debugging requires structured, filterable logs. Currently the API and worker processes use inconsistent logging — some use fmt.Println, some use logrus. Structured JSON logs enable better integration with log aggregation tools like Datadog, Grafana Loki, or ELK.

Proposed Design

  1. Adopt a single structured logger (zerolog or slog) across both cmd/api and cmd/worker
  2. All log entries include: timestamp, level, message, request_id, tenant_id, operation
  3. Log levels configurable via LOG_LEVEL environment variable (debug, info, warn, error)
  4. HTTP request logging middleware adds request_id to all request-scoped logs
  5. Error logs include stack traces at debug level
  6. Sensitive fields (API keys, wallet secrets) are automatically redacted

Acceptance Criteria

  • All HTTP requests are logged with method, path, status, duration, and request_id
  • Worker jobs are logged with job type, duration, and success/failure status
  • Log level is configurable via LOG_LEVEL env var (default: info)
  • Sensitive fields are redacted in logs (API keys, secrets, mnemonics)
  • Log output is valid JSON
  • No sensitive data appears in any log output
  • Tests verify log redaction and structured output format

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programbackendBackend / API workenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions