Lesson 5

Comparing Logs and API Responses

Find regressions in log fragments, curl output, and response bodies without opening a full IDE diff.

Logs and API responses often arrive as copied text, not as tracked files. Text diff is ideal for these quick before/after checks.

Log fragment comparison

Useful cases:

  • Error stack traces before and after a deploy
  • Request/response logs around a failing endpoint
  • Worker job output from two runs
  • Filtered log lines copied from a dashboard

Workflow:

  1. Copy the last known good log snippet.
  2. Copy the failing log snippet for the same operation.
  3. Diff them locally.
  4. Focus on the first changed line, not the entire noisy block.

Logs often contain timestamps, request IDs, and trace IDs that change every run. Ignore those fields mentally, or trim them before diffing when possible.

API response comparison

Useful cases:

  • curl output before and after a backend change
  • Gateway-transformed response vs upstream response
  • Pagination page shape changes
  • Error payload changes (400 vs 422 body differences)

Example:

{"status":"ok","items":[{"id":1,"name":"Ada"}]}
{"status":"ok","items":[{"id":1,"name":"Ada","plan":"pro"}]}

If the payload is valid JSON and you care about field-level structure, JSON diff may be better. If the body is partial, minified, escaped, or mixed with headers, text diff is often faster.

Text diff vs JSON diff for responses

Input shapeBetter tool
Raw curl output with headersText diff
Pretty-printed JSON objectJSON diff
Log line with embedded JSONText diff first
Need field path like items[0].planJSON diff

Key takeaway

For logs and copied responses, text diff helps you spot the first meaningful change quickly. Trim noise, compare the smallest useful sample, then escalate to JSON diff only when structure matters.

Try both sides in the Text Diff Checker with a short response sample before comparing full payloads.

When you want to practice, use the related DevCove tool — optional, not part of this lesson.

Open related tool

Back to course overview