Final Class Yiisoft\Profiler\Message
| Inheritance | Yiisoft\Profiler\Message |
|---|
Message is a data object that stores profile message data.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Profiler\Message | |
| context() | Returns a value of the context parameter for the specified name. | Yiisoft\Profiler\Message |
| level() | Gets a message level. | Yiisoft\Profiler\Message |
| token() | Gets a message token. | Yiisoft\Profiler\Message |
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 | \Psr\Log\InvalidArgumentException |
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;
}
Signup or Login in order to comment.