1use serde::{Deserialize, Serialize};
11
12#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14pub struct LogEntry {
15 pub source: LogEntrySource,
17 pub level: LogEntryLevel,
19 pub text: String,
21 #[serde(default, skip_serializing_if = "Option::is_none")]
22 pub category: Option<LogEntryCategory>,
23 pub timestamp: crate::protocol::runtime::Timestamp,
25 #[serde(default, skip_serializing_if = "Option::is_none")]
27 pub url: Option<String>,
28 #[serde(
30 rename = "lineNumber",
31 default,
32 skip_serializing_if = "Option::is_none"
33 )]
34 pub line_number: Option<i64>,
35 #[serde(
37 rename = "stackTrace",
38 default,
39 skip_serializing_if = "Option::is_none"
40 )]
41 pub stack_trace: Option<crate::protocol::runtime::StackTrace>,
42 #[serde(
44 rename = "networkRequestId",
45 default,
46 skip_serializing_if = "Option::is_none"
47 )]
48 pub network_request_id: Option<crate::protocol::network::RequestId>,
49 #[serde(rename = "workerId", default, skip_serializing_if = "Option::is_none")]
51 pub worker_id: Option<String>,
52 #[serde(default, skip_serializing_if = "Option::is_none")]
54 pub args: Option<Vec<crate::protocol::runtime::RemoteObject>>,
55}
56
57#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
59pub enum LogEntrySource {
60 #[serde(rename = "xml")]
62 Xml,
63 #[serde(rename = "javascript")]
65 Javascript,
66 #[serde(rename = "network")]
68 Network,
69 #[serde(rename = "storage")]
71 Storage,
72 #[serde(rename = "appcache")]
74 Appcache,
75 #[serde(rename = "rendering")]
77 Rendering,
78 #[serde(rename = "security")]
80 Security,
81 #[serde(rename = "deprecation")]
83 Deprecation,
84 #[serde(rename = "worker")]
86 Worker,
87 #[serde(rename = "violation")]
89 Violation,
90 #[serde(rename = "intervention")]
92 Intervention,
93 #[serde(rename = "recommendation")]
95 Recommendation,
96 #[serde(rename = "other")]
98 Other,
99 #[serde(untagged)]
103 Unrecognized(String),
104}
105
106#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
108pub enum LogEntryLevel {
109 #[serde(rename = "verbose")]
111 Verbose,
112 #[serde(rename = "info")]
114 Info,
115 #[serde(rename = "warning")]
117 Warning,
118 #[serde(rename = "error")]
120 Error,
121 #[serde(untagged)]
125 Unrecognized(String),
126}
127
128#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
130pub enum LogEntryCategory {
131 #[serde(rename = "cors")]
133 Cors,
134 #[serde(untagged)]
138 Unrecognized(String),
139}
140
141#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
143pub struct ViolationSetting {
144 pub name: ViolationSettingName,
146 pub threshold: f64,
148}
149
150#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
152pub enum ViolationSettingName {
153 #[serde(rename = "longTask")]
155 LongTask,
156 #[serde(rename = "longLayout")]
158 LongLayout,
159 #[serde(rename = "blockedEvent")]
161 BlockedEvent,
162 #[serde(rename = "blockedParser")]
164 BlockedParser,
165 #[serde(rename = "discouragedAPIUse")]
167 DiscouragedApiUse,
168 #[serde(rename = "handler")]
170 Handler,
171 #[serde(rename = "recurringHandler")]
173 RecurringHandler,
174 #[serde(untagged)]
178 Unrecognized(String),
179}
180
181#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
185pub struct ClearParams {}
186
187impl crate::typed::Command for ClearParams {
188 const METHOD: &'static str = "Log.clear";
189 type Returns = crate::typed::NoReturns;
190}
191
192#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
197pub struct DisableParams {}
198
199impl crate::typed::Command for DisableParams {
200 const METHOD: &'static str = "Log.disable";
201 type Returns = crate::typed::NoReturns;
202}
203
204#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
209pub struct EnableParams {}
210
211impl crate::typed::Command for EnableParams {
212 const METHOD: &'static str = "Log.enable";
213 type Returns = crate::typed::NoReturns;
214}
215
216#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
220pub struct StartViolationsReportParams {
221 pub config: Vec<ViolationSetting>,
223}
224
225impl crate::typed::Command for StartViolationsReportParams {
226 const METHOD: &'static str = "Log.startViolationsReport";
227 type Returns = crate::typed::NoReturns;
228}
229
230#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
234pub struct StopViolationsReportParams {}
235
236impl crate::typed::Command for StopViolationsReportParams {
237 const METHOD: &'static str = "Log.stopViolationsReport";
238 type Returns = crate::typed::NoReturns;
239}
240
241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
245pub struct EntryAddedEvent {
246 pub entry: LogEntry,
248}
249
250impl crate::typed::Event for EntryAddedEvent {
251 const METHOD: &'static str = "Log.entryAdded";
252}