mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 13:16:39 +02:00
contentPrefix should be contextPrefix
This commit is contained in:
@@ -34,7 +34,7 @@ class GelfMessageFormatter implements FormatterInterface
|
|||||||
/**
|
/**
|
||||||
* @var string a prefix for 'context' fields from the Monolog record (optional)
|
* @var string a prefix for 'context' fields from the Monolog record (optional)
|
||||||
*/
|
*/
|
||||||
protected $contentPrefix;
|
protected $contextPrefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates Monolog log levels to Graylog2 log priorities.
|
* Translates Monolog log levels to Graylog2 log priorities.
|
||||||
@@ -48,12 +48,12 @@ class GelfMessageFormatter implements FormatterInterface
|
|||||||
Logger::ALERT => LOG_ALERT,
|
Logger::ALERT => LOG_ALERT,
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct($systemName = null, $extraPrefix = null, $contentPrefix = 'ctxt_')
|
public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_')
|
||||||
{
|
{
|
||||||
$this->systemName = $systemName ?: gethostname();
|
$this->systemName = $systemName ?: gethostname();
|
||||||
|
|
||||||
$this->extraPrefix = $extraPrefix;
|
$this->extraPrefix = $extraPrefix;
|
||||||
$this->contentPrefix = $contentPrefix;
|
$this->contextPrefix = $contextPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +80,7 @@ class GelfMessageFormatter implements FormatterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($record['context'] as $key => $val) {
|
foreach ($record['context'] as $key => $val) {
|
||||||
$message->setAdditional($this->contentPrefix . $key, is_scalar($val) ? $val : json_encode($val));
|
$message->setAdditional($this->contextPrefix . $key, is_scalar($val) ? $val : json_encode($val));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
|
Reference in New Issue
Block a user