Skip to main content

browser_protocol/log/
mod.rs

1//! Provides access to log entries.
2
3use serde::{Serialize, Deserialize};
4
5/// Log entry.
6
7#[derive(Debug, Clone, Serialize, Deserialize, Default)]
8#[serde(rename_all = "camelCase")]
9pub struct LogEntry {
10    /// Log entry source.
11
12    pub source: String,
13    /// Log entry severity.
14
15    pub level: String,
16    /// Logged text.
17
18    pub text: String,
19
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub category: Option<String>,
22    /// Timestamp when this entry was added.
23
24    pub timestamp: crate::runtime::Timestamp,
25    /// URL of the resource if known.
26
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub url: Option<String>,
29    /// Line number in the resource.
30
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub lineNumber: Option<i64>,
33    /// JavaScript stack trace.
34
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub stackTrace: Option<crate::runtime::StackTrace>,
37    /// Identifier of the network request associated with this entry.
38
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub networkRequestId: Option<crate::network::RequestId>,
41    /// Identifier of the worker associated with this entry.
42
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub workerId: Option<String>,
45    /// Call arguments.
46
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub args: Option<Vec<crate::runtime::RemoteObject>>,
49}
50
51/// Violation configuration setting.
52
53#[derive(Debug, Clone, Serialize, Deserialize, Default)]
54#[serde(rename_all = "camelCase")]
55pub struct ViolationSetting {
56    /// Violation type.
57
58    pub name: String,
59    /// Time threshold to trigger upon.
60
61    pub threshold: f64,
62}
63
64/// start violation reporting.
65
66#[derive(Debug, Clone, Serialize, Deserialize, Default)]
67#[serde(rename_all = "camelCase")]
68pub struct StartViolationsReportParams {
69    /// Configuration for violations.
70
71    pub config: Vec<ViolationSetting>,
72}