Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin tommcfarlin/00-log.php Secret
Created Sep 3, 2018

Embed
What would you like to do?
[WordPress] Writing Messages to the WordPress Debug Log
<?php
/**
* Prints a message to the debug file that can easily be called by any subclass.
*
* @param mixed $message an object, array, string, number, or other data to write to the debug log
* @param bool $shouldNotDie whether or not the The function should exit after writing to the log
*
*/
protected function log($message, $shouldNotDie = true)
{
error_log(print_r($message, true));
if ($shouldNotDie) {
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.