protected function process($data, $display, $level)
{
// plugin can return false to stop the default logging method
$params = array('level' => $level, 'msg' => $data, 'display' => $display, 'to_screen' => $display);
if (!$this->hooks->trigger('debug', 'log', $params, true)) {
return;
}
// Do not want to write to JS or CSS pages
if ($this->context->contains('js') || $this->context->contains('css')) {
$display = false;
}
// don't display in simplecache requests
$path = substr(current_page_url(), strlen(elgg_get_site_url()));
if (preg_match('~^(cache|action|serve-file)/~', $path)) {
$display = false;
}
if ($display == true) {
echo '<pre class="elgg-logger-data">';
echo htmlspecialchars(print_r($data, true), ENT_QUOTES, 'UTF-8');
echo '</pre>';
}
error_log(print_r($data, true));
}