=== ErrorWatcher ===
Contributors: itpathsolutions,parthsanghvi
Tags: error-log, debugging, debug, monitoring, log
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Real-time PHP error, warning, notice, and deprecation monitor with a dedicated admin dashboard, smart deduplication, and automated email digests.

== Description ==

**ErrorWatcher** provides real-time monitoring of PHP errors, warnings, notices, and deprecated function calls with a clean, native dashboard to inspect and troubleshoot them without creating database bloat.

Unlike manually inspecting large `debug.log` files on your server or modifying `wp-config.php`, ErrorWatcher captures runtime errors safely, stores them in a lightweight runtime file, and sends twice-daily summary email digests with `.txt` log attachments.

### Key Features

* **WordPress-Native Admin Interface:** View summary metric cards (Total, Fatal, Errors, Warnings, Notices, Deprecated) and real-time logs table.
* **Granular Error Capturing:** Captures PHP Fatal Errors, Catchable Errors, Warnings, Notices, Deprecated warnings, User Errors, and Uncaught Exceptions.
* **Detailed Diagnostics Drawer:** Inspect full error messages, stack traces, HTTP request method/URL, user account context, client IP, and grouped sibling issues.
* **Smart File Clustering:** Automatically groups multiple issues originating from the same file to prevent table clutter and streamline debugging.
* **Advanced Filtering & Search:** Filter by error severity/type, search messages/files/URLs, or filter by custom date ranges (Today, 7 days, 30 days, or custom calendar dates).
* **Twice-Daily Email Reports:** Automatically dispatches scheduled digests at custom morning and evening hours using WP-Cron with formatted HTML summary and attached `.txt` log file.
* **Automated Retention & Pruning:** Automatically prunes resolved errors when source files are modified and clears inactive logs older than 30 days via daily WP-Cron.
* **Export Capability:** Export filtered error logs directly to CSV or formatted Text (.txt) files.
* **Minimal Overhead & Performance-First:** Uses server-side pagination, request-level error deduplication to prevent floods in loops, and zero frontend performance penalty.
* **Safe & Non-Intrusive:** Does not modify `wp-config.php` and does not turn on frontend error display.

### Technical & PHP Limitations Notice

* **Runtime Error Handling:** Captures runtime errors, warnings, notices, deprecations, and fatal shutdown errors during WordPress request execution.
* **Pre-Boot Compile/Parse Errors:** Fatal compile-time or syntax errors that occur before WordPress or the plugin loads (such as syntax errors inside `wp-config.php` or early `mu-plugins`) cannot be intercepted by PHP runtime error handlers.
* **Memory Limits:** An emergency memory buffer is pre-allocated and released on shutdown to capture Out-of-Memory fatals when possible.

== Installation ==

1. Upload the `errorwatcher` folder to the `/wp-content/plugins/` directory, or install the ZIP file via **Plugins > Add New > Upload Plugin**.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Navigate to **ErrorWatcher** in the WordPress admin menu to view logs and customize settings.

== Frequently Asked Questions ==

= Does ErrorWatcher display errors on the frontend? =

No. Errors are intercepted in the background and stored safely. Frontend visitors see normal pages.

= Does this plugin modify my wp-config.php file? =

No. It does not touch your `wp-config.php` file or alter your global `WP_DEBUG` configuration.

= How does log deduplication work? =

If a faulty loop triggers the same notice or warning hundreds of times within a single request, the plugin records it once per request with in-memory hashing to prevent flooding.

= Can I send reports to multiple email addresses? =

Yes. You can enter multiple recipient email addresses separated by commas (e.g. dev@example.com, admin@example.com) in **ErrorWatcher > Settings**.

== Screenshots ==

1. General Monitoring Settings: Toggle backend PHP error monitoring and customize granular error levels to capture (Fatal, Recoverable, Warnings, Notices, Deprecated).
2. Automated Email Digests: Schedule twice-daily automated error summary emails with attached log files and custom morning/evening delivery hours.
3. ErrorWatcher Dashboard: Real-time overview featuring summary metric cards (Total, Fatal Errors, Exceptions, Warnings, Notices, Deprecated) and filtered logs table.
4. Error Diagnostics Drawer: Comprehensive error details with exact file location, line number, HTTP request context, interactive stack trace, and grouped sibling issues per file.

== Changelog ==

= 1.0.5 =
* Standardized all functions, classes, constants, hooks, options, and assets with unique errorwatcher_ prefix.
* Fixed log aggregation and export flattening so all grouped sibling errors appear accurately in CSV/TXT exports and scheduled email attachments.
* Synchronized scheduled email digest metrics with the active reporting timeframe.

= 1.0.0 =
* Initial release of ErrorWatcher.

== Upgrade Notice ==

= 1.0.5 =
Maintenance and stability release with enhanced log aggregation and scheduled email digest fixes.
