pretty-log is a command-line utility that turns newline-delimited JSON logs into compact, readable, colorized output for local debugging.
It is designed to work well with mixed streams where some lines are JSON and some are plain text.
Before:
After:
- Human-friendly formatting for structured JSON logs
- Automatic handling for string and numeric log levels (including Pino's
10-60scale) - Configurable field aliases for time, level, and message
- Optional include/exclude controls for non-core fields
- Optional field ordering for extra context
- Readable multiline stack trace rendering
- Safe passthrough for non-JSON lines and non-object JSON values
cargo install --git https://github.com/blesswinsamuel/pretty-log --branch maingit clone https://github.com/blesswinsamuel/pretty-log.git
cd pretty-log
cargo install --path ../your-application | pretty-logTry with included fixtures:
cat test/logs.txt | cargo run --quiet
cat test/logs_pino.txt | cargo run --quiet -- --color neverUsage: pretty-log [OPTIONS]
Options:
-t, --time-field <TIME_FIELD> Field that represents time [default: time,timestamp]
-l, --level-field <LEVEL_FIELD> Field that represents level [default: level,lvl]
-m, --message-field <MESSAGE_FIELD> Field that represents message [default: message,msg]
--include-fields <INCLUDE_FIELDS>
Comma-separated non-core fields to include in output
--exclude-fields <EXCLUDE_FIELDS>
Comma-separated non-core fields to hide from output
--field-order <FIELD_ORDER> Comma-separated preferred order for non-core fields
--color <COLOR> Color mode: auto, always, never [default: auto]
-h, --help Print help
-V, --version Print version
Hide noisy host/process fields:
cat test/logs_pino.txt | pretty-log --exclude-fields pid,hostnameShow only selected context fields:
cat test/logs_pino.txt | pretty-log --include-fields service,jobId,invoiceId --field-order service,jobId,invoiceIdForce plain output (no ANSI colors):
cat test/logs_pino.txt | pretty-log --color never- Invalid JSON lines are printed unchanged
- Valid non-object JSON values are printed unchanged
- Time/level/message fields are promoted to the log prefix
- Remaining fields are rendered as
key=valuepairs - Multiline strings (for example stack traces) are rendered as indented blocks
Run local stream demo:
go run test/test.go | cargo runRun fixture tests:
task testRun full validation:
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo testRelease binaries are published via GitHub Actions on tag/release workflows.
Contributions are welcome.
- Fork the repository
- Create a feature branch
- Add or update tests for your change
- Run validation locally
- Open a pull request with a clear description
This project is licensed under the terms of the MIT License. See LICENSE for details.