Skip to content

Conversation

@github-actions
Copy link
Contributor

Summary

Enhanced internal/server/transport.go with comprehensive debug logging to improve troubleshooting and development visibility.

Changes Made

Logger Declaration

  • Added logger instance: var logTransport = logger.New("server:transport")
  • Follows project convention: pkg:filename pattern

Logging Additions (6 calls)

  1. HTTP Transport Start (line 27)

    • Logs when HTTP transport starts
    • Includes: address
    • Context: Initialization phase
  2. HTTP Server Creation (line 82)

    • Logs when MCP HTTP server is being created
    • Includes: address, authentication status
    • Context: Server setup phase
  3. Streamable Handler Registration (line 92)

    • Logs registration of streamable HTTP handler
    • Context: Protocol handler setup
  4. Connection Rejection (line 118)

    • Logs when connections are rejected due to missing Authorization header
    • Includes: remote address, request path
    • Context: Security/authentication flow
  5. Close Endpoint Called (line 172)

    • Logs when graceful shutdown endpoint is invoked
    • Includes: HTTP method, remote address
    • Context: Shutdown initiation
  6. Shutdown Initiated (line 195)

    • Logs successful shutdown initiation
    • Includes: number of servers terminated
    • Context: Shutdown execution

Benefits

  • Troubleshooting: Easier to debug HTTP transport and server lifecycle issues
  • Security: Better visibility into connection rejections
  • Operations: Clear audit trail for shutdown procedures
  • Development: Helpful context when DEBUG=server:* is enabled

Guidelines Followed

✅ Single file modified (focused PR)
✅ No test files modified
✅ Logger naming follows pkg:filename convention
✅ No side effects in logger arguments
✅ Meaningful, actionable log messages
✅ Strategic placement at key decision points
✅ Consistent with existing project logging patterns

Testing

The code has been manually verified for:

  • Correct Go syntax
  • Proper import statements
  • Consistent logger usage pattern
  • No duplicate logging with existing logs

Debug Usage

Enable debug logging for this file:

DEBUG=server:transport ./awmg --config config.toml

Or enable all server logging:

DEBUG=server:* ./awmg --config config.toml

Related

This enhancement is part of the ongoing effort to improve observability across the codebase. The logger writes to both stderr (with colors/time diffs when DEBUG matches) and the file logger (always captured to file).

AI generated by Go Logger Enhancement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant