A LoggingHandler is a [slog.Handler] for MCP.
| 78 | |
| 79 | // A LoggingHandler is a [slog.Handler] for MCP. |
| 80 | type LoggingHandler struct { |
| 81 | opts LoggingHandlerOptions |
| 82 | ss *ServerSession |
| 83 | // Ensures that the buffer reset is atomic with the write (see Handle). |
| 84 | // A pointer so that clones share the mutex. See |
| 85 | // https://github.com/golang/example/blob/master/slog-handler-guide/README.md#getting-the-mutex-right. |
| 86 | mu *sync.Mutex |
| 87 | lastMessageSent time.Time // for rate-limiting |
| 88 | buf *bytes.Buffer |
| 89 | handler slog.Handler |
| 90 | } |
| 91 | |
| 92 | // ensureLogger returns l if non-nil, otherwise a discard logger. |
| 93 | func ensureLogger(l *slog.Logger) *slog.Logger { |
nothing calls this directly
no outgoing calls
no test coverage detected