Skip to content

observability: replace log.Printf with structured slog logging #6

@more-shubham

Description

@more-shubham

All logging currently uses log.Printf which outputs unstructured plain text. This cannot be parsed by any observability stack (ELK, Loki, Datadog).

Scope:

  • Replace all log.Printf calls across worker.go, engine.go, collector.go with slog
  • Add structured fields per log call: worker_id, file, duration_ms, bytes_saved, error
  • Add -log-format flag to main.go accepting text (default) or json
  • JSON mode should produce one parseable object per line

Example output in JSON mode:

{"time":"2026-02-18T10:30:00Z","level":"INFO","msg":"image processed","worker_id":1,"file":"photo.jpg","duration_ms":492,"bytes_saved":8432}

Acceptance Criteria:

  • Zero log.Printf remaining in codebase
  • -log-format=json produces valid JSON per line
  • Existing -verbose flag behaviour unchanged

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions