dwmkerr / dwmkerr/shellwright

feat: structured logging for better readability

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
37
Forks
5
Avg merge
3d 23h
Merged PRs (30d)
1

Description

## 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](https://github.com/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:
```json
{"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`:
```bash
npm start 2>&1 | hl
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.