Skip to content

CreatePrettyLoggs: Add pretty HTTP logging with traceId#142

Merged
ren6 merged 1 commit intomasterfrom
CreatePrettyLoggs
Jan 28, 2026
Merged

CreatePrettyLoggs: Add pretty HTTP logging with traceId#142
ren6 merged 1 commit intomasterfrom
CreatePrettyLoggs

Conversation

@aaudin90
Copy link
Collaborator

Add pretty HTTP logging with traceId

Description

Add HTTP logging interceptor that outputs formatted JSON bodies and tags each request-response pair with a unique 8-character traceId (e.g., [a1b2c3d4])
for easier correlation in logs.

Changes

  • PrettyJsonFormatter - formats JSON with indentation
  • PrettyHttpLoggingInterceptor - logs requests/responses with traceId prefix
  • Integrated into OkHttp clients via ServiceLocator

Example output

[a1b2c3d4] Start POST request https://api.apphud.com/v2/customers with params:
{ "device_id": "xxx" }

[a1b2c3d4] Finished POST request ... with response: 200
{ "data": {...} }

Add PrettyHttpLoggingInterceptor for formatted HTTP request/response
logging with unique 8-character traceId to correlate requests with
their responses in logs.

Components added:
- PrettyJsonFormatter: formats JSON with indentation for readability
- PrettyHttpLoggingInterceptor: logs HTTP traffic with traceId prefix
- ServiceLocator: wires up the new interceptor to OkHttp clients

Log format example:
[a1b2c3d4] Start POST request https://api.apphud.com/v2/customers
[a1b2c3d4] Finished POST request ... with response: 200

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@ren6 ren6 merged commit c67ed7c into master Jan 28, 2026
2 checks passed
ren6 pushed a commit that referenced this pull request Jan 28, 2026
Add PrettyHttpLoggingInterceptor for formatted HTTP request/response
logging with unique 8-character traceId to correlate requests with
their responses in logs.

Components added:
- PrettyJsonFormatter: formats JSON with indentation for readability
- PrettyHttpLoggingInterceptor: logs HTTP traffic with traceId prefix
- ServiceLocator: wires up the new interceptor to OkHttp clients

Log format example:
[a1b2c3d4] Start POST request https://api.apphud.com/v2/customers
[a1b2c3d4] Finished POST request ... with response: 200

Co-authored-by: Claude Opus 4.5 <[email protected]>
@ren6 ren6 deleted the CreatePrettyLoggs branch January 28, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants