/**
* Writes string, array, and object data to the WP error log.
*
* To use, pass the result to write to the log as follows:
* write_log( $value_to_write );
*
* @param string|array|object $log
*/
function write_log( $log ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
error_log( $log );
}
}
Error log utility function
This post brought to you by RocketGeek, ButlerBlog, and the following: