249 lines
4.6 KiB
Go
249 lines
4.6 KiB
Go
|
// Package log provides the Chrome Debugging Protocol
|
||
|
// commands, types, and events for the Chrome Log domain.
|
||
|
//
|
||
|
// Provides access to log entries.
|
||
|
//
|
||
|
// Generated by the chromedp-gen command.
|
||
|
package log
|
||
|
|
||
|
// AUTOGENERATED. DO NOT EDIT.
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
. "github.com/knq/chromedp/cdp"
|
||
|
"github.com/mailru/easyjson"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
_ BackendNode
|
||
|
_ BackendNodeID
|
||
|
_ ComputedProperty
|
||
|
_ ErrorType
|
||
|
_ Frame
|
||
|
_ FrameID
|
||
|
_ LoaderID
|
||
|
_ Message
|
||
|
_ MessageError
|
||
|
_ MethodType
|
||
|
_ Node
|
||
|
_ NodeID
|
||
|
_ NodeType
|
||
|
_ PseudoType
|
||
|
_ RGBA
|
||
|
_ ShadowRootType
|
||
|
_ Timestamp
|
||
|
)
|
||
|
|
||
|
// EnableParams enables log domain, sends the entries collected so far to the
|
||
|
// client by means of the entryAdded notification.
|
||
|
type EnableParams struct{}
|
||
|
|
||
|
// Enable enables log domain, sends the entries collected so far to the
|
||
|
// client by means of the entryAdded notification.
|
||
|
func Enable() *EnableParams {
|
||
|
return &EnableParams{}
|
||
|
}
|
||
|
|
||
|
// Do executes Log.enable.
|
||
|
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||
|
if ctxt == nil {
|
||
|
ctxt = context.Background()
|
||
|
}
|
||
|
|
||
|
// execute
|
||
|
ch := h.Execute(ctxt, CommandLogEnable, Empty)
|
||
|
|
||
|
// read response
|
||
|
select {
|
||
|
case res := <-ch:
|
||
|
if res == nil {
|
||
|
return ErrChannelClosed
|
||
|
}
|
||
|
|
||
|
switch v := res.(type) {
|
||
|
case easyjson.RawMessage:
|
||
|
return nil
|
||
|
|
||
|
case error:
|
||
|
return v
|
||
|
}
|
||
|
|
||
|
case <-ctxt.Done():
|
||
|
return ErrContextDone
|
||
|
}
|
||
|
|
||
|
return ErrUnknownResult
|
||
|
}
|
||
|
|
||
|
// DisableParams disables log domain, prevents further log entries from being
|
||
|
// reported to the client.
|
||
|
type DisableParams struct{}
|
||
|
|
||
|
// Disable disables log domain, prevents further log entries from being
|
||
|
// reported to the client.
|
||
|
func Disable() *DisableParams {
|
||
|
return &DisableParams{}
|
||
|
}
|
||
|
|
||
|
// Do executes Log.disable.
|
||
|
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||
|
if ctxt == nil {
|
||
|
ctxt = context.Background()
|
||
|
}
|
||
|
|
||
|
// execute
|
||
|
ch := h.Execute(ctxt, CommandLogDisable, Empty)
|
||
|
|
||
|
// read response
|
||
|
select {
|
||
|
case res := <-ch:
|
||
|
if res == nil {
|
||
|
return ErrChannelClosed
|
||
|
}
|
||
|
|
||
|
switch v := res.(type) {
|
||
|
case easyjson.RawMessage:
|
||
|
return nil
|
||
|
|
||
|
case error:
|
||
|
return v
|
||
|
}
|
||
|
|
||
|
case <-ctxt.Done():
|
||
|
return ErrContextDone
|
||
|
}
|
||
|
|
||
|
return ErrUnknownResult
|
||
|
}
|
||
|
|
||
|
// ClearParams clears the log.
|
||
|
type ClearParams struct{}
|
||
|
|
||
|
// Clear clears the log.
|
||
|
func Clear() *ClearParams {
|
||
|
return &ClearParams{}
|
||
|
}
|
||
|
|
||
|
// Do executes Log.clear.
|
||
|
func (p *ClearParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||
|
if ctxt == nil {
|
||
|
ctxt = context.Background()
|
||
|
}
|
||
|
|
||
|
// execute
|
||
|
ch := h.Execute(ctxt, CommandLogClear, Empty)
|
||
|
|
||
|
// read response
|
||
|
select {
|
||
|
case res := <-ch:
|
||
|
if res == nil {
|
||
|
return ErrChannelClosed
|
||
|
}
|
||
|
|
||
|
switch v := res.(type) {
|
||
|
case easyjson.RawMessage:
|
||
|
return nil
|
||
|
|
||
|
case error:
|
||
|
return v
|
||
|
}
|
||
|
|
||
|
case <-ctxt.Done():
|
||
|
return ErrContextDone
|
||
|
}
|
||
|
|
||
|
return ErrUnknownResult
|
||
|
}
|
||
|
|
||
|
// StartViolationsReportParams start violation reporting.
|
||
|
type StartViolationsReportParams struct {
|
||
|
Config []*ViolationSetting `json:"config"` // Configuration for violations.
|
||
|
}
|
||
|
|
||
|
// StartViolationsReport start violation reporting.
|
||
|
//
|
||
|
// parameters:
|
||
|
// config - Configuration for violations.
|
||
|
func StartViolationsReport(config []*ViolationSetting) *StartViolationsReportParams {
|
||
|
return &StartViolationsReportParams{
|
||
|
Config: config,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Do executes Log.startViolationsReport.
|
||
|
func (p *StartViolationsReportParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||
|
if ctxt == nil {
|
||
|
ctxt = context.Background()
|
||
|
}
|
||
|
|
||
|
// marshal
|
||
|
buf, err := easyjson.Marshal(p)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
// execute
|
||
|
ch := h.Execute(ctxt, CommandLogStartViolationsReport, easyjson.RawMessage(buf))
|
||
|
|
||
|
// read response
|
||
|
select {
|
||
|
case res := <-ch:
|
||
|
if res == nil {
|
||
|
return ErrChannelClosed
|
||
|
}
|
||
|
|
||
|
switch v := res.(type) {
|
||
|
case easyjson.RawMessage:
|
||
|
return nil
|
||
|
|
||
|
case error:
|
||
|
return v
|
||
|
}
|
||
|
|
||
|
case <-ctxt.Done():
|
||
|
return ErrContextDone
|
||
|
}
|
||
|
|
||
|
return ErrUnknownResult
|
||
|
}
|
||
|
|
||
|
// StopViolationsReportParams stop violation reporting.
|
||
|
type StopViolationsReportParams struct{}
|
||
|
|
||
|
// StopViolationsReport stop violation reporting.
|
||
|
func StopViolationsReport() *StopViolationsReportParams {
|
||
|
return &StopViolationsReportParams{}
|
||
|
}
|
||
|
|
||
|
// Do executes Log.stopViolationsReport.
|
||
|
func (p *StopViolationsReportParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
||
|
if ctxt == nil {
|
||
|
ctxt = context.Background()
|
||
|
}
|
||
|
|
||
|
// execute
|
||
|
ch := h.Execute(ctxt, CommandLogStopViolationsReport, Empty)
|
||
|
|
||
|
// read response
|
||
|
select {
|
||
|
case res := <-ch:
|
||
|
if res == nil {
|
||
|
return ErrChannelClosed
|
||
|
}
|
||
|
|
||
|
switch v := res.(type) {
|
||
|
case easyjson.RawMessage:
|
||
|
return nil
|
||
|
|
||
|
case error:
|
||
|
return v
|
||
|
}
|
||
|
|
||
|
case <-ctxt.Done():
|
||
|
return ErrContextDone
|
||
|
}
|
||
|
|
||
|
return ErrUnknownResult
|
||
|
}
|