LogMessage
in package
implements
Stringable
Represents a single log message.
Tags
Interfaces, Classes, Traits and Enums
- Stringable
Table of Contents
- $context : array<string|int, mixed>
- Context may be a hash of anything, but only primitives and Stringables are expanded.
- $formattedMessage : string
- $level : LogLevel
- $message : string
- __construct() : mixed
- Constructor.
- __toString() : string
- context() : array<string|int, mixed>
- Expose context.
- formatMessage() : string
- Apply formatters to the message;.
- level() : LogLevel
- mergeContext() : void
- Merge an additional context with the current context.
- message() : string
Properties
$context
Context may be a hash of anything, but only primitives and Stringables are expanded.
private
array<string|int, mixed>
$context
$formattedMessage
private
string
$formattedMessage
$level
private
LogLevel
$level
$message
private
string
$message
Methods
__construct()
Constructor.
public
__construct(LogLevel $level, string $message[, array<string|int, mixed> $context = [] ]) : mixed
Parameters
- $level : LogLevel
- $message : string
- $context : array<string|int, mixed> = []
Return values
mixed —__toString()
public
__toString() : string
Return values
string —context()
Expose context.
public
context() : array<string|int, mixed>
Return values
array<string|int, mixed> —formatMessage()
Apply formatters to the message;.
public
formatMessage(array<string|int, LogFormatter> $formatters) : string
Parameters
- $formatters : array<string|int, LogFormatter>
Return values
string —level()
public
level() : LogLevel
Return values
LogLevel —mergeContext()
Merge an additional context with the current context.
public
mergeContext(array<string|int, mixed> $context) : void
On existing key, last write wins.
Parameters
- $context : array<string|int, mixed>
Return values
void —message()
public
message() : string