Log
提供对日志条目的访问权限。
EN
Provides access to log entries.
✅️️ Methods
🔨Log.clear
清除日志。
EN
Clears the log.
🔨Log.disable
禁用日志域,防止进一步的日志条目被报告给客户端。
EN
Disables log domain, prevents further log entries from being reported to the client.
🔨Log.enable
启用日志域,通过entryAdded通知将迄今为止收集的条目发送给客户端。
EN
Enables log domain, sends the entries collected so far to the client by means of the
entryAdded notification.🔨Log.startViolationsReport
开始违规报告。
EN
start violation reporting.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| config | ✔️ | array[ViolationSetting] | 违规配置。 | ENConfiguration for violations. |
🔨Log.stopViolationsReport
停止违规报告。
EN
Stop violation reporting.
✅️️ Events
👋Log.entryAdded
当新消息被记录时发出。
EN
Issued when new message was logged.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| entry | ✔️ | LogEntry | 该条目。 | ENThe entry. |
✅️️ Types
📌Log.LogEntry
日志条目。
EN
Log entry.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| source | ✔️ | string | 日志条目来源。 允许值: xml、javascript、network、storage、appcache、rendering、security、deprecation、worker、violation、intervention、recommendation、other | ENLog entry source.Allowed Values: xml, javascript, network, storage, appcache, rendering, security, deprecation, worker, violation, intervention, recommendation, other | |
| level | ✔️ | string | 日志条目严重性等级。 允许的取值: verbose、info、warning、error | ENLog entry severity.Allowed Values: verbose, info, warning, error | |
| text | ✔️ | string | 已记录文本。 | ENLogged text. | |
| category | string | 允许的值:cors | ENAllowed Values:cors | ||
| timestamp | ✔️ | Runtime.Timestamp | 此条目被添加时的时间戳。 | ENTimestamp when this entry was added. | |
| url | string | 如果已知,资源的URL。 | ENURL of the resource if known. | ||
| lineNumber | integer | 资源中的行号。 | ENLine number in the resource. | ||
| stackTrace | Runtime.StackTrace | JavaScript 堆栈跟踪。 | ENJavaScript stack trace. | ||
| networkRequestId | Network.RequestId | 与此条目关联的网络请求的标识符。 | ENIdentifier of the network request associated with this entry. | ||
| workerId | string | 与此条目关联的工作线程的标识符。 | ENIdentifier of the worker associated with this entry. | ||
| args | array[Runtime.RemoteObject] | 调用参数。 | ENCall arguments. |
📌Log.ViolationSetting
违规配置设置。
EN
Violation configuration setting.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | string | 违规类型。 允许的值: longTask、longLayout、blockedEvent、blockedParser、discouragedAPIUse、handler、recurringHandler | ENViolation type.Allowed Values: longTask, longLayout, blockedEvent, blockedParser, discouragedAPIUse, handler, recurringHandler | |
| threshold | ✔️ | number | 触发的时间阈值。 | ENTime threshold to trigger upon. |