1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-24 18:16:10 +02:00
This commit is contained in:
Jordi Boggiano
2016-09-25 17:46:38 +02:00
parent 941c21b793
commit 96f4fd718f
15 changed files with 39 additions and 36 deletions

View File

@@ -40,7 +40,7 @@ class RollbarHandler extends AbstractProcessingHandler
*/
protected $rollbarNotifier;
protected $levelMap = array(
protected $levelMap = [
Logger::DEBUG => 'debug',
Logger::INFO => 'info',
Logger::NOTICE => 'info',
@@ -49,7 +49,7 @@ class RollbarHandler extends AbstractProcessingHandler
Logger::CRITICAL => 'critical',
Logger::ALERT => 'critical',
Logger::EMERGENCY => 'critical',
);
];
/**
* Records whether any log records have been added since the last flush of the rollbar notifier
@@ -76,17 +76,17 @@ class RollbarHandler extends AbstractProcessingHandler
protected function write(array $record)
{
$context = $record['context'];
$payload = array();
$payload = [];
if (isset($context['payload'])) {
$payload = $context['payload'];
unset($context['payload']);
}
$context = array_merge($context, $record['extra'], array(
$context = array_merge($context, $record['extra'], [
'level' => $this->levelMap[$record['level']],
'monolog_level' => $record['level_name'],
'channel' => $record['channel'],
'datetime' => $record['datetime']->format('U'),
));
]);
if (isset($context['exception']) && $context['exception'] instanceof Exception) {
$exception = $context['exception'];

View File

@@ -186,8 +186,8 @@ class Logger implements LoggerInterface
/**
* Pops a handler from the stack
*
* @throws \LogicException If empty handler stack
* @return HandlerInterface
* @throws \LogicException If empty handler stack
*/
public function popHandler(): HandlerInterface
{
@@ -240,8 +240,8 @@ class Logger implements LoggerInterface
/**
* Removes the processor on top of the stack and returns it.
*
* @throws \LogicException If empty processor stack
* @return callable
* @throws \LogicException If empty processor stack
*/
public function popProcessor(): callable
{
@@ -347,9 +347,9 @@ class Logger implements LoggerInterface
/**
* Gets the name of the logging level.
*
* @param int $level
* @return string
* @param int $level
* @throws \Psr\Log\InvalidArgumentException If level is not defined
* @return string
*/
public static function getLevelName(int $level): string
{
@@ -364,8 +364,8 @@ class Logger implements LoggerInterface
* Converts PSR-3 levels to Monolog ones if necessary
*
* @param string|int Level number (monolog) or name (PSR-3)
* @return int
* @throws \Psr\Log\InvalidArgumentException If level is not defined
* @return int
*/
public static function toMonologLevel($level): int
{

View File

@@ -3,7 +3,7 @@
/*
* This file is part of the Monolog package.
*
* (c) Jonathan A. Schweder <jonathanschweder@gmail.com>
* (c) Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -51,9 +51,10 @@ class MercurialProcessor
}
$result = explode(' ', trim(`hg id -nb`));
return self::$cache = array(
return self::$cache = [
'branch' => $result[1],
'revision' => $result[2],
);
];
}
}