Skip to content

Add optional structured logging (JSON format) #73

@rz1989s

Description

@rz1989s

Summary

Add optional structured logging in JSON format for enterprise deployments.

Background

From production readiness audit (2025-12-13): Current logging is text-based. JSON structured logging enables better log aggregation and analysis.

Requirements

  • Add `STATUSLINE_LOG_FORMAT=json` environment variable
  • Output logs in JSON format when enabled
  • Maintain backward compatibility (default: text format)
  • Include standard fields (timestamp, level, message, context)
  • Document in configuration guide

Current Format

[INFO] 2025-12-13 10:30:45 Module loading completed in 0.2s
[WARN] 2025-12-13 10:30:45 Cache module failed to load

JSON Format

{"timestamp":"2025-12-13T10:30:45Z","level":"INFO","message":"Module loading completed","duration_ms":200,"context":"module_loading"}
{"timestamp":"2025-12-13T10:30:45Z","level":"WARN","message":"Cache module failed to load","context":"main","module":"cache"}

Use Cases

  • Log aggregation systems (ELK, Splunk, CloudWatch)
  • Structured analysis and alerting
  • Enterprise compliance requirements

Implementation Location

  • `lib/core.sh` - `debug_log()` function

Priority

🟢 Low Priority - Enterprise feature

References

  • Production Readiness Report: docs/production-readiness-report.md

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