Created
June 3, 2014 18:44
-
-
Save nadavspi/572abb6e3d7983156e2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WP Log/Debug | |
* Author: Nadav Spiegelman | |
*/ | |
/** | |
* turn on WP_DEBUG_LOG but without E_STRICT | |
* http://snippets.webaware.com.au/snippets/wordpress-wp_debug_log-without-e_strict/ | |
*/ | |
$ignore = E_STRICT; | |
if (defined('DEBUG_IGNORE_DEPRECATED') && DEBUG_IGNORE_DEPRECATED) { | |
$ignore |= E_DEPRECATED; | |
} | |
error_reporting(E_ALL ^ $ignore); | |
ini_set('log_errors', 1); | |
ini_set('display_errors', 0); | |
ini_set('error_log', WP_CONTENT_DIR . '/debug.log'); | |
/* http://www.smashingmagazine.com/2011/03/08/ten-things-every-wordpress-plugin-developer-should-know/ */ | |
function log_me($message) { | |
if (is_array($message) || is_object($message)) { | |
error_log(print_r($message, true)); | |
} else { | |
error_log($message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment