forked from chromedp/chromedp
/
types.go
207 lines (178 loc) · 5.67 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
package log
// AUTOGENERATED. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/network"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Entry log entry.
type Entry struct {
Source Source `json:"source,omitempty"` // Log entry source.
Level Level `json:"level,omitempty"` // Log entry severity.
Text string `json:"text,omitempty"` // Logged text.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp when this entry was added.
URL string `json:"url,omitempty"` // URL of the resource if known.
LineNumber int64 `json:"lineNumber,omitempty"` // Line number in the resource.
StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"` // JavaScript stack trace.
NetworkRequestID network.RequestID `json:"networkRequestId,omitempty"` // Identifier of the network request associated with this entry.
WorkerID string `json:"workerId,omitempty"` // Identifier of the worker associated with this entry.
}
// ViolationSetting violation configuration setting.
type ViolationSetting struct {
Name Violation `json:"name,omitempty"` // Violation type.
Threshold float64 `json:"threshold,omitempty"` // Time threshold to trigger upon.
}
// Source log entry source.
type Source string
// String returns the Source as string value.
func (t Source) String() string {
return string(t)
}
// Source values.
const (
SourceXML Source = "xml"
SourceJavascript Source = "javascript"
SourceNetwork Source = "network"
SourceStorage Source = "storage"
SourceAppcache Source = "appcache"
SourceRendering Source = "rendering"
SourceSecurity Source = "security"
SourceDeprecation Source = "deprecation"
SourceWorker Source = "worker"
SourceViolation Source = "violation"
SourceIntervention Source = "intervention"
SourceOther Source = "other"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Source) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t Source) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Source) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch Source(in.String()) {
case SourceXML:
*t = SourceXML
case SourceJavascript:
*t = SourceJavascript
case SourceNetwork:
*t = SourceNetwork
case SourceStorage:
*t = SourceStorage
case SourceAppcache:
*t = SourceAppcache
case SourceRendering:
*t = SourceRendering
case SourceSecurity:
*t = SourceSecurity
case SourceDeprecation:
*t = SourceDeprecation
case SourceWorker:
*t = SourceWorker
case SourceViolation:
*t = SourceViolation
case SourceIntervention:
*t = SourceIntervention
case SourceOther:
*t = SourceOther
default:
in.AddError(errors.New("unknown Source value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Source) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Level log entry severity.
type Level string
// String returns the Level as string value.
func (t Level) String() string {
return string(t)
}
// Level values.
const (
LevelVerbose Level = "verbose"
LevelInfo Level = "info"
LevelWarning Level = "warning"
LevelError Level = "error"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Level) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t Level) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Level) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch Level(in.String()) {
case LevelVerbose:
*t = LevelVerbose
case LevelInfo:
*t = LevelInfo
case LevelWarning:
*t = LevelWarning
case LevelError:
*t = LevelError
default:
in.AddError(errors.New("unknown Level value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Level) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Violation violation type.
type Violation string
// String returns the Violation as string value.
func (t Violation) String() string {
return string(t)
}
// Violation values.
const (
ViolationLongTask Violation = "longTask"
ViolationLongLayout Violation = "longLayout"
ViolationBlockedEvent Violation = "blockedEvent"
ViolationBlockedParser Violation = "blockedParser"
ViolationHandler Violation = "handler"
ViolationRecurringHandler Violation = "recurringHandler"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Violation) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t Violation) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Violation) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch Violation(in.String()) {
case ViolationLongTask:
*t = ViolationLongTask
case ViolationLongLayout:
*t = ViolationLongLayout
case ViolationBlockedEvent:
*t = ViolationBlockedEvent
case ViolationBlockedParser:
*t = ViolationBlockedParser
case ViolationHandler:
*t = ViolationHandler
case ViolationRecurringHandler:
*t = ViolationRecurringHandler
default:
in.AddError(errors.New("unknown Violation value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Violation) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}