PsrMessage
API reference › yii › log › PsrMessage
Stores a PSR-3 message together with its original level and context.
String conversion performs the optional PSR-3 placeholder interpolation while ignoring context values that cannot be safely converted to strings.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | PsrMessage | |
__toString() | Returns the message with safely convertible context placeholders interpolated. | PsrMessage |
getContext() | Returns the PSR-3 context. | PsrMessage |
getLevel() | Returns the original PSR-3 level. | PsrMessage |
getMessage() | Returns the message without placeholder interpolation. | PsrMessage |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(string|Stringable $message, array<array-key, mixed> $context, string $level)Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string|Stringable | The PSR-3 message, cast to string eagerly so a throwing Stringable fails at the logging call site instead of during a later target flush. |
$context | array<array-key, | The PSR-3 context. |
$level | string | The original PSR-3 level. |
__toString()
Section titled “__toString() ”public function __toString(): stringReturns the message with safely convertible context placeholders interpolated.
Returns
string
getContext()
Section titled “getContext() ”public function getContext(): array<array-key, mixed>Returns the PSR-3 context.
Returns
array<array-key, mixed>
getLevel()
Section titled “getLevel() ”public function getLevel(): stringReturns the original PSR-3 level.
Returns
string
getMessage()
Section titled “getMessage() ”public function getMessage(): stringReturns the message without placeholder interpolation.
Returns
string