Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created September 3, 2018 22:35
Show Gist options
  • Save tommcfarlin/d8bed85851dad283183d84a819dd6c9a to your computer and use it in GitHub Desktop.
Save tommcfarlin/d8bed85851dad283183d84a819dd6c9a to your computer and use it in GitHub Desktop.
[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