Skip to content

Instantly share code, notes, and snippets.

@anthonylrivera
Created September 22, 2014 20:22
Show Gist options
  • Save anthonylrivera/77b2689cf7143998afe9 to your computer and use it in GitHub Desktop.
Save anthonylrivera/77b2689cf7143998afe9 to your computer and use it in GitHub Desktop.
Functions to help debug and log to wp-content/debug.log
<?php
/* wp-content/themes/[THEME]/functions.php */
if(!function_exists('_log')){
function _log( $message ) {
if( WP_DEBUG === true )
( is_array( $message ) || is_object( $message ) ) ? error_log( print_r( $message, true ) ) : error_log( $message );
}
}
// _log('Testing the error message logging');
// _log(array('it' => 'works'));
if ( function_exists('_log') ) {
_log('_____________________________________________________');
_log( ' MESSAGE' . $ MESSAGE );
}
/* ------------------------------------------------------------------------*/
/* wp-config.php */
//*
@ini_set('display_errors',0);
define('WP_DEBUG', true); // Turn debugging ON
define('WP_DEBUG_DISPLAY', false); // Turn forced display OFF
define('WP_DEBUG_LOG', true); // Turn logging to wp-content/debug.log ON
define('SAVEQUERIES', TRUE);
//*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment