ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Normalizes incoming records to remove objects/resources so it's easier to dump to various targets. More...
Public Member Functions | ||||
__construct ($dateFormat=null) | ||||
format (array $record) | ||||
{Formats a log record.
| ||||
formatBatch (array $records) | ||||
{Formats a set of log records.
| ||||
detectAndCleanUtf8 (&$data) | ||||
Detect invalid UTF-8 string characters and convert to valid UTF-8. More... | ||||
Data Fields | |
const | SIMPLE_DATE = "Y-m-d H:i:s" |
Protected Member Functions | |
normalize ($data, $depth=0) | |
normalizeException ($e) | |
toJson ($data, $ignoreErrors=false) | |
Return the JSON representation of a value. More... | |
Protected Attributes | |
$dateFormat | |
Private Member Functions | |
jsonEncode ($data) | |
handleJsonError ($code, $data) | |
Handle a json_encode failure. More... | |
throwEncodeError ($code, $data) | |
Throws an exception according to a given code with a customized message. More... | |
Normalizes incoming records to remove objects/resources so it's easier to dump to various targets.
Definition at line 22 of file NormalizerFormatter.php.
Monolog\Formatter\NormalizerFormatter::__construct | ( | $dateFormat = null | ) |
string | $dateFormat | The format of the timestamp: one supported by DateTime::format |
Definition at line 31 of file NormalizerFormatter.php.
References Monolog\Formatter\NormalizerFormatter\$dateFormat.
Monolog\Formatter\NormalizerFormatter::detectAndCleanUtf8 | ( | & | $data | ) |
Detect invalid UTF-8 string characters and convert to valid UTF-8.
Valid UTF-8 input will be left unmodified, but strings containing invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed original encoding of ISO-8859-15. This conversion may result in incorrect output if the actual encoding was not ISO-8859-15, but it will be clean UTF-8 output and will not rely on expensive and fragile detection algorithms.
Function converts the input in place in the passed variable so that it can be used as a callback for array_walk_recursive.
mixed | &$data | Input to check and convert if needed |
Definition at line 299 of file NormalizerFormatter.php.
Referenced by Monolog\Formatter\NormalizerFormatter\handleJsonError().
Monolog\Formatter\NormalizerFormatter::format | ( | array | $record | ) |
{Formats a log record.
array | $record | A record to format |
Implements Monolog\Formatter\FormatterInterface.
Definition at line 42 of file NormalizerFormatter.php.
References Monolog\Formatter\NormalizerFormatter\normalize().
Referenced by Monolog\Formatter\NormalizerFormatter\formatBatch().
Monolog\Formatter\NormalizerFormatter::formatBatch | ( | array | $records | ) |
{Formats a set of log records.
array | $records | A set of records to format |
Implements Monolog\Formatter\FormatterInterface.
Definition at line 50 of file NormalizerFormatter.php.
References $key, $records, and Monolog\Formatter\NormalizerFormatter\format().
|
private |
Handle a json_encode failure.
If the failure is due to invalid string encoding, try to clean the input and encode again. If the second encoding attempt fails, the inital error is not encoding related or the input can't be cleaned then raise a descriptive exception.
int | $code | return code of json_last_error function |
mixed | $data | data that was meant to be encoded |
Definition at line 231 of file NormalizerFormatter.php.
References $code, $data, Monolog\Formatter\NormalizerFormatter\detectAndCleanUtf8(), Monolog\Formatter\NormalizerFormatter\jsonEncode(), and Monolog\Formatter\NormalizerFormatter\throwEncodeError().
Referenced by Monolog\Formatter\NormalizerFormatter\toJson().
|
private |
mixed | $data |
Definition at line 209 of file NormalizerFormatter.php.
References $data.
Referenced by Monolog\Formatter\NormalizerFormatter\handleJsonError(), and Monolog\Formatter\NormalizerFormatter\toJson().
|
protected |
Definition at line 59 of file NormalizerFormatter.php.
References $data, $key, Monolog\Utils\getClass(), Monolog\Formatter\NormalizerFormatter\normalizeException(), and Monolog\Formatter\NormalizerFormatter\toJson().
Referenced by Monolog\Formatter\HtmlFormatter\convertToString(), Monolog\Formatter\NormalizerFormatter\format(), Monolog\Formatter\NormalizerFormatter\normalizeException(), and Monolog\Formatter\ScalarFormatter\normalizeValue().
|
protected |
Definition at line 122 of file NormalizerFormatter.php.
References $data, Monolog\Utils\getClass(), Monolog\Formatter\NormalizerFormatter\normalize(), and Monolog\Formatter\NormalizerFormatter\toJson().
Referenced by Monolog\Formatter\NormalizerFormatter\normalize().
|
private |
Throws an exception according to a given code with a customized message.
int | $code | return code of json_last_error function |
mixed | $data | data that was meant to be encoded |
Definition at line 261 of file NormalizerFormatter.php.
Referenced by Monolog\Formatter\NormalizerFormatter\handleJsonError().
|
protected |
Return the JSON representation of a value.
mixed | $data | |
bool | $ignoreErrors |
Definition at line 189 of file NormalizerFormatter.php.
References $data, Monolog\Formatter\NormalizerFormatter\handleJsonError(), and Monolog\Formatter\NormalizerFormatter\jsonEncode().
Referenced by Monolog\Formatter\LineFormatter\convertToString(), Monolog\Formatter\WildfireFormatter\format(), Monolog\Formatter\LogstashFormatter\format(), Monolog\Formatter\JsonFormatter\format(), Monolog\Formatter\GelfMessageFormatter\format(), Monolog\Formatter\JsonFormatter\formatBatchJson(), Monolog\Formatter\NormalizerFormatter\normalize(), Monolog\Formatter\NormalizerFormatter\normalizeException(), and Monolog\Formatter\ScalarFormatter\normalizeValue().
|
protected |
Definition at line 26 of file NormalizerFormatter.php.
Referenced by Monolog\Formatter\NormalizerFormatter\__construct(), Monolog\Formatter\LineFormatter\__construct(), and Monolog\Formatter\HtmlFormatter\__construct().
const Monolog\Formatter\NormalizerFormatter::SIMPLE_DATE = "Y-m-d H:i:s" |
Definition at line 24 of file NormalizerFormatter.php.