Skip to content

Commit ab351a9

Browse files
committed
feat(logging): enhance logging output controls and verbosity settings
1 parent a393584 commit ab351a9

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

.github/prompts/dev.implement-cli-args-parsing.prompt.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Use it for context and evaluate each CLI against the CLI Contract Baseline:
7777
- Support repeatable flags for multiple values and document ordering, de-duplication, and limits.
7878
- Reject unknown flags and surplus positional arguments with exit code `2`.
7979
- Follow standard conventions for `-h/--help`, `-v/--version`, `--verbose`, and `--quiet`. These are must-have arguments for every CLI.
80+
- Support env var equivalents for CLI flags (for example `LOG_FILE` for `--log-file`), with precedence: CLI flags > env vars > config file > defaults.
8081
- Provide `--yes` or `--no-input` for non-interactive operation and make prompts opt-in.
8182

8283
### Modern parser defaults 🧱
@@ -124,13 +125,18 @@ Use it for context and evaluate each CLI against the CLI Contract Baseline:
124125
- Offer `--dry-run` when the command mutates resources.
125126
- Keep interactive prompts opt-in and always provide a non-interactive equivalent.
126127

128+
### Logging output controls 🧾
129+
130+
- Default to no logging output unless explicitly enabled.
131+
- Provide options for structured log file (`--log-json-file`), human-readable log file (`--log-file`), console logging (`--log-console`), and pretty/colour console output (`--log-console-pretty`).
132+
- Console logs must go to stderr and never mix with stdout payloads.
133+
127134
### Logging verbosity controls 🔊
128135

129136
- `--verbose` raises verbosity one step; allow `-v`, `-vv`, `-vvv` to increment levels (for example INFO → DEBUG → TRACE).
130137
- `--quiet` lowers verbosity one step; allow `-q`, `-qq` similarly.
131138
- Document the exact mapping from flags to log levels in `--help`.
132139
- Provide `--log-level <level>` for explicit control; flags are convenience.
133-
- Support an environment variable for verbosity (for example `LOG_LEVEL` or `VERBOSITY`), with precedence: CLI flags > env vars > config file > defaults.
134140
- Keep diagnostics on `stderr` and keep outputs deterministic.
135141

136142
### Wrappers and shared libraries 📦
@@ -170,12 +176,13 @@ Use it for context and evaluate each CLI against the CLI Contract Baseline:
170176
- [ ] Validation and errors
171177
- [ ] Stdout and stderr semantics
172178
- [ ] Developer ergonomics
179+
- [ ] Logging output controls
173180
- [ ] Logging verbosity controls
174181
- [ ] Wrappers and shared libraries
175182
- [ ] Cloud and serverless workloads
176183
- [ ] Testing expectations
177184

178185
---
179186

180-
> **Version**: 1.0.2
187+
> **Version**: 1.0.3
181188
> **Last Amended**: 2026-02-08

.github/prompts/dev.implement-logging.prompt.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,21 @@ Use it for context and evaluate each runtime that emits structured logs against
7474
- **Timing information**: log duration for slow or critical operations (or emit metrics instead).
7575
- **Avoid noise**: do not add "started/finished" logs to trivial or idempotent methods.
7676

77+
### Output destinations and defaults 🎯
78+
79+
- **No logs by default**: logging output is disabled unless explicitly enabled by configuration or CLI flags.
80+
- **Structured log file option**: provide a CLI argument or configuration option for the structured log file name/path (for example `--log-json-file` or `LOG_JSON_FILE`). When set, emit structured logs in NDJSON.
81+
- **Human-readable log file option**: provide a CLI argument or configuration option for the human-readable log file name/path (for example `--log-file` or `LOG_FILE`). When set, emit human-readable logs.
82+
- **Console logging toggle**: provide a CLI argument or configuration option to enable logging to the console (for example `--log-console` or `LOG_CONSOLE=true`).
83+
- **Pretty/colour console toggle**: provide a CLI argument or configuration option for pretty, colourised console output (for example `--log-console-pretty` or `LOG_CONSOLE_PRETTY=true`).
84+
- **Separate streams**: console logs must go to stderr and never mix with stdout payloads.
85+
86+
### Logging verbosity controls 🔊
87+
88+
- Provide `--log-level <level>` for explicit control.
89+
- Support verbosity flags (`--verbose` with `-v`, `-vv`, `-vvv`, and `--quiet` with `-q`, `-qq`) and document the mapping in `--help`.
90+
- Support an environment variable for verbosity (for example `LOG_LEVEL`) with precedence: CLI flags > env vars > config file > defaults.
91+
7792
### Log levels 🎚️
7893

7994
| Level | Purpose |
@@ -102,6 +117,7 @@ Flag any misuse (e.g., logging an error condition at INFO).
102117
- **No-colour mode**: auto-disable colour when stdout is not a TTY; honour `NO_COLOR` or similar environment variables.
103118
- **Level tags and icons**: use short, consistent tags (INFO, WARN, ERROR) with an optional single icon per level.
104119
- **Bounded output**: truncate or wrap large fields; never allow unbounded blobs to break layout.
120+
- **Stdout separation**: console logs must never be written to stdout; keep stdout for primary results only.
105121

106122
### Performance ⚡
107123

@@ -120,12 +136,14 @@ Flag any misuse (e.g., logging an error condition at INFO).
120136
- [ ] Project-level logger configuration
121137
- [ ] Class-level logging
122138
- [ ] Method-level logging
139+
- [ ] Output destinations and defaults
140+
- [ ] Logging verbosity controls
123141
- [ ] Log levels
124142
- [ ] Content
125143
- [ ] Console visualisation
126144
- [ ] Performance
127145

128146
---
129147

130-
> **Version**: 1.1.4
148+
> **Version**: 1.1.5
131149
> **Last Amended**: 2026-02-08

0 commit comments

Comments
 (0)