You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 22a88f1
Browse filesBrowse the repository at this point in the historyBrowse files
Replaces the previous logging implementation with LogTape for structured
logging across the MCP server and Cloudflare Workers. This provides
consistent JSON-formatted logs with Sentry integration for monitoring.
- **Adopted LogTape**: Structured logging library with dual sinks
- Console sink outputs JSON Lines format for log aggregation
- Sentry sink sends logs directly to Sentry for monitoring
- **Four clear logging functions**:
- `logInfo()` - Routine telemetry (connection lifecycle, tool
invocations)
- `logWarn()` - Operational warnings (rate limits, deprecated usage)
- `logError()` - Operational errors that are handled gracefully
- `logIssue()` - System errors that create Sentry Issues
- **Environment-based configuration**: `LOG_LEVEL` env var or `NODE_ENV`
fallback (debug in development, info in production)
- **HTTP request logging**: Cloudflare middleware automatically logs all
requests with status and duration
Co-Authored-By: Claude Code <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/monitoring.mdc
+1-24Lines changed: 1 addition & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -19,30 +19,7 @@ Different Sentry SDKs for different environments:
19
19
20
20
### Error Logging
21
21
22
-
```typescript
23
-
import { captureException, withScope } from "@sentry/core";
24
-
25
-
export function logError(
26
-
error: Error | unknown,
27
-
contexts?: Record<string, any>,
28
-
attachments?: Record<string, any>
29
-
): string | undefined {
30
-
// Skip UserInputErrors - these are expected
31
-
if (error instanceof UserInputError) {
32
-
return;
33
-
}
34
-
35
-
return withScope((scope) => {
36
-
if (contexts) scope.setContext("mcp", contexts);
37
-
if (attachments) {
38
-
for (const [key, data] of Object.entries(attachments)) {
39
-
scope.addAttachment({ data, filename: key });
40
-
}
41
-
}
42
-
return captureException(error);
43
-
});
44
-
}
45
-
```
22
+
See `logIssue` in @packages/mcp-server/src/logging.ts (documented in @docs/logging.mdc) for the canonical way to create an Issue and structured log entry.
0 commit comments