跳到主要内容

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日志条目来源。
允许值:xmljavascriptnetworkstorageappcacherenderingsecuritydeprecationworkerviolationinterventionrecommendationother
ENLog entry source.
Allowed Values: xml, javascript, network, storage, appcache, rendering, security, deprecation, worker, violation, intervention, recommendation, other
level✔️string日志条目严重性等级。
允许的取值:verboseinfowarningerror
ENLog entry severity.
Allowed Values: verbose, info, warning, error
text✔️string已记录文本。
ENLogged text.
categorystring允许的值:cors
ENAllowed Values: cors
timestamp✔️Runtime.Timestamp此条目被添加时的时间戳。
ENTimestamp when this entry was added.
urlstring如果已知,资源的URL。
ENURL of the resource if known.
lineNumberinteger资源中的行号。
ENLine number in the resource.
stackTraceRuntime.StackTraceJavaScript 堆栈跟踪。
ENJavaScript stack trace.
networkRequestIdNetwork.RequestId与此条目关联的网络请求的标识符。
ENIdentifier of the network request associated with this entry.
workerIdstring与此条目关联的工作线程的标识符。
ENIdentifier of the worker associated with this entry.
argsarray[Runtime.RemoteObject]调用参数。
ENCall arguments.

📌Log.ViolationSetting

违规配置设置。

EN
Violation configuration setting.

返回类型:object

属性必填标记类型描述原文
name✔️string违规类型。
允许的值:longTasklongLayoutblockedEventblockedParserdiscouragedAPIUsehandlerrecurringHandler
ENViolation type.
Allowed Values: longTask, longLayout, blockedEvent, blockedParser, discouragedAPIUse, handler, recurringHandler
threshold✔️number触发的时间阈值。
ENTime threshold to trigger upon.