Skip to content

Add markdown log writer for GitHub workflow preview#149

Merged
pelikhan merged 8 commits into
mainfrom
copilot/add-second-log-file-writer
Jan 11, 2026
Merged

Add markdown log writer for GitHub workflow preview#149
pelikhan merged 8 commits into
mainfrom
copilot/add-second-log-file-writer

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 11, 2026

Adds a second log file (gateway.md) formatted as GitHub-flavored markdown for workflow run previews. Logs important diagnostic events with visual indicators and automatic secret redaction.

Implementation

  • New markdown logger (internal/logger/markdown_logger.go)

    • Wraps content in collapsible <details> HTML element
    • Emoji-prefixed bullet points: ✓ INFO, ⚠️ WARN, ✗ ERROR, 🔍 DEBUG
    • Automatic secret sanitization (GitHub PATs, API keys, bearer tokens, JWTs)
    • Thread-safe with immediate flush for real-time viewing
    • Code blocks for multi-line/technical content
    • Clean, concise format with emojis providing visual hierarchy
  • Integrated at critical log points

    • Startup/shutdown events
    • Authentication failures
    • Backend connection errors
    • Client connection rejections

Output Format

<details>
<summary>MCP Gateway</summary>

-**startup** MCPG Gateway version: dev
-**backend**

MCP backend connection failed, command=docker, args=[run --rm -e TOKEN=[REDACTED] -i image]

- ✗ **client** MCP connection rejected: no Authorization header
- ✓ **shutdown** Shutting down gateway...

</details>

File written to {log-dir}/gateway.md alongside existing mcp-gateway.log.

Original prompt

Add a second log file writer (gateway.md) that writes the logs in github flavored markdown. This file will be used as a preview for the github action workflow run.

  • content wrapped in a HTML details where summary is "MCP gateway"
  • use simple bullet point list with clear emojis for conciseness
  • log important information to help with diagnosing issues
  • use basic markdown syntax: lists and code section. Do not use headers.
  • careful about not logging secrets

The file will be written at {log-dir}/gateway.md


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 11, 2026 14:13
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add second log file writer for GitHub flavored markdown Add markdown log writer for GitHub workflow preview Jan 11, 2026
Copilot AI requested a review from pelikhan January 11, 2026 14:19
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot

  • the emojis are enough, remove [INFO] ...
  • remove timestamps

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 11, 2026

@copilot

  • the emojis are enough, remove [INFO] ...
  • remove timestamps

Done in fd677df. Removed timestamps and log level labels ([INFO], [WARN], [ERROR], [DEBUG]) from markdown output - emojis now provide all the visual hierarchy needed.

Before:

-`14:13:42` **startup** [INFO] MCPG Gateway version: dev
-`14:14:10` **backend** [ERROR] MCP backend connection failed...

After:

-**startup** MCPG Gateway version: dev
-**backend** MCP backend connection failed...

The output is now cleaner and more concise while maintaining clear visual indicators with emojis (✓ ✗ ⚠️ 🔍).

@pelikhan pelikhan marked this pull request as ready for review January 11, 2026 14:39
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot lint go

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 11, 2026

@copilot lint go

✅ All Go linting checks pass:

  • make lint completes successfully
  • go vet passes on all modified packages
  • gofmt shows no formatting issues

No code changes needed.

@pelikhan pelikhan merged commit 8aabce7 into main Jan 11, 2026
3 checks passed
@pelikhan pelikhan deleted the copilot/add-second-log-file-writer branch January 11, 2026 14:54
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