error log

Write a variable to the error log via print_r

error_log(print_r($var, true);

Write a variable to the error log via var_dump

function error_log_var_dump( $var ){
    ob_start();
    var_dump( $var );
    $cont = ob_get_contents();
    ob_end_clean();
    error_log( $cont );
}