mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-24 10:06:08 +02:00
CS fixes
This commit is contained in:
@@ -55,8 +55,8 @@ abstract class AbstractSyslogHandler extends AbstractProcessingHandler
|
||||
|
||||
/**
|
||||
* @param mixed $facility
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*/
|
||||
public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)
|
||||
{
|
||||
|
||||
@@ -141,7 +141,8 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
|
||||
if (empty($context) && empty($extra)) {
|
||||
$script[] = static::call_array('log', static::handleStyles($record['formatted']));
|
||||
} else {
|
||||
$script = array_merge($script,
|
||||
$script = array_merge(
|
||||
$script,
|
||||
[static::call_array('groupCollapsed', static::handleStyles($record['formatted']))],
|
||||
$context,
|
||||
$extra,
|
||||
|
||||
@@ -24,7 +24,6 @@ use Monolog\Logger;
|
||||
*/
|
||||
class ChromePHPHandler extends AbstractProcessingHandler
|
||||
{
|
||||
|
||||
use WebRequestRecognizerTrait;
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,8 @@ class CubeHandler extends AbstractProcessingHandler
|
||||
if (!in_array($urlInfo['scheme'], $this->acceptedSchemes)) {
|
||||
throw new \UnexpectedValueException(
|
||||
'Invalid protocol (' . $urlInfo['scheme'] . ').'
|
||||
. ' Valid options are ' . implode(', ', $this->acceptedSchemes));
|
||||
. ' Valid options are ' . implode(', ', $this->acceptedSchemes)
|
||||
);
|
||||
}
|
||||
|
||||
$this->scheme = $urlInfo['scheme'];
|
||||
|
||||
@@ -81,6 +81,7 @@ class ElasticSearchHandler extends AbstractProcessingHandler
|
||||
if ($formatter instanceof ElasticaFormatter) {
|
||||
return parent::setFormatter($formatter);
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException('ElasticSearchHandler is only compatible with ElasticaFormatter');
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ class ErrorLogHandler extends AbstractProcessingHandler
|
||||
|
||||
if (false === in_array($messageType, self::getAvailableTypes(), true)) {
|
||||
$message = sprintf('The given message type "%s" is not supported', print_r($messageType, true));
|
||||
|
||||
throw new \InvalidArgumentException($message);
|
||||
}
|
||||
|
||||
@@ -73,9 +74,10 @@ class ErrorLogHandler extends AbstractProcessingHandler
|
||||
{
|
||||
if (!$this->expandNewlines) {
|
||||
error_log((string) $record['formatted'], $this->messageType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$lines = preg_split('{[\r\n]+}', (string) $record['formatted']);
|
||||
foreach ($lines as $line) {
|
||||
error_log($line, $this->messageType);
|
||||
|
||||
@@ -21,7 +21,7 @@ interface ActivationStrategyInterface
|
||||
/**
|
||||
* Returns whether the given record activates the handler.
|
||||
*
|
||||
* @param array $record
|
||||
* @param array $record
|
||||
* @return bool
|
||||
*/
|
||||
public function isHandlerActivated(array $record);
|
||||
|
||||
@@ -21,7 +21,6 @@ use Monolog\Formatter\FormatterInterface;
|
||||
*/
|
||||
class FirePHPHandler extends AbstractProcessingHandler
|
||||
{
|
||||
|
||||
use WebRequestRecognizerTrait;
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,9 +43,9 @@ interface HandlerInterface
|
||||
* Unless the bubbling is interrupted (by returning true), the Logger class will keep on
|
||||
* calling further handlers in the stack with a given log record.
|
||||
*
|
||||
* @param array $record The record to handle
|
||||
* @return bool true means that this handler handled the record, and that bubbling is not permitted.
|
||||
* false means the record was either not processed or that this handler allows bubbling.
|
||||
* @param array $record The record to handle
|
||||
* @return bool true means that this handler handled the record, and that bubbling is not permitted.
|
||||
* false means the record was either not processed or that this handler allows bubbling.
|
||||
*/
|
||||
public function handle(array $record): bool;
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Monolog\Handler;
|
||||
namespace Monolog\Handler;
|
||||
|
||||
use Monolog\Logger;
|
||||
use Monolog\Logger;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Inspired on LogEntriesHandler.
|
||||
*
|
||||
* @author Robert Kaufmann III <rok3@rok3.me>
|
||||
|
||||
@@ -19,7 +19,7 @@ use Monolog\Logger;
|
||||
* Sends errors to Rollbar
|
||||
*
|
||||
* If the context data contains a `payload` key, that is used as an array
|
||||
* of payload options to RollbarLogger's log method.
|
||||
* of payload options to RollbarLogger's log method.
|
||||
*
|
||||
* Rollbar's context info will contain the context + extra keys from the log record
|
||||
* merged, and then on top of that a few keys:
|
||||
@@ -59,9 +59,9 @@ class RollbarHandler extends AbstractProcessingHandler
|
||||
protected $initialized = false;
|
||||
|
||||
/**
|
||||
* @param RollbarLogger $rollbarLogger RollbarLogger object constructed with valid token
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param RollbarLogger $rollbarLogger RollbarLogger object constructed with valid token
|
||||
* @param int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*/
|
||||
public function __construct(RollbarLogger $rollbarLogger, $level = Logger::ERROR, $bubble = true)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ class RollbarHandler extends AbstractProcessingHandler
|
||||
} else {
|
||||
$toLog = $record['message'];
|
||||
}
|
||||
|
||||
|
||||
$this->rollbarLogger->log($context['level'], $toLog, $context);
|
||||
|
||||
$this->hasRecords = true;
|
||||
|
||||
@@ -90,7 +90,7 @@ class SlackWebhookHandler extends AbstractProcessingHandler
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HTTPHEADER => array('Content-type: application/json'),
|
||||
CURLOPT_POSTFIELDS => $postString
|
||||
CURLOPT_POSTFIELDS => $postString,
|
||||
);
|
||||
if (defined('CURLOPT_SAFE_UPLOAD')) {
|
||||
$options[CURLOPT_SAFE_UPLOAD] = true;
|
||||
|
||||
@@ -21,7 +21,6 @@ use Monolog\Logger;
|
||||
*/
|
||||
class SqsHandler extends AbstractProcessingHandler
|
||||
{
|
||||
|
||||
/** 256 KB in bytes - maximum message size in SQS */
|
||||
const MAX_MESSAGE_SIZE = 262144;
|
||||
/** 100 KB in bytes - head message size for new error log */
|
||||
|
||||
@@ -106,6 +106,7 @@ class StreamHandler extends AbstractProcessingHandler
|
||||
restore_error_handler();
|
||||
if (!is_resource($this->stream)) {
|
||||
$this->stream = null;
|
||||
|
||||
throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ class TestHandler extends AbstractProcessingHandler
|
||||
if (isset($record['context']) && $rec['context'] !== $record['context']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}, $level);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
namespace Monolog\Handler;
|
||||
|
||||
trait WebRequestRecognizerTrait
|
||||
{
|
||||
|
||||
/**
|
||||
* Checks if PHP's serving a web request
|
||||
* @return bool
|
||||
|
||||
Reference in New Issue
Block a user