Created
July 23, 2023 09:36
-
-
Save mustardBees/b117477abe642ca3516d2a50e228df6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Write a log entry. | |
* | |
* Helper function to write a log entry with a given title, category, and any | |
* log data. Relies on the Maintenance Functionality mu-plugin being present. | |
* | |
* Usage: | |
* | |
* kanuka_log( 'Data Import', 'import', array( | |
* 'status' => 'success', | |
* 'data' => $data, | |
* ) ); | |
* | |
* @param string $title The title of the log entry. | |
* @param string|null $category The category of the log entry (optional). | |
* @param mixed|null $data The log data to be saved (optional). | |
*/ | |
function kanuka_log( $title, $category = null, $data = null ) { | |
// Bail if our mu-plugin isn't present. | |
if ( ! class_exists( 'Kanuka_Maintenance_Functionality' ) ) { | |
return; | |
} | |
Kanuka_Maintenance_Functionality::log( $title, $category, $data ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment