Add on for Simple History that adds loggers and tools that are useful for developers and admins.
Features:
- New WP-CLI commands:
- search events
- get detailed information for single events
- get db stats
- clear the log
- Log sent emails.
- Log HTTP API requests.
- Log cron jobs.
Coming soon
What’s included
- Developer Tools Plugin
- 1-year of plugin updates (includes new features & security updates)
Version history
- Version 1.0.0 (2023-09-27)
- First version.
Requirements
- WordPress 6.3 or higher
- Simple History 4.7 or higher
- PHP 7.4 or higher
WP-CLI search command
The search command searches the log for any word. In the example below we search for all events that contain the word “WooCommerce”:
WP-CLI db commands
The new “stats” and “clear” commands are used to interact with the database.
❯ wp simple-history db
usage: wp simple-history db clear
or: wp simple-history db stats [--format=]
Code language: plaintext (plaintext)
The “stats” command gives you some short information about the sizes, in mb and in row count, of the databases that Simple History uses:
❯ wp simple-history db stats
+-----------------------------------+------------+----------+
| table_name | size_in_mb | num_rows |
+-----------------------------------+------------+----------+
| wp_stable_simple_history | 0.34 | 1143 |
| wp_stable_simple_history_contexts | 6.20 | 12151 |
+-----------------------------------+------------+----------+
WP-CLI get command
The get command retrieves detailed information about a single event:
❯ wp simple-history get 1072
+-----------------------------+-------------------------------------------------------------+
| Field | Value |
+-----------------------------+-------------------------------------------------------------+
| ID | 1072 |
| date | 2024-02-26 07:13:19 |
| initiator | WordPress |
| message | WordPress auto-updated to 6.4.3 from 6.4.2 |
| via | null |
| logger | SimpleCoreUpdatesLogger |
| level | notice |
| count | 1 |
| _message_key | core_auto_updated |
| _message | WordPress auto-updated to {new_version} from {prev_version} |
| _initiator | wp |
| context_prev_version | 6.4.2 |
| context_new_version | 6.4.3 |
| context__message_key | core_auto_updated |
| context__wp_cron_running | true |
| context__server_remote_addr | 127.0.0.1 |
+-----------------------------+-------------------------------------------------------------+
Code language: plaintext (plaintext)
The clear command removes all items from the database:
❯ wp simple-history db clear
Are you sure you want to clear all logged items? [y/n] y
Success: Removed 1145 rows.
Code language: plaintext (plaintext)
Log emails sent via WP-Mail
The WP-Mail Logger catches all emails send using the built in wp_mail() function and adds them to the log. You’ll get a quick preview of sent emails, including subject, recipients, and content. A nice way for developers and other curious users who wants to know what’s being sent from their WordPress sites.
If an email for some reason can no be sent, details about these failures are also logged:
Using the new WP-CLI commands you can easy retrieve the email details from the terminal.
In the example below we use the terminal commands WP-CLI and jq together to show details about a single history event, and to only show the message_interpolated
and event_details
fields.
Log outgoing HTTP requests
With the HTTP Requests logger you can log and inspect any outgoing HTTP requests made with for example wp_remote_request()
, wp_remote_get()
, wp_remote_post()
or the WP_HTTP class
directly.
This is a great debug tool during development of sites when you need to debug outgoing API requests.
When a lot of requests are being requested to the same base URL, the requests are grouped together. So for example all calls to wp-cron.php
won’t pollute your screen with 16 items, but rather just one where you can choose to show all other requests to the same URL.
Log cron events that have run
The WP-Cron logger logs wp cron jobs that have run.
In the log you can see when cron jobs are ran and view details about function called, arguments passed, their schedule, and so on.
A useful debugging tool for developers that are implementing or debugging wp cron jobs.
Details about the cron event includes hook, timestamp, arguments, and hook information.
Coming soon
What’s included
- Developer Tools Plugin
- 1-year of plugin updates (includes new features & security updates)
Version history
- Version 1.0.0 (2023-09-27)
- First version.
Requirements
- WordPress 6.3 or higher
- Simple History 4.7 or higher
- PHP 7.4 or higher