mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-23 01:26:11 +02:00
Merge branch '1.x'
This commit is contained in:
@@ -112,7 +112,7 @@ class AmqpHandler extends AbstractProcessingHandler
|
||||
* @param array $record
|
||||
* @return string
|
||||
*/
|
||||
private function getRoutingKey(array $record)
|
||||
protected function getRoutingKey(array $record)
|
||||
{
|
||||
$routingKey = sprintf('%s.%s', $record['level_name'], $record['channel']);
|
||||
|
||||
|
@@ -84,7 +84,7 @@ class RavenHandler extends AbstractProcessingHandler
|
||||
|
||||
// the record with the highest severity is the "main" one
|
||||
$record = array_reduce($records, function ($highest, $record) {
|
||||
if ($record['level'] >= $highest['level']) {
|
||||
if ($record['level'] > $highest['level']) {
|
||||
return $record;
|
||||
}
|
||||
|
||||
|
@@ -58,6 +58,8 @@ class RollbarHandler extends AbstractProcessingHandler
|
||||
*/
|
||||
private $hasRecords = false;
|
||||
|
||||
protected $initialized = false;
|
||||
|
||||
/**
|
||||
* @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
@@ -75,6 +77,12 @@ class RollbarHandler extends AbstractProcessingHandler
|
||||
*/
|
||||
protected function write(array $record)
|
||||
{
|
||||
if (!$this->initialized) {
|
||||
// __destructor() doesn't get called on Fatal errors
|
||||
register_shutdown_function(array($this, 'close'));
|
||||
$this->initialized = true;
|
||||
}
|
||||
|
||||
$context = $record['context'];
|
||||
$payload = [];
|
||||
if (isset($context['payload'])) {
|
||||
@@ -105,14 +113,19 @@ class RollbarHandler extends AbstractProcessingHandler
|
||||
$this->hasRecords = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function close()
|
||||
public function flush()
|
||||
{
|
||||
if ($this->hasRecords) {
|
||||
$this->rollbarNotifier->flush();
|
||||
$this->hasRecords = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
$this->flush();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user