Log only when WP_DEBUG == true
This commit is contained in:
parent
5ee8aba026
commit
160a4e7326
|
@ -20,7 +20,7 @@
|
||||||
Plugin Name: owark
|
Plugin Name: owark
|
||||||
Plugin URI: http://owark.org
|
Plugin URI: http://owark.org
|
||||||
Description: Tired of broken links? Archive yours with owark, the Open Web Archive!
|
Description: Tired of broken links? Archive yours with owark, the Open Web Archive!
|
||||||
Version: 1.0
|
Version: 1.0.1
|
||||||
Author: Eric van der Vlist
|
Author: Eric van der Vlist
|
||||||
Author URI: http://eric.van-der-vlist.com
|
Author URI: http://eric.van-der-vlist.com
|
||||||
License: GLP2
|
License: GLP2
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
if (!function_exists('print_r_log')) {
|
if (!function_exists('print_r_log')) {
|
||||||
|
|
||||||
function print_r_log($log) {
|
function print_r_log($log) {
|
||||||
|
if (defined('WP_DEBUG') && WP_DEBUG == true) {
|
||||||
$caller_strace = debug_backtrace()[1];
|
$caller_strace = debug_backtrace()[1];
|
||||||
if (is_array($log) || is_object($log)) {
|
if (is_array($log) || is_object($log)) {
|
||||||
error_log($caller_strace['file'] . '/#' . $caller_strace['line'] . ':');
|
error_log($caller_strace['file'] . '/#' . $caller_strace['line'] . ':');
|
||||||
|
@ -41,18 +42,21 @@ if (!function_exists('print_r_log')) {
|
||||||
error_log($caller_strace['file'] . '/#' . $caller_strace['line'] . ': ' . $log);
|
error_log($caller_strace['file'] . '/#' . $caller_strace['line'] . ': ' . $log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('log_function_call')) {
|
if (!function_exists('log_function_call')) {
|
||||||
|
|
||||||
function log_function_call() {
|
function log_function_call() {
|
||||||
|
if (defined('WP_DEBUG') && WP_DEBUG == true) {
|
||||||
$caller_strace = debug_backtrace()[1];
|
$caller_strace = debug_backtrace()[1];
|
||||||
error_log((isset($caller_strace['file']) ? $caller_strace['file'] : '<undefined>') . '/#' . (isset($caller_strace['line']) ? $caller_strace['line'] : '<undefined>') . ' function: ' . (isset($caller_strace['function']) ? $caller_strace['function'] : '<undefined>') . '(');
|
error_log((isset($caller_strace['file']) ? $caller_strace['file'] : '<undefined>') . '/#' . (isset($caller_strace['line']) ? $caller_strace['line'] : '<undefined>') . ' function: ' . (isset($caller_strace['function']) ? $caller_strace['function'] : '<undefined>') . '(');
|
||||||
foreach ($caller_strace['args'] as $arg) {
|
foreach ($caller_strace['args'] as $arg) {
|
||||||
error_log(' * ' . gettype($arg) . ': ' . print_r($arg, true));
|
error_log(' * ' . gettype($arg) . ': ' . print_r($arg, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue