54 private function addRow($th, $td =
' ', $escapeTd =
true)
56 $th = htmlspecialchars($th, ENT_NOQUOTES,
'UTF-8');
58 $td =
'<pre>'.htmlspecialchars($td, ENT_NOQUOTES,
'UTF-8').
'</pre>';
61 return "<tr style=\"padding: 4px;spacing: 0;text-align: left;\">\n<th style=\"background: #cccccc\" width=\"100px\">$th:</th>\n<td style=\"padding: 4px;spacing: 0;text-align: left;background: #eeeeee\">".$td.
"</td>\n</tr>";
73 $title = htmlspecialchars($title, ENT_NOQUOTES,
'UTF-8');
75 return '<h1 style="background: '.$this->logLevels[$level].
';color: #ffffff;padding: 5px;" class="monolog-output">'.$title.
'</h1>';
83 public function format(array $record)
85 $output = $this->
addTitle($record[
'level_name'], $record[
'level']);
86 $output .=
'<table cellspacing="1" width="100%" class="monolog-output">';
88 $output .= $this->
addRow(
'Message', (
string) $record[
'message']);
89 $output .= $this->
addRow(
'Time', $record[
'datetime']->
format($this->dateFormat));
90 $output .= $this->
addRow(
'Channel', $record[
'channel']);
91 if ($record[
'context']) {
92 $embeddedTable =
'<table cellspacing="1" width="100%">';
93 foreach ($record[
'context'] as $key => $value) {
96 $embeddedTable .=
'</table>';
97 $output .= $this->
addRow(
'Context', $embeddedTable,
false);
99 if ($record[
'extra']) {
100 $embeddedTable =
'<table cellspacing="1" width="100%">';
101 foreach ($record[
'extra'] as $key => $value) {
104 $embeddedTable .=
'</table>';
105 $output .= $this->
addRow(
'Extra', $embeddedTable,
false);
108 return $output.
'</table>';
121 $message .= $this->
format($record);
130 return (
string)
$data;
134 if (version_compare(PHP_VERSION,
'5.4.0',
'>=')) {
135 return json_encode(
$data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
138 return str_replace(
'\\/',
'/', json_encode(
$data));
const EMERGENCY
Urgent alert.
const ERROR
Runtime errors.
const CRITICAL
Critical conditions.
const WARNING
Exceptional occurrences that are not errors.
const INFO
Interesting events.
const DEBUG
Detailed debug information.
const NOTICE
Uncommon events.
const ALERT
Action must be taken immediately.