Files
Matt Holloway 9d3e8b707d
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Build and Test Go Project / build (macos-latest) (push) Has been cancelled
Build and Test Go Project / build (ubuntu-latest) (push) Has been cancelled
Build and Test Go Project / build (windows-latest) (push) Has been cancelled
Draft: tool invocation logging middleware
Adds a sensible logging integration on top of the (currently unused)
observability.Exporters scaffolding:

  * pkg/github/logging_middleware.go
    ToolLoggingMiddleware times every tools/call and logs at Debug on
    success / Error on failure (Go error or IsError result). It enriches
    a *slog.Logger with mcp.method and mcp.tool, then stores it on the
    context via observability.ContextWithLogger so tool handlers pick up
    the request-scoped logger automatically from deps.Logger(ctx).

  * pkg/observability/logger_context.go
    ContextWithLogger / LoggerFromContext helpers.

  * pkg/observability/log_level.go
    ParseLogLevel for 'debug|info|warn|error'.

  * --log-level flag / GITHUB_LOG_LEVEL env var
    Fills an obvious gap: previously levels were hard-coded (stderr=Info,
    file=Debug). The default behaviour is preserved when the flag is empty.

  * Fix fmt.Fprintf(os.Stderr, ...) feature-flag check reporting in
    BaseDeps.IsFeatureEnabled / RequestDeps.IsFeatureEnabled — these
    previously bypassed the structured logger entirely.

Tool handler code is intentionally untouched. The middleware gives every
tool a duration/outcome log line uniformly; tools that want richer
structured logs can opt in via deps.Logger(ctx).

Tests cover the middleware (success / error / IsError / non-tool
pass-through / missing deps), the context helpers, level parsing, and
the BaseDeps.Logger(ctx) context fallback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 17:18:21 +01:00
..
2026-02-19 15:17:52 +00:00
2026-02-12 11:04:54 +01:00
2025-11-06 14:48:11 +01:00