Skip to content

feat: structured logging for better readability #25

@dwmkerr

Description

@dwmkerr

Summary

Add structured logging (JSON or logfmt) to make shellwright logs easier to read and filter.

Motivation

Currently logs are plain text. Structured logs would:

  • Work with tools like pamburus/hl for colorized, human-readable output
  • Enable filtering by log level, session ID, tool name, etc.
  • Make debugging easier in production

Proposal

Start simple:

  • Add a --log-format flag: text (default, current behavior) or json
  • Include useful fields: timestamp, level, session_id, tool, message
  • Keep the default human-friendly for basic use

Example JSON output:

{"ts":"2024-12-22T10:30:00Z","level":"info","tool":"shell_start","session":"abc123","msg":"Started bash session"}

Users who want pretty logs can pipe through hl:

npm start 2>&1 | hl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions