Context
in package
FinalYes
Log context utility class
Tags
Table of Contents
Methods
- sanitize() : string
- Strip CR/LF from a value before it's written into a delimited/line-based log format, to prevent an embedded newline from forging a fake extra line (or, for writers that build header-style text like Mail's Subject line, a fake extra header).
- serialize() : string
- Serialize a context array (minus timestamp/name/format) as text, JSON, or PHP-serialized, depending on context['format']
Methods
sanitize()
Strip CR/LF from a value before it's written into a delimited/line-based log format, to prevent an embedded newline from forging a fake extra line (or, for writers that build header-style text like Mail's Subject line, a fake extra header).
public
static sanitize(string $value) : string
Parameters
- $value : string
Return values
stringserialize()
Serialize a context array (minus timestamp/name/format) as text, JSON, or PHP-serialized, depending on context['format']
public
static serialize(array<string|int, mixed> $context) : string
Parameters
- $context : array<string|int, mixed>