> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/llms.txt # Mastra.listLogs() `.listLogs()` 方法用於擷取特定 transport ID 的所有日誌。此方法需要已配置且支援 `listLogs` 操作的 logger。 ## 使用範例 ```typescript mastra.listLogs('456') ``` ## 參數 **transportId** (`string`): 要從中擷取日誌的 transport ID。 **options** (`object`): 用於篩選及分頁的可選參數。 **options.fromDate** (`Date`): 用於篩選日誌的可選開始日期,例如 new Date('2024-01-01')。 **options.toDate** (`Date`): 用於篩選日誌的可選結束日期,例如 new Date('2024-01-31')。 **options.logLevel** (`LogLevel`): 用於篩選的可選日誌級別。 **options.filters** (`Record`): 套用至日誌查詢的可選額外篩選條件。 **options.page** (`number`): 用於分頁的可選頁碼。 **options.perPage** (`number`): 用於分頁的可選每頁日誌數目。 ## 傳回值 **logs** (`Promise`): 一個 Promise,會 resolve 為指定 transport ID 的日誌。 ## 相關內容 - [日誌記錄概覽](https://mastra.zisheng.pro/zh-HK/docs/observability/logging) - [Logger 參考](https://mastra.zisheng.pro/zh-HK/reference/logging/pino-logger)