LineFormatter
extends NormalizerFormatter
in package
Formats incoming records into a one-line string
This is especially useful for logging to files
Tags
Table of Contents
Constants
- SIMPLE_DATE = "Y-m-d H:i:s"
- SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"
Properties
- $allowInlineLineBreaks : mixed
- $dateFormat : mixed
- $format : mixed
- $ignoreEmptyContextAndExtra : mixed
- $includeStacktraces : mixed
Methods
- __construct() : mixed
- allowInlineLineBreaks() : mixed
- format() : mixed
- Formats a log record.
- formatBatch() : mixed
- Formats a set of log records.
- ignoreEmptyContextAndExtra() : mixed
- includeStacktraces() : mixed
- stringify() : mixed
- convertToString() : mixed
- normalize() : mixed
- normalizeException() : mixed
- replaceNewlines() : mixed
- toJson() : string
- Return the JSON representation of a value
Constants
SIMPLE_DATE
public
mixed
SIMPLE_DATE
= "Y-m-d H:i:s"
SIMPLE_FORMAT
public
mixed
SIMPLE_FORMAT
= "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"
Properties
$allowInlineLineBreaks
protected
mixed
$allowInlineLineBreaks
$dateFormat
protected
mixed
$dateFormat
$format
protected
mixed
$format
$ignoreEmptyContextAndExtra
protected
mixed
$ignoreEmptyContextAndExtra
$includeStacktraces
protected
mixed
$includeStacktraces
Methods
__construct()
public
__construct([string $format = null ][, string $dateFormat = null ][, bool $allowInlineLineBreaks = false ][, bool $ignoreEmptyContextAndExtra = false ]) : mixed
Parameters
- $format : string = null
-
The format of the message
- $dateFormat : string = null
-
The format of the timestamp: one supported by DateTime::format
- $allowInlineLineBreaks : bool = false
-
Whether to allow inline line breaks in log entries
- $ignoreEmptyContextAndExtra : bool = false
allowInlineLineBreaks()
public
allowInlineLineBreaks([mixed $allow = true ]) : mixed
Parameters
- $allow : mixed = true
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
ignoreEmptyContextAndExtra()
public
ignoreEmptyContextAndExtra([mixed $ignore = true ]) : mixed
Parameters
- $ignore : mixed = true
includeStacktraces()
public
includeStacktraces([mixed $include = true ]) : mixed
Parameters
- $include : mixed = true
stringify()
public
stringify(mixed $value) : mixed
Parameters
- $value : mixed
convertToString()
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
replaceNewlines()
protected
replaceNewlines(mixed $str) : mixed
Parameters
- $str : mixed
toJson()
Return the JSON representation of a value
protected
toJson(mixed $data[, bool $ignoreErrors = false ]) : string
Parameters
- $data : mixed
- $ignoreErrors : bool = false