Skip to main content

Mastra.listLogs()

.listLogs() 方法用于检索特定传输 ID 的所有日志。此方法需要一个支持 listLogs 操作的已配置日志记录器。

🌐 The .listLogs() method is used to retrieve all logs for a specific transport ID. This method requires a configured logger that supports the listLogs operation.

使用示例
Direct link to 使用示例

🌐 Usage example

mastra.listLogs("456");

参数
Direct link to 参数

🌐 Parameters

transportId:

string
The transport ID to retrieve logs from.

options:

object
Optional parameters for filtering and pagination. See Options section below for details.

选项
Direct link to 选项

🌐 Options

fromDate:

Date
Optional start date for filtering logs. e.g., new Date('2024-01-01').

toDate:

Date
Optional end date for filtering logs. e.g., new Date('2024-01-31').

logLevel:

LogLevel
Optional log level to filter by.

filters:

Record<string, any>
Optional additional filters to apply to the log query.

page:

number
Optional page number for pagination.

perPage:

number
Optional number of logs per page for pagination.

返回
Direct link to 返回

🌐 Returns

logs:

Promise<any>
A promise that resolves to the logs for the specified transport ID.

🌐 Related