Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 24, 2025

Implements clear and concise logging for the coding-context-cli tool with a -v/--verbose flag to control output verbosity.

Changes Made

  • Added -v/--verbose flag: Controls logging verbosity
    • Default mode (no flag): Clean output with no log messages, suitable for piping to AI agents
    • Verbose mode (-v): Detailed INFO-level logs with timestamps showing progress
  • Updated error handling: Error messages now use fmt.Fprintf instead of logger for clean, unformatted output
  • Updated usage output: Usage information now uses fmt.Fprintln instead of logger for cleaner display
  • Improved log messages: Made messages more concise and user-friendly
    • "Including rule file" → "Rule loaded" (with basename only)
    • "Including task" → "Task loaded"
    • "Total estimated tokens" → "Context assembled" (with additional details)
    • "Downloading remote directory" → "Downloading"
    • "Downloaded to" → "Downloaded"

Example Output

Without -v (default):

---
task_name: test-task
---
# Test Rule
# Test Task

With -v (verbose):

time=2025-12-24T00:58:10.477Z level=INFO msg="Using local directory" path=/tmp/test
time=2025-12-24T00:58:10.477Z level=INFO msg="Task loaded" tokens=8
time=2025-12-24T00:58:10.477Z level=INFO msg="Rule loaded" path=test-rule.md tokens=8
time=2025-12-24T00:58:10.478Z level=INFO msg="Context assembled" total_tokens=16 rules=1
---
task_name: test-task
---
# Test Rule
# Test Task

Testing

  • ✅ All existing tests pass
  • ✅ Linter passes
  • ✅ Manual testing confirms both verbose and non-verbose modes work correctly
  • ✅ CodeQL security scan shows no issues
Original prompt

Add clear and concise logging.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
@alexec alexec closed this Dec 24, 2025
@alexec alexec reopened this Dec 24, 2025
Copilot AI requested a review from alexec December 24, 2025 00:51
@alexec
Copy link
Contributor

alexec commented Dec 24, 2025

@copilot very nice, but maybe follow your original plan.

- Add -v/--verbose flag to control logging verbosity
- Update usage output to use fmt.Fprintf instead of logger
- Update error messages to be clean without slog formatting
- Update log messages to be more concise and user-friendly
- Default mode (no -v): only errors shown, no timestamps
- Verbose mode (-v): INFO level logs with timestamps
- Clean output suitable for piping to AI agents

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 24, 2025

@copilot very nice, but maybe follow your original plan.

Implemented the original plan in commit 2fca625. The changes include:

Without -v flag (default):

---
task_name: test-task
---
# Test Rule
This is a test rule.

# Test Task
This is a test task.

With -v flag (verbose):

time=2025-12-24T00:58:10.477Z level=INFO msg="Using local directory" path=/tmp/test-logging
time=2025-12-24T00:58:10.477Z level=INFO msg="Using local directory" path=/home/runner
time=2025-12-24T00:58:10.477Z level=INFO msg="Task loaded" tokens=8
time=2025-12-24T00:58:10.477Z level=INFO msg="Rule loaded" path=test-rule.md tokens=8
time=2025-12-24T00:58:10.478Z level=INFO msg="Context assembled" total_tokens=16 rules=1
---
task_name: test-task
---
# Test Rule
This is a test rule.

# Test Task
This is a test task.

Error messages are now clean without slog formatting, and usage output uses fmt instead of logger.

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copilot AI changed the title [WIP] Add clear and concise logging Add clear and concise logging with -v flag Dec 24, 2025
@alexec alexec closed this Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants