TsgcWSAPIServer_MCP › Methods › SendLogMessage
Sends a notifications/message log entry to every session whose logging level allows it.
procedure SendLogMessage(aLevel: TsgcAI_MCP_LoggingLevel; const aLogger, aData: string); overload;
procedure SendLogMessage(const aSession: TsgcAI_MCP_Session; aLevel: TsgcAI_MCP_LoggingLevel; const aLogger, aData: string); overload;
| Name | Type | Description |
|---|---|---|
aSession | TsgcAI_MCP_Session | Second overload only. Session of the request being processed; the log entry is related to that request. |
aLevel | TsgcAI_MCP_LoggingLevel | RFC 5424 severity of the entry (debug, info, notice, warning, error, critical, alert, emergency). |
aLogger | const string | Optional logger name identifying the component that produced the message. |
aData | const string | Free-form payload (plain text or JSON) delivered to the client as the message body. |
Fans out a notifications/message entry to every open session whose current logging level (set by the client through logging/setLevel) is at or below aLevel. The notification is only emitted when TransportOptions.HttpStreamable.Enabled is True; short-lived HTTP clients do not receive asynchronous logs. Sessions that opted into a higher severity threshold will silently discard lower-priority entries.
The overload with aSession sends the entry for the request being processed. For a 2026-07-28 request, which has no session, the entry is streamed in the response of that same request, and only when the client asked for logs with logLevel in the request _meta and aLevel is equal to or higher than that level. For a legacy session it behaves like the first overload. See Logging and Progress.
MCPServer.SendLogMessage(aimcpllInfo, 'ops', 'Deployment 42 rolled back successfully.');
// inside a request event, log for the current request only
MCPServer.SendLogMessage(aSession, aimcpllInfo, 'ops', 'Processing request');