-
Couldn't load subscription status.
- Fork 0
feat: add independent format control for file and stderr logging with automatic ANSI code removal #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… ANSI code handling Co-authored-by: josecelano <58816+josecelano@users.noreply.github.com>
…d apply rustfmt Co-authored-by: josecelano <58816+josecelano@users.noreply.github.com>
Co-authored-by: josecelano <58816+josecelano@users.noreply.github.com>
|
@copilot, the linting workflow is failing https://github.com/torrust/torrust-tracker-deployer/actions/runs/18562329357/job/52917748888?pr=7 The error: We can add the |
Co-authored-by: josecelano <58816+josecelano@users.noreply.github.com>
Fixed in commit c7f0b4d by adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot linting workflow is failing:
2025-10-16T20:36:32.760577Z INFO torrust_linting::utils: markdownlint-cli installed successfully
2025-10-16T20:36:32.760608Z INFO markdown: Scanning markdown files...
./docs/contributing/logging-guide.md:66 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- File output: ANSI color code..."]
./docs/user-guide/logging.md:97 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- Clean text (no ANSI escape c..."]
./docs/user-guide/logging.md:124 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- Colored terminal output for ..."]
./docs/user-guide/logging.md:143 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- Structured data (easy to par..."]
2025-10-16T20:36:34.451948Z ERROR markdown: Markdown linting failed. Please fix the issues above.
2025-10-16T20:36:34.452004Z ERROR torrust_linting::cli: Markdown linting failed: Markdown linting failed
Run scripts/lint.sh to make sure linters pass in stable and nigtly toolchains.
Co-authored-by: josecelano <58816+josecelano@users.noreply.github.com>
Fixed in commit 3a8e5d7 by adding blank lines around lists in the documentation files. All linters now pass successfully (markdown, yaml, toml, cspell, clippy, rustfmt, shellcheck). |
|
ACK 0d35398 |
✅ Implementation Complete: Independent Format Control for File vs Stderr Logging
This PR implements Option A from issue #5: Independent format control for file and stderr logging outputs with automatic ANSI code handling.
🎯 Changes Completed
Core Implementation:
.with_ansi(false)for file writers.with_ansi(true)for stderr writersNew CLI Arguments:
--log-file-formatcontrols file output format (default: compact, no ANSI)--log-stderr-formatcontrols stderr output format (default: pretty, with ANSI)with_format()method in LoggingBuilderANSI Code Handling:
✅ Test Results
Automated Tests:
Manual Verification:
\x1b) in log files📊 Benefits
Before (Issue):
After (Fixed):
🎨 Usage Examples
Production (default):
Development:
Log Aggregation:
📝 Documentation
Updated:
docs/user-guide/logging.md- Complete user documentationdocs/contributing/logging-guide.md- Developer documentation🔗 Closes
Closes #5
Estimated file size reduction: 15-20% (ANSI codes removed)
Log parsing: Now fully compatible with grep, awk, sed, and other text tools
Backward compatibility: 100% - old API still works via
with_format()Original prompt
Fixes #5
💡 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.