Final Class Yiisoft\Profiler\Message
| Inheritance | Yiisoft\ |
|---|
Message is a data object that stores profile message data.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| context() | Returns a value of the context parameter for the specified name. | Yiisoft\ |
| level() | Gets a message level. | Yiisoft\ |
| token() | Gets a message token. | Yiisoft\ |
Method Details
See also:
- \
Psr\ Log\ LoggerTrait::log() - \
Psr\ Log\ LogLevel
| public mixed __construct ( string $level, string $token, array $context = [] ) | ||
| $level | string |
Message level. |
| $token | string |
Message token. |
| $context | array |
Message context with a following keys:
|
| throws | \ |
for invalid log message level. |
|---|---|---|
public function __construct(
private readonly string $level,
private readonly string $token,
private readonly array $context = [],
) {}
Returns a value of the context parameter for the specified name.
If no name is specified, the entire context is returned.
| public mixed context ( string|null $name = null, mixed $default = null ) | ||
| $name | string|null |
The context parameter name. |
| $default | mixed |
If the context parameter does not exist, the |
public function context(?string $name = null, mixed $default = null): mixed
{
if ($name === null) {
return $this->context;
}
/** @var array<array-key, mixed> */
return $this->context[$name] ?? $default;
}
Gets a message level.
| public string level ( ) | ||
| return | string |
Log message level. |
|---|---|---|
public function level(): string
{
return $this->level;
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.