Skip to content

Add structured JSON request and payment logging #162

@AnkanMisra

Description

@AnkanMisra

Summary

Add structured JSON request and payment logging to the Go gateway while preserving current correlation ID behavior and avoiding sensitive data leaks.

Current State

The gateway currently uses Gin logging, correlation IDs, and targeted log.Printf calls. That is useful for local debugging but not enough for production log querying, alerting, or payment-flow analytics.

Desired Behavior

  • Add structured JSON logs for gateway requests and important payment outcomes.
  • Include stable fields such as timestamp, level, method, path, status, duration, client IP, correlation/request ID, and safe payment metadata.
  • Do not log signatures, private keys, API keys, Redis URLs, raw verifier internals, provider response bodies, or wallet secrets.
  • Keep logs compatible with existing correlation ID headers and sanitized public error behavior.
  • Add configuration only where needed, such as log format/level.

Acceptance Criteria

  • Gateway request logs are emitted as structured JSON when enabled/configured.
  • Logs include latency, status, route, correlation ID, and safe payment verification outcome fields.
  • Existing sensitive fields are redacted or omitted.
  • Log level behavior is documented and tested.
  • Tests cover success, 402, invalid signature, replay, upstream failure, and no-secret leakage.
  • Gateway README and deployment/support docs explain the logging behavior.

Replaces #14, whose examples used old chain defaults and did not account for the current correlation/error handling already in place.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestgoPull requests that update go codelevel:intermediateModerate scope requiring project familiarity or cross-file changes.type:devopsDeployment, observability, operations, CI, or infrastructure work.type:testingTests, coverage, fixtures, or validation-only work.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions