public function LogMessage::__construct in File Log 8
Same name and namespace in other branches
- 2.0.x src/LogMessage.php \Drupal\filelog\LogMessage::__construct()
LogMessage constructor.
Parameters
int $level: Severity level.
string $message: Message content.
array $variables: Placeholder variables.
array $context: Context variables.
File
- src/
LogMessage.php, line 88
Class
- LogMessage
- Represents a single log event.
Namespace
Drupal\filelogCode
public function __construct($level, $message, array $variables, array $context) {
$this->level = $level;
// Store the original placeholders for rendering the message.
$this->placeholders = $variables;
$this->message = $message;
// Strip the variable format prefixes.
foreach ($variables as $key => $value) {
if (in_array($key[0], [
'%',
'!',
'@',
':',
], TRUE)) {
$variables[substr($key, 1)] = $value;
unset($variables[$key]);
}
}
$this->variables = $variables;
$this->context = $context + [
'uid' => NULL,
'channel' => NULL,
'ip' => NULL,
'request_uri' => NULL,
'referer' => NULL,
'timestamp' => NULL,
];
}