loggingStream( )
Opens a logging stream to receive real-time logs.
function loggingStream(params): AsyncGenerator<LoggingStreamResponse>;
| Name | Type | Required? | Description |
|---|
| params | object | ✓ | The logging stream parameters |
| params.id | string | ✓ | The identifier to stream logs for. Pass a model ID for model logs, or the exported constant SDK_LOG_ID for SDK server logs. |
AsyncGenerator<LoggingStreamResponse> — Yields log messages in real time.
| Field | Type | Description |
|---|
| type | "loggingStream" | Response type |
| id | string | Identifier being streamed |
| level | "error" | "warn" | "info" | "debug" | Log level |
| namespace | string | Logger namespace |
| message | string | Log message |
| timestamp | number | Unix timestamp |
| Error | When |
|---|
INVALID_RESPONSE_TYPE | A chunk's type does not match expected "loggingStream" |
import { loggingStream, SDK_LOG_ID } from "@qvac/sdk";
// Stream logs from a loaded model
const logStream = loggingStream({ id: "my-model-id" });
for await (const logMessage of logStream) {
console.log(`[${logMessage.level}] ${logMessage.namespace}: ${logMessage.message}`);
}
// Or stream SDK server logs
const sdkLogs = loggingStream({ id: SDK_LOG_ID });