log.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // Package log provides the Chrome DevTools Protocol
  2. // commands, types, and events for the Log domain.
  3. //
  4. // Provides access to log entries.
  5. //
  6. // Generated by the cdproto-gen command.
  7. package log
  8. // Code generated by cdproto-gen. DO NOT EDIT.
  9. import (
  10. "context"
  11. "github.com/chromedp/cdproto/cdp"
  12. )
  13. // ClearParams clears the log.
  14. type ClearParams struct{}
  15. // Clear clears the log.
  16. //
  17. // See: https://chromedevtools.github.io/devtools-protocol/tot/Log#method-clear
  18. func Clear() *ClearParams {
  19. return &ClearParams{}
  20. }
  21. // Do executes Log.clear against the provided context.
  22. func (p *ClearParams) Do(ctx context.Context) (err error) {
  23. return cdp.Execute(ctx, CommandClear, nil, nil)
  24. }
  25. // DisableParams disables log domain, prevents further log entries from being
  26. // reported to the client.
  27. type DisableParams struct{}
  28. // Disable disables log domain, prevents further log entries from being
  29. // reported to the client.
  30. //
  31. // See: https://chromedevtools.github.io/devtools-protocol/tot/Log#method-disable
  32. func Disable() *DisableParams {
  33. return &DisableParams{}
  34. }
  35. // Do executes Log.disable against the provided context.
  36. func (p *DisableParams) Do(ctx context.Context) (err error) {
  37. return cdp.Execute(ctx, CommandDisable, nil, nil)
  38. }
  39. // EnableParams enables log domain, sends the entries collected so far to the
  40. // client by means of the entryAdded notification.
  41. type EnableParams struct{}
  42. // Enable enables log domain, sends the entries collected so far to the
  43. // client by means of the entryAdded notification.
  44. //
  45. // See: https://chromedevtools.github.io/devtools-protocol/tot/Log#method-enable
  46. func Enable() *EnableParams {
  47. return &EnableParams{}
  48. }
  49. // Do executes Log.enable against the provided context.
  50. func (p *EnableParams) Do(ctx context.Context) (err error) {
  51. return cdp.Execute(ctx, CommandEnable, nil, nil)
  52. }
  53. // StartViolationsReportParams start violation reporting.
  54. type StartViolationsReportParams struct {
  55. Config []*ViolationSetting `json:"config"` // Configuration for violations.
  56. }
  57. // StartViolationsReport start violation reporting.
  58. //
  59. // See: https://chromedevtools.github.io/devtools-protocol/tot/Log#method-startViolationsReport
  60. //
  61. // parameters:
  62. //
  63. // config - Configuration for violations.
  64. func StartViolationsReport(config []*ViolationSetting) *StartViolationsReportParams {
  65. return &StartViolationsReportParams{
  66. Config: config,
  67. }
  68. }
  69. // Do executes Log.startViolationsReport against the provided context.
  70. func (p *StartViolationsReportParams) Do(ctx context.Context) (err error) {
  71. return cdp.Execute(ctx, CommandStartViolationsReport, p, nil)
  72. }
  73. // StopViolationsReportParams stop violation reporting.
  74. type StopViolationsReportParams struct{}
  75. // StopViolationsReport stop violation reporting.
  76. //
  77. // See: https://chromedevtools.github.io/devtools-protocol/tot/Log#method-stopViolationsReport
  78. func StopViolationsReport() *StopViolationsReportParams {
  79. return &StopViolationsReportParams{}
  80. }
  81. // Do executes Log.stopViolationsReport against the provided context.
  82. func (p *StopViolationsReportParams) Do(ctx context.Context) (err error) {
  83. return cdp.Execute(ctx, CommandStopViolationsReport, nil, nil)
  84. }
  85. // Command names.
  86. const (
  87. CommandClear = "Log.clear"
  88. CommandDisable = "Log.disable"
  89. CommandEnable = "Log.enable"
  90. CommandStartViolationsReport = "Log.startViolationsReport"
  91. CommandStopViolationsReport = "Log.stopViolationsReport"
  92. )