DiagnosticLogger is a ProcessWire module designed to handle diagnostic logs and create notifications in the admin GUI. It can also send automated email summaries for warnings and errors found in these logs.
- Log Handling: Captures and processes diagnostic logs.
- Admin Notifications: Displays notifications within the admin GUI for detected issues.
- Email Summaries: Sends automated emails summarizing warnings and errors.
The module integrates with ProcessDiagnostics, which is required for its functionality. It is designed to work seamlessly with ProcessDiagnostics but is not highly configurable.
I wasn't able to accomplish this in the hook from inside the DiagnosticLogger class so you need to add these lines in the ProcessDiagnostics.module file to make this work.
public function ___execute() {
wire('log')->delete('diagnostics'); // to not be redundant
// …
foreach ($results as $caption => $section_results) {
// …
foreach ($section_results as $k => $row) {
// …
wire('log')->save('diagnostics', '|' . $row['title'] . '|' . $row['value'] . '|' . $row['status'] . '|' . $row['action']);
}
}
}
This will log the diagnostics everytime the ProcessDiagnostics runs. I still haven't figured out how to run diagnostics automatically or schedule them.
The logging feature acts as a workaround due to difficulties with running diagnostics in the background. The hooked method from ProcessDiagnostics will need to be made hookable for better integration.
- Access the configuration settings in the ProcessWire admin interface.
- Adjust the settings according to your needs.
For scheduling tasks using LazyCron, for example:
every2Weeks
: Runs tasks every two weeks.everyDay
: Runs tasks every day.everyWeek
: Runs tasks every week.
- Download the module and place it in the
site/modules
directory. - Log in to the ProcessWire admin interface.
- Go to Modules > Refresh.
- Locate DiagnosticLogger and click Install.
Once installed, DiagnosticLogger will automatically start processing diagnostic logs. You can view notifications in the admin GUI and receive email summaries based on your configuration.
- ProcessWire 3.x or later
- ProcessDiagnostics module