HtmlFormatter
extends NormalizerFormatter
in package
Formats incoming records into an HTML table
This is especially useful for html email logging
Tags
Table of Contents
Constants
- SIMPLE_DATE = "Y-m-d H:i:s"
Properties
- $dateFormat : mixed
- $logLevels : mixed
- Translates Monolog log levels to html color priorities.
Methods
- __construct() : mixed
- format() : mixed
- Formats a log record.
- formatBatch() : mixed
- Formats a set of log records.
- addRow() : string
- Creates an HTML table row
- addTitle() : string
- Create a HTML h1 tag
- convertToString() : mixed
- normalize() : mixed
- normalizeException() : mixed
- toJson() : string
- Return the JSON representation of a value
Constants
SIMPLE_DATE
public
mixed
SIMPLE_DATE
= "Y-m-d H:i:s"
Properties
$dateFormat
protected
mixed
$dateFormat
$logLevels
Translates Monolog log levels to html color priorities.
protected
mixed
$logLevels
= array(\Monolog\Logger::DEBUG => '#cccccc', \Monolog\Logger::INFO => '#468847', \Monolog\Logger::NOTICE => '#3a87ad', \Monolog\Logger::WARNING => '#c09853', \Monolog\Logger::ERROR => '#f0ad4e', \Monolog\Logger::CRITICAL => '#FF7708', \Monolog\Logger::ALERT => '#C12A19', \Monolog\Logger::EMERGENCY => '#000000')
Methods
__construct()
public
__construct([string $dateFormat = null ]) : mixed
Parameters
- $dateFormat : string = null
-
The format of the timestamp: one supported by DateTime::format
format()
Formats a log record.
public
format(array<string|int, mixed> $record) : mixed
Parameters
- $record : array<string|int, mixed>
-
A record to format
Return values
mixed —The formatted record
formatBatch()
Formats a set of log records.
public
formatBatch(array<string|int, mixed> $records) : mixed
Parameters
- $records : array<string|int, mixed>
-
A set of records to format
Return values
mixed —The formatted set of records
addRow()
Creates an HTML table row
protected
addRow(string $th[, string $td = ' ' ][, bool $escapeTd = true ]) : string
Parameters
- $th : string
-
Row header content
- $td : string = ' '
-
Row standard cell content
- $escapeTd : bool = true
-
false if td content must not be html escaped
Return values
stringaddTitle()
Create a HTML h1 tag
protected
addTitle(string $title, int $level) : string
Parameters
- $title : string
-
Text to be in the h1
- $level : int
-
Error level
Return values
stringconvertToString()
protected
convertToString(mixed $data) : mixed
Parameters
- $data : mixed
normalize()
protected
normalize(mixed $data[, mixed $depth = 0 ]) : mixed
Parameters
- $data : mixed
- $depth : mixed = 0
normalizeException()
protected
normalizeException(mixed $e) : mixed
Parameters
- $e : mixed
toJson()
Return the JSON representation of a value
protected
toJson(mixed $data[, bool $ignoreErrors = false ]) : string
Parameters
- $data : mixed
- $ignoreErrors : bool = false