Skip to main content

cdp_protocol/
log.rs

1// Auto-generated from Chrome at version 146.0.7680.165 domain: Log
2#![allow(dead_code)]
3use super::network;
4use super::runtime;
5#[allow(unused_imports)]
6use super::types::*;
7#[allow(unused_imports)]
8use derive_builder::Builder;
9#[allow(unused_imports)]
10use serde::{Deserialize, Serialize};
11#[allow(unused_imports)]
12use serde_json::Value as Json;
13#[allow(deprecated)]
14#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
15pub enum LogEntrySource {
16    #[serde(rename = "xml")]
17    Xml,
18    #[serde(rename = "javascript")]
19    Javascript,
20    #[serde(rename = "network")]
21    Network,
22    #[serde(rename = "storage")]
23    Storage,
24    #[serde(rename = "appcache")]
25    Appcache,
26    #[serde(rename = "rendering")]
27    Rendering,
28    #[serde(rename = "security")]
29    Security,
30    #[serde(rename = "deprecation")]
31    Deprecation,
32    #[serde(rename = "worker")]
33    Worker,
34    #[serde(rename = "violation")]
35    Violation,
36    #[serde(rename = "intervention")]
37    Intervention,
38    #[serde(rename = "recommendation")]
39    Recommendation,
40    #[serde(rename = "other")]
41    Other,
42}
43#[allow(deprecated)]
44#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
45pub enum LogEntryLevel {
46    #[serde(rename = "verbose")]
47    Verbose,
48    #[serde(rename = "info")]
49    Info,
50    #[serde(rename = "warning")]
51    Warning,
52    #[serde(rename = "error")]
53    Error,
54}
55#[allow(deprecated)]
56#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
57pub enum LogEntryCategory {
58    #[serde(rename = "cors")]
59    Cors,
60}
61#[allow(deprecated)]
62#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
63pub enum ViolationSettingName {
64    #[serde(rename = "longTask")]
65    LongTask,
66    #[serde(rename = "longLayout")]
67    LongLayout,
68    #[serde(rename = "blockedEvent")]
69    BlockedEvent,
70    #[serde(rename = "blockedParser")]
71    BlockedParser,
72    #[serde(rename = "discouragedAPIUse")]
73    DiscouragedApiUse,
74    #[serde(rename = "handler")]
75    Handler,
76    #[serde(rename = "recurringHandler")]
77    RecurringHandler,
78}
79#[allow(deprecated)]
80#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
81#[builder(setter(into, strip_option))]
82#[serde(rename_all = "camelCase")]
83#[doc = "Log entry."]
84pub struct LogEntry {
85    #[doc = "Log entry source."]
86    pub source: LogEntrySource,
87    #[doc = "Log entry severity."]
88    pub level: LogEntryLevel,
89    #[serde(default)]
90    #[doc = "Logged text."]
91    pub text: String,
92    #[builder(default)]
93    #[serde(skip_serializing_if = "Option::is_none")]
94    pub category: Option<LogEntryCategory>,
95    #[doc = "Timestamp when this entry was added."]
96    pub timestamp: runtime::Timestamp,
97    #[builder(default)]
98    #[serde(skip_serializing_if = "Option::is_none")]
99    #[serde(default)]
100    #[doc = "URL of the resource if known."]
101    pub url: Option<String>,
102    #[builder(default)]
103    #[serde(skip_serializing_if = "Option::is_none")]
104    #[serde(default)]
105    #[doc = "Line number in the resource."]
106    pub line_number: Option<JsUInt>,
107    #[builder(default)]
108    #[serde(skip_serializing_if = "Option::is_none")]
109    #[doc = "JavaScript stack trace."]
110    pub stack_trace: Option<runtime::StackTrace>,
111    #[builder(default)]
112    #[serde(skip_serializing_if = "Option::is_none")]
113    #[doc = "Identifier of the network request associated with this entry."]
114    pub network_request_id: Option<network::RequestId>,
115    #[builder(default)]
116    #[serde(skip_serializing_if = "Option::is_none")]
117    #[serde(default)]
118    #[doc = "Identifier of the worker associated with this entry."]
119    pub worker_id: Option<String>,
120    #[builder(default)]
121    #[serde(skip_serializing_if = "Option::is_none")]
122    #[doc = "Call arguments."]
123    pub args: Option<Vec<runtime::RemoteObject>>,
124}
125#[allow(deprecated)]
126#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
127#[builder(setter(into, strip_option))]
128#[serde(rename_all = "camelCase")]
129#[doc = "Violation configuration setting."]
130pub struct ViolationSetting {
131    #[doc = "Violation type."]
132    pub name: ViolationSettingName,
133    #[serde(default)]
134    #[doc = "Time threshold to trigger upon."]
135    pub threshold: JsFloat,
136}
137#[allow(deprecated)]
138#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
139pub struct Clear(pub Option<Json>);
140#[allow(deprecated)]
141#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
142pub struct Disable(pub Option<Json>);
143#[allow(deprecated)]
144#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
145pub struct Enable(pub Option<Json>);
146#[allow(deprecated)]
147#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
148#[builder(setter(into, strip_option))]
149#[serde(rename_all = "camelCase")]
150#[doc = "start violation reporting."]
151pub struct StartViolationsReport {
152    #[doc = "Configuration for violations."]
153    pub config: Vec<ViolationSetting>,
154}
155#[allow(deprecated)]
156#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
157pub struct StopViolationsReport(pub Option<Json>);
158#[allow(deprecated)]
159#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
160#[doc = "Clears the log."]
161pub struct ClearReturnObject(pub Option<Json>);
162#[allow(deprecated)]
163#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
164#[doc = "Disables log domain, prevents further log entries from being reported to the client."]
165pub struct DisableReturnObject(pub Option<Json>);
166#[allow(deprecated)]
167#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
168#[doc = "Enables log domain, sends the entries collected so far to the client by means of the\n `entryAdded` notification."]
169pub struct EnableReturnObject(pub Option<Json>);
170#[allow(deprecated)]
171#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
172#[doc = "start violation reporting."]
173pub struct StartViolationsReportReturnObject(pub Option<Json>);
174#[allow(deprecated)]
175#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
176#[doc = "Stop violation reporting."]
177pub struct StopViolationsReportReturnObject(pub Option<Json>);
178#[allow(deprecated)]
179impl Method for Clear {
180    const NAME: &'static str = "Log.clear";
181    type ReturnObject = ClearReturnObject;
182}
183#[allow(deprecated)]
184impl Method for Disable {
185    const NAME: &'static str = "Log.disable";
186    type ReturnObject = DisableReturnObject;
187}
188#[allow(deprecated)]
189impl Method for Enable {
190    const NAME: &'static str = "Log.enable";
191    type ReturnObject = EnableReturnObject;
192}
193#[allow(deprecated)]
194impl Method for StartViolationsReport {
195    const NAME: &'static str = "Log.startViolationsReport";
196    type ReturnObject = StartViolationsReportReturnObject;
197}
198#[allow(deprecated)]
199impl Method for StopViolationsReport {
200    const NAME: &'static str = "Log.stopViolationsReport";
201    type ReturnObject = StopViolationsReportReturnObject;
202}
203#[allow(dead_code)]
204pub mod events {
205    #[allow(unused_imports)]
206    use super::super::types::*;
207    #[allow(unused_imports)]
208    use derive_builder::Builder;
209    #[allow(unused_imports)]
210    use serde::{Deserialize, Serialize};
211    #[allow(unused_imports)]
212    use serde_json::Value as Json;
213    #[allow(deprecated)]
214    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
215    pub struct EntryAddedEvent {
216        pub params: EntryAddedEventParams,
217    }
218    #[allow(deprecated)]
219    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
220    #[serde(rename_all = "camelCase")]
221    pub struct EntryAddedEventParams {
222        #[doc = "The entry."]
223        pub entry: super::LogEntry,
224    }
225}