示例#1
0
/**
 * The default log handler prints out the log.
 *
 * @since 3.0.0
 *
 * @param string|array $log The log data.
 * @param string $caller The calling function.
 */
function wl_write_log_handler($log, $caller = null)
{
    if (true === WP_DEBUG) {
        if (is_array($log) || is_object($log)) {
            error_log("[ {$caller} ] " . print_r($log, true));
        } else {
            error_log("[ {$caller} ] " . wl_write_log_hide_key($log));
        }
    }
}
示例#2
0
/**
 * The default log handler prints out the log.
 *
 * @since 3.0.0
 *
 * @param string|array $log The log data.
 * @param string $caller The calling function.
 */
function wl_write_log_handler($log, $caller = null)
{
    global $wl_logger;
    if (true === WP_DEBUG) {
        $message = (isset($caller) ? sprintf('[%-40.40s] ', $caller) : '') . (is_array($log) || is_object($log) ? print_r($log, true) : wl_write_log_hide_key($log));
        if (isset($wl_logger)) {
            $wl_logger->info($message);
        } else {
            error_log($message);
        }
    }
}
示例#3
0
/**
 * Echo the log data to the terminal.
 *
 * @param $log The log data.
 */
function wl_test_write_log_handler($log)
{
    if (is_array($log) || is_object($log)) {
        echo print_r($log, true) . "\n";
    } else {
        echo wl_write_log_hide_key($log) . "\n";
    }
}