Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | 104x | /**
* Logging Types for Condensed Access Log Format
*
* Implements request stack aggregation and connection tracking as specified in issue #194.
* All events during a request lifecycle are collected and output as a single condensed line.
*/
/**
* Request stack for aggregating events during request lifecycle.
*
* Opened when request arrives, closed when response is sent (success/error/timeout).
* All accumulated data is formatted into a single access log line on close.
*/
export interface RequestStack {
/** Request start timestamp in milliseconds */
startTime: number;
/** Client IP address */
clientIp: string;
/** Session ID (MCP or OAuth), if available */
sessionId?: string;
/** Selected context path (project or group) */
context?: string;
/** Read-only mode flag */
readOnly?: boolean;
/** HTTP method (GET, POST, etc.) */
method: string;
/** Request path (e.g., /mcp, /sse, /token) */
path: string;
// Accumulated during request lifecycle
/** MCP tool name if a tool was called */
tool?: string;
/** CQRS action (list, get, create, update, delete, etc.) */
action?: string;
/** GitLab API response status (200, 404, etc.) or special values */
gitlabStatus?: number | "timeout" | "error";
/** Time spent waiting for GitLab API response in milliseconds */
gitlabDuration?: number;
/** Context-specific key=value details */
details: Record<string, string | number | boolean>;
// Set on completion
/** HTTP response status code */
status?: number;
/** Error message if request failed */
error?: string;
}
/**
* Connection close reason types
*/
export type ConnectionCloseReason =
| "client_disconnect"
| "idle_timeout"
| "server_shutdown"
| "transport_error"
| "auth_expired";
/**
* Connection statistics for SSE/persistent connections.
*
* Tracked from connection open to close, logged separately from request access logs.
*/
export interface ConnectionStats {
/** Connection start timestamp in milliseconds */
connectedAt: number;
/** Client IP address */
clientIp: string;
/** Session ID (MCP session ID) */
sessionId: string;
/** Total HTTP requests on this connection */
requestCount: number;
/** Total tool invocations */
toolCount: number;
/** Total errors encountered */
errorCount: number;
/** Last error message if any errors occurred */
lastError?: string;
}
/**
* Formatted access log entry (for structured output)
*/
export interface AccessLogEntry {
/** ISO 8601 UTC timestamp */
timestamp: string;
/** Client IP address */
clientIp: string;
/** Truncated session ID (first4..last4) or "-" */
session: string;
/** Selected context path or "-" */
ctx: string;
/** Read-only mode: "RO" or "-" */
ro: string;
/** HTTP method */
method: string;
/** Request path */
path: string;
/** HTTP response status */
status: number;
/** Request duration in milliseconds */
durationMs: number;
/** Tool name or "-" */
tool: string;
/** Action or "-" */
action: string;
/** GitLab status (GL:200, GL:404, GL:timeout) or "-" */
gitlabStatus: string;
/** GitLab duration in milliseconds or "-" */
gitlabDurationMs: string;
/** Formatted details string (key=value pairs) */
details: string;
}
/**
* Formatted connection close log entry
*/
export interface ConnectionCloseEntry {
/** ISO 8601 UTC timestamp */
timestamp: string;
/** Client IP address */
clientIp: string;
/** Truncated session ID */
session: string;
/** Connection duration (human readable: 5m32s) */
duration: string;
/** Close reason */
reason: ConnectionCloseReason;
/** Total requests */
requests: number;
/** Total tools */
tools: number;
/** Total errors */
errors: number;
/** Last error message if applicable */
lastError?: string;
}
/**
* Log format mode configuration
*/
export type LogFormat = "condensed" | "verbose";
/**
* Default log format
*/
export const DEFAULT_LOG_FORMAT: LogFormat = "condensed";
|