Skip to content

Add HTTP request logging #6044

@swissspidy

Description

@swissspidy

Feature Request

Describe your use case and the problem you are facing

After #6036, one idea that came up is that right now there isn't any visibility into all the outgoing HTTP requests made by WP-CLI.

Such information could be really useful though for debugging and identifying slow parts of the code base.

Describe the solution you'd like

Some ideas on how the HTTP request logging could be implemented:

  • Add new bootstrap step that hooks into the http_request_options CLI hook and the pre_http_request WP hook (in \WP_CLI\Runner::setup_bootstrap_hooks perhaps?)
  • The hook would would only print a minimal debug message such as HTTP POST request to https://....
    • This would use a dedicated http debug group
  • The full request & response info could optionally be written to a log file (useful for Behat tests)
    • How could this be made opt-in?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions