1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 13:16:39 +02:00

CS fixes & upgrading cs fixer config

This commit is contained in:
Jordi Boggiano
2015-11-18 17:09:41 +00:00
parent 75ca9e5dc7
commit c889fb2648
64 changed files with 288 additions and 218 deletions

47
.php_cs
View File

@@ -1,15 +1,58 @@
<?php <?php
$header = <<<EOF
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.
EOF;
$finder = Symfony\CS\Finder\DefaultFinder::create() $finder = Symfony\CS\Finder\DefaultFinder::create()
->files() ->files()
->name('*.php') ->name('*.php')
->exclude('Fixtures')
->in(__DIR__.'/src') ->in(__DIR__.'/src')
->in(__DIR__.'/tests') ->in(__DIR__.'/tests')
; ;
return Symfony\CS\Config\Config::create() return Symfony\CS\Config\Config::create()
->fixers(array( ->setUsingCache(true)
'psr0', 'encoding', 'short_tag', 'braces', 'elseif', 'eof_ending', 'function_declaration', 'indentation', 'line_after_namespace', 'linefeed', 'lowercase_constants', 'lowercase_keywords', 'multiple_use', 'php_closing_tag', 'trailing_spaces', 'visibility', 'duplicate_semicolon', 'extra_empty_lines', 'include', 'namespace_no_leading_whitespace', 'object_operator', 'operators_spaces', 'phpdoc_params', 'return', 'single_array_no_trailing_comma', 'spaces_cast', 'standardize_not_equal', 'ternary_spaces', 'unused_use', 'whitespacy_lines', ->setRiskyAllowed(true)
->setRules(array(
'@PSR2' => true,
'duplicate_semicolon' => true,
'extra_empty_lines' => true,
'header_comment' => array('header' => $header),
'include' => true,
'long_array_syntax' => true,
'method_separation' => true,
'multiline_array_trailing_comma' => true,
'namespace_no_leading_whitespace' => true,
'no_blank_lines_after_class_opening' => true,
'no_empty_lines_after_phpdocs' => true,
'object_operator' => true,
'operators_spaces' => true,
'phpdoc_align' => true,
'phpdoc_indent' => true,
'phpdoc_no_access' => true,
'phpdoc_no_package' => true,
'phpdoc_order' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'phpdoc_type_to_var' => true,
'psr0' => true,
'return' => true,
'remove_leading_slash_use' => true,
'remove_lines_between_uses' => true,
'single_array_no_trailing_comma' => true,
'single_blank_line_before_namespace' => true,
'spaces_cast' => true,
'standardize_not_equal' => true,
'ternary_spaces' => true,
'unused_use' => true,
'whitespacy_lines' => true,
)) ))
->finder($finder) ->finder($finder)
; ;

View File

@@ -32,7 +32,6 @@ namespace Monolog\Formatter;
* *
* @author Andrius Putna <fordnox@gmail.com> * @author Andrius Putna <fordnox@gmail.com>
*/ */
class FluentdFormatter implements FormatterInterface class FluentdFormatter implements FormatterInterface
{ {
/** /**
@@ -46,7 +45,7 @@ class FluentdFormatter implements FormatterInterface
throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter'); throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter');
} }
$this->levelTag = (bool)$levelTag; $this->levelTag = (bool) $levelTag;
} }
public function isUsingLevelsInTag() public function isUsingLevelsInTag()
@@ -63,7 +62,7 @@ class FluentdFormatter implements FormatterInterface
$message = array( $message = array(
'message' => $record['message'], 'message' => $record['message'],
'extra' => $record['extra'] 'extra' => $record['extra'],
); );
if (!$this->levelTag) { if (!$this->levelTag) {
@@ -86,6 +85,7 @@ class FluentdFormatter implements FormatterInterface
foreach ($records as $record) { foreach ($records as $record) {
$message .= $this->format($record); $message .= $this->format($record);
} }
return $message; return $message;
} }
} }

View File

@@ -64,8 +64,8 @@ class HtmlFormatter extends NormalizerFormatter
/** /**
* Create a HTML h1 tag * Create a HTML h1 tag
* *
* @param string $title Text to be in the h1 * @param string $title Text to be in the h1
* @param integer $level Error level * @param int $level Error level
* @return string * @return string
*/ */
private function addTitle($title, $level) private function addTitle($title, $level)
@@ -74,6 +74,7 @@ class HtmlFormatter extends NormalizerFormatter
return '<h1 style="background: '.$this->logLevels[$level].';color: #ffffff;padding: 5px;" class="monolog-output">'.$title.'</h1>'; return '<h1 style="background: '.$this->logLevels[$level].';color: #ffffff;padding: 5px;" class="monolog-output">'.$title.'</h1>';
} }
/** /**
* Formats a log record. * Formats a log record.
* *

View File

@@ -22,7 +22,7 @@ class LogglyFormatter extends JsonFormatter
* Overrides the default batch mode to new lines for compatibility with the * Overrides the default batch mode to new lines for compatibility with the
* Loggly bulk API. * Loggly bulk API.
* *
* @param integer $batchMode * @param int $batchMode
*/ */
public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false) public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false)
{ {

View File

@@ -45,16 +45,16 @@ class LogstashFormatter extends NormalizerFormatter
protected $contextPrefix; protected $contextPrefix;
/** /**
* @var integer logstash format version to use * @var int logstash format version to use
*/ */
protected $version; protected $version;
/** /**
* @param string $applicationName the application that sends the data, used as the "type" field of logstash * @param string $applicationName the application that sends the data, used as the "type" field of logstash
* @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine * @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine
* @param string $extraPrefix prefix for extra keys inside logstash "fields" * @param string $extraPrefix prefix for extra keys inside logstash "fields"
* @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_ * @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_
* @param integer $version the logstash format version to use, defaults to 0 * @param int $version the logstash format version to use, defaults to 0
*/ */
public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0) public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0)
{ {
@@ -92,7 +92,7 @@ class LogstashFormatter extends NormalizerFormatter
$message = array( $message = array(
'@timestamp' => $record['datetime'], '@timestamp' => $record['datetime'],
'@source' => $this->systemName, '@source' => $this->systemName,
'@fields' => array() '@fields' => array(),
); );
if (isset($record['message'])) { if (isset($record['message'])) {
$message['@message'] = $record['message']; $message['@message'] = $record['message'];

View File

@@ -165,8 +165,8 @@ class NormalizerFormatter implements FormatterInterface
/** /**
* Throws an exception according to a given code with a customized message * Throws an exception according to a given code with a customized message
* *
* @param int $code return code of json_last_error function * @param int $code return code of json_last_error function
* @param mixed $data data that was meant to be encoded * @param mixed $data data that was meant to be encoded
* @throws \RuntimeException * @throws \RuntimeException
*/ */
private function throwEncodeError($code, $data) private function throwEncodeError($code, $data)

View File

@@ -32,7 +32,7 @@ abstract class AbstractHandler implements HandlerInterface
protected $processors = array(); protected $processors = array();
/** /**
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct($level = Logger::DEBUG, $bubble = true) public function __construct($level = Logger::DEBUG, $bubble = true)
@@ -118,7 +118,7 @@ abstract class AbstractHandler implements HandlerInterface
/** /**
* Sets minimum logging level at which this handler will be triggered. * Sets minimum logging level at which this handler will be triggered.
* *
* @param integer $level * @param int $level
* @return self * @return self
*/ */
public function setLevel($level) public function setLevel($level)
@@ -131,7 +131,7 @@ abstract class AbstractHandler implements HandlerInterface
/** /**
* Gets minimum logging level at which this handler will be triggered. * Gets minimum logging level at which this handler will be triggered.
* *
* @return integer * @return int
*/ */
public function getLevel() public function getLevel()
{ {

View File

@@ -54,7 +54,7 @@ abstract class AbstractSyslogHandler extends AbstractProcessingHandler
/** /**
* @param mixed $facility * @param mixed $facility
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $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) public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)

View File

@@ -70,7 +70,7 @@ class AmqpHandler extends AbstractProcessingHandler
0, 0,
array( array(
'delivery_mode' => 2, 'delivery_mode' => 2,
'Content-type' => 'application/json' 'Content-type' => 'application/json',
) )
); );
} else { } else {
@@ -79,7 +79,7 @@ class AmqpHandler extends AbstractProcessingHandler
(string) $data, (string) $data,
array( array(
'delivery_mode' => 2, 'delivery_mode' => 2,
'content_type' => 'application/json' 'content_type' => 'application/json',
) )
), ),
$this->exchangeName, $this->exchangeName,

View File

@@ -31,7 +31,6 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
* Example of formatted string: * Example of formatted string:
* *
* You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white} * You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white}
*
*/ */
protected function getDefaultFormatter() protected function getDefaultFormatter()
{ {

View File

@@ -32,8 +32,8 @@ class BufferHandler extends AbstractHandler
/** /**
* @param HandlerInterface $handler Handler. * @param HandlerInterface $handler Handler.
* @param integer $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. * @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
* @param Boolean $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded * @param Boolean $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded
*/ */

View File

@@ -51,7 +51,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
protected static $sendHeaders = true; protected static $sendHeaders = true;
/** /**
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct($level = Logger::DEBUG, $bubble = true) public function __construct($level = Logger::DEBUG, $bubble = true)

View File

@@ -54,7 +54,7 @@ class CouchDBHandler extends AbstractProcessingHandler
'ignore_errors' => true, 'ignore_errors' => true,
'max_redirects' => 0, 'max_redirects' => 0,
'header' => 'Content-type: application/json', 'header' => 'Content-type: application/json',
) ),
)); ));
if (false === @file_get_contents($url, null, $context)) { if (false === @file_get_contents($url, null, $context)) {

View File

@@ -32,8 +32,8 @@ class CubeHandler extends AbstractProcessingHandler
* Create a Cube handler * Create a Cube handler
* *
* @throws \UnexpectedValueException when given url is not a valid url. * @throws \UnexpectedValueException when given url is not a valid url.
* A valid url must consist of three parts : protocol://host:port * A valid url must consist of three parts : protocol://host:port
* Only valid protocols used by Cube are http and udp * Only valid protocols used by Cube are http and udp
*/ */
public function __construct($url, $level = Logger::DEBUG, $bubble = true) public function __construct($url, $level = Logger::DEBUG, $bubble = true)
{ {
@@ -59,7 +59,7 @@ class CubeHandler extends AbstractProcessingHandler
/** /**
* Establish a connection to an UDP socket * Establish a connection to an UDP socket
* *
* @throws \LogicException when unable to connect to the socket * @throws \LogicException when unable to connect to the socket
* @throws MissingExtensionException when there is no socket extension * @throws MissingExtensionException when there is no socket extension
*/ */
protected function connectUdp() protected function connectUdp()
@@ -142,9 +142,9 @@ class CubeHandler extends AbstractProcessingHandler
curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']'); curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']');
curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array( curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json', 'Content-Type: application/json',
'Content-Length: ' . strlen('['.$data.']')) 'Content-Length: ' . strlen('['.$data.']'),
); ));
Curl\Util::execute($this->httpConnection, 5, false); Curl\Util::execute($this->httpConnection, 5, false);
} }

View File

@@ -26,7 +26,7 @@ class Util
/** /**
* Executes a CURL request with optional retries and exception on failure * Executes a CURL request with optional retries and exception on failure
* *
* @param resource $ch curl handler * @param resource $ch curl handler
* @throws \RuntimeException * @throws \RuntimeException
*/ */
public static function execute($ch, $retries = 5, $closeAfterDone = true) public static function execute($ch, $retries = 5, $closeAfterDone = true)

View File

@@ -39,8 +39,8 @@ class DynamoDbHandler extends AbstractProcessingHandler
/** /**
* @param DynamoDbClient $client * @param DynamoDbClient $client
* @param string $table * @param string $table
* @param integer $level * @param int $level
* @param boolean $bubble * @param bool $bubble
*/ */
public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true) public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true)
{ {
@@ -64,7 +64,7 @@ class DynamoDbHandler extends AbstractProcessingHandler
$this->client->putItem(array( $this->client->putItem(array(
'TableName' => $this->table, 'TableName' => $this->table,
'Item' => $formatted 'Item' => $formatted,
)); ));
} }

View File

@@ -48,7 +48,7 @@ class ElasticSearchHandler extends AbstractProcessingHandler
/** /**
* @param Client $client Elastica Client object * @param Client $client Elastica Client object
* @param array $options Handler configuration * @param array $options Handler configuration
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true) public function __construct(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true)

View File

@@ -28,8 +28,8 @@ class ErrorLogHandler extends AbstractProcessingHandler
protected $expandNewlines; protected $expandNewlines;
/** /**
* @param integer $messageType Says where the error should go. * @param int $messageType Says where the error should go.
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
* @param Boolean $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries * @param Boolean $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries
*/ */

View File

@@ -2,12 +2,12 @@
/* /*
* This file is part of the Monolog package. * This file is part of the Monolog package.
* *
* (c) Jordi Boggiano <j.boggiano@seld.be> * (c) Jordi Boggiano <j.boggiano@seld.be>
* *
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Monolog\Handler\FingersCrossed; namespace Monolog\Handler\FingersCrossed;

View File

@@ -118,7 +118,7 @@ class FleepHookHandler extends SocketHandler
private function buildContent($record) private function buildContent($record)
{ {
$dataArray = array( $dataArray = array(
'message' => $record['formatted'] 'message' => $record['formatted'],
); );
return http_build_query($dataArray); return http_build_query($dataArray);

View File

@@ -33,8 +33,8 @@ class GelfHandler extends AbstractProcessingHandler
/** /**
* @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object * @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct($publisher, $level = Logger::DEBUG, $bubble = true) public function __construct($publisher, $level = Logger::DEBUG, $bubble = true)
{ {

View File

@@ -84,16 +84,16 @@ class HipChatHandler extends SocketHandler
private $version; private $version;
/** /**
* @param string $token HipChat API Token * @param string $token HipChat API Token
* @param string $room The room that should be alerted of the message (Id or Name) * @param string $room The room that should be alerted of the message (Id or Name)
* @param string $name Name used in the "from" field. Not used for v2 * @param string $name Name used in the "from" field. Not used for v2
* @param bool $notify Trigger a notification in clients or not * @param bool $notify Trigger a notification in clients or not
* @param int $level The minimum logging level at which this handler will be triggered * @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 bool $bubble Whether the messages that are handled can bubble up the stack or not
* @param bool $useSSL Whether to connect via SSL. * @param bool $useSSL Whether to connect via SSL.
* @param string $format The format of the messages (default to text, can be set to html if you have html in the messages) * @param string $format The format of the messages (default to text, can be set to html if you have html in the messages)
* @param string $host The HipChat server hostname. * @param string $host The HipChat server hostname.
* @param string $version The HipChat API version (default HipChatHandler::API_V1) * @param string $version The HipChat API version (default HipChatHandler::API_V1)
*/ */
public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1) public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1)
{ {
@@ -179,7 +179,7 @@ class HipChatHandler extends SocketHandler
/** /**
* Assigns a color to each level of log records. * Assigns a color to each level of log records.
* *
* @param integer $level * @param int $level
* @return string * @return string
*/ */
protected function getAlertColor($level) protected function getAlertColor($level)
@@ -303,7 +303,7 @@ class HipChatHandler extends SocketHandler
array( array(
'level' => $level, 'level' => $level,
'level_name' => $levelName, 'level_name' => $levelName,
'datetime' => $datetime 'datetime' => $datetime,
) )
); );
} }

View File

@@ -30,10 +30,10 @@ class IFTTTHandler extends AbstractProcessingHandler
private $secretKey; private $secretKey;
/** /**
* @param string $eventName The name of the IFTTT Maker event that should be triggered * @param string $eventName The name of the IFTTT Maker event that should be triggered
* @param string $secretKey A valid IFTTT secret key * @param string $secretKey A valid IFTTT secret key
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true) public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true)
{ {
@@ -51,7 +51,7 @@ class IFTTTHandler extends AbstractProcessingHandler
$postData = array( $postData = array(
"value1" => $record["channel"], "value1" => $record["channel"],
"value2" => $record["level_name"], "value2" => $record["level_name"],
"value3" => $record["message"] "value3" => $record["message"],
); );
$postString = json_encode($postData); $postString = json_encode($postData);
@@ -61,7 +61,7 @@ class IFTTTHandler extends AbstractProcessingHandler
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json" "Content-Type: application/json",
)); ));
Curl\Util::execute($ch); Curl\Util::execute($ch);

View File

@@ -24,10 +24,10 @@ class LogEntriesHandler extends SocketHandler
protected $logToken; protected $logToken;
/** /**
* @param string $token Log token supplied by LogEntries * @param string $token Log token supplied by LogEntries
* @param boolean $useSSL Whether or not SSL encryption should be used. * @param bool $useSSL Whether or not SSL encryption should be used.
* @param int $level The minimum logging level to trigger this handler * @param int $level The minimum logging level to trigger this handler
* @param boolean $bubble Whether or not messages that are handled should bubble up the stack. * @param bool $bubble Whether or not messages that are handled should bubble up the stack.
* *
* @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing
*/ */

View File

@@ -26,7 +26,7 @@ class MandrillHandler extends MailHandler
/** /**
* @param string $apiKey A valid Mandrill API key * @param string $apiKey A valid Mandrill API key
* @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true) public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true)

View File

@@ -47,7 +47,7 @@ class NativeMailerHandler extends MailHandler
/** /**
* The wordwrap length for the message * The wordwrap length for the message
* @var integer * @var int
*/ */
protected $maxColumnWidth; protected $maxColumnWidth;
@@ -67,8 +67,8 @@ class NativeMailerHandler extends MailHandler
* @param string|array $to The receiver of the mail * @param string|array $to The receiver of the mail
* @param string $subject The subject of the mail * @param string $subject The subject of the mail
* @param string $from The sender of the mail * @param string $from The sender of the mail
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
* @param int $maxColumnWidth The maximum column width that the message lines will have * @param int $maxColumnWidth The maximum column width that the message lines will have
*/ */
public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70) public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70)
@@ -101,7 +101,7 @@ class NativeMailerHandler extends MailHandler
/** /**
* Add parameters to the message * Add parameters to the message
* *
* @param string|array $parameters Custom added parameters * @param string|array $parameters Custom added parameters
* @return self * @return self
*/ */
public function addParameter($parameters) public function addParameter($parameters)

View File

@@ -41,16 +41,16 @@ class NewRelicHandler extends AbstractProcessingHandler
* Some context and extra data is passed into the handler as arrays of values. Do we send them as is * Some context and extra data is passed into the handler as arrays of values. Do we send them as is
* (useful if we are using the API), or explode them for display on the NewRelic RPM website? * (useful if we are using the API), or explode them for display on the NewRelic RPM website?
* *
* @var boolean * @var bool
*/ */
protected $explodeArrays; protected $explodeArrays;
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
* @param string $appName * @param string $appName
* @param boolean $explodeArrays * @param bool $explodeArrays
* @param string $transactionName * @param string $transactionName
*/ */
public function __construct( public function __construct(
$level = Logger::ERROR, $level = Logger::ERROR,

View File

@@ -24,7 +24,7 @@ use Monolog\Logger;
class NullHandler extends AbstractHandler class NullHandler extends AbstractHandler
{ {
/** /**
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
*/ */
public function __construct($level = Logger::DEBUG) public function __construct($level = Logger::DEBUG)
{ {

View File

@@ -66,10 +66,10 @@ class PHPConsoleHandler extends AbstractProcessingHandler
private $connector; private $connector;
/** /**
* @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details
* @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional)
* @param int $level * @param int $level
* @param bool $bubble * @param bool $bubble
* @throws Exception * @throws Exception
*/ */
public function __construct(array $options = array(), Connector $connector = null, $level = Logger::DEBUG, $bubble = true) public function __construct(array $options = array(), Connector $connector = null, $level = Logger::DEBUG, $bubble = true)

View File

@@ -68,16 +68,16 @@ class PushoverHandler extends SocketHandler
* @param string $token Pushover api token * @param string $token Pushover api token
* @param string|array $users Pushover user id or array of ids the message will be sent to * @param string|array $users Pushover user id or array of ids the message will be sent to
* @param string $title Title sent to the Pushover API * @param string $title Title sent to the Pushover API
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
* @param Boolean $useSSL Whether to connect via SSL. Required when pushing messages to users that are not * @param Boolean $useSSL Whether to connect via SSL. Required when pushing messages to users that are not
* the pushover.net app owner. OpenSSL is required for this option. * the pushover.net app owner. OpenSSL is required for this option.
* @param integer $highPriorityLevel The minimum logging level at which this handler will start * @param int $highPriorityLevel The minimum logging level at which this handler will start
* sending "high priority" requests to the Pushover API * sending "high priority" requests to the Pushover API
* @param integer $emergencyLevel The minimum logging level at which this handler will start * @param int $emergencyLevel The minimum logging level at which this handler will start
* sending "emergency" requests to the Pushover API * sending "emergency" requests to the Pushover API
* @param integer $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user. * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user.
* @param integer $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds). * @param int $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds).
*/ */
public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200) public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200)
{ {
@@ -115,7 +115,7 @@ class PushoverHandler extends SocketHandler
'user' => $this->user, 'user' => $this->user,
'message' => $message, 'message' => $message,
'title' => $this->title, 'title' => $this->title,
'timestamp' => $timestamp 'timestamp' => $timestamp,
); );
if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) { if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) {
@@ -176,7 +176,7 @@ class PushoverHandler extends SocketHandler
/** /**
* Use the formatted message? * Use the formatted message?
* @param boolean $value * @param bool $value
*/ */
public function useFormattedMessage($value) public function useFormattedMessage($value)
{ {

View File

@@ -50,7 +50,7 @@ class RavenHandler extends AbstractProcessingHandler
/** /**
* @param Raven_Client $ravenClient * @param Raven_Client $ravenClient
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true) public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true)

View File

@@ -34,9 +34,9 @@ class RedisHandler extends AbstractProcessingHandler
/** /**
* @param \Predis\Client|\Redis $redis The redis instance * @param \Predis\Client|\Redis $redis The redis instance
* @param string $key The key name to push records to * @param string $key The key name to push records to
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
* @param integer $capSize Number of entries to limit list size to * @param int $capSize Number of entries to limit list size to
*/ */
public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false) public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false)
{ {
@@ -67,7 +67,7 @@ class RedisHandler extends AbstractProcessingHandler
* Write and cap the collection * Write and cap the collection
* Writes the record to the redis list and caps its * Writes the record to the redis list and caps its
* *
* @param array $record associative record array * @param array $record associative record array
* @return void * @return void
*/ */
protected function writeCapped(array $record) protected function writeCapped(array $record)

View File

@@ -38,8 +38,8 @@ class RollbarHandler extends AbstractProcessingHandler
/** /**
* @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token * @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true) public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true)
{ {

View File

@@ -33,8 +33,8 @@ class RotatingFileHandler extends StreamHandler
/** /**
* @param string $filename * @param string $filename
* @param integer $maxFiles The maximal amount of files to keep (0 means unlimited) * @param int $maxFiles The maximal amount of files to keep (0 means unlimited)
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
* @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write)
* @param Boolean $useLocking Try to lock log file before doing any writes * @param Boolean $useLocking Try to lock log file before doing any writes

View File

@@ -70,16 +70,16 @@ class SlackHandler extends SocketHandler
private $lineFormatter; private $lineFormatter;
/** /**
* @param string $token Slack API token * @param string $token Slack API token
* @param string $channel Slack channel (encoded ID or name) * @param string $channel Slack channel (encoded ID or name)
* @param string $username Name of a bot * @param string $username Name of a bot
* @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise)
* @param string|null $iconEmoji The emoji name to use (or null) * @param string|null $iconEmoji The emoji name to use (or null)
* @param int $level The minimum logging level at which this handler will be triggered * @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 bool $bubble Whether the messages that are handled can bubble up the stack or not
* @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style
* @param bool $includeContextAndExtra Whether the attachment should include context and extra data * @param bool $includeContextAndExtra Whether the attachment should include context and extra data
* @throws MissingExtensionException If no OpenSSL PHP extension configured * @throws MissingExtensionException If no OpenSSL PHP extension configured
*/ */
public function __construct($token, $channel, $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false) public function __construct($token, $channel, $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false)
{ {
@@ -140,14 +140,14 @@ class SlackHandler extends SocketHandler
'channel' => $this->channel, 'channel' => $this->channel,
'username' => $this->username, 'username' => $this->username,
'text' => '', 'text' => '',
'attachments' => array() 'attachments' => array(),
); );
if ($this->useAttachment) { if ($this->useAttachment) {
$attachment = array( $attachment = array(
'fallback' => $record['message'], 'fallback' => $record['message'],
'color' => $this->getAttachmentColor($record['level']), 'color' => $this->getAttachmentColor($record['level']),
'fields' => array() 'fields' => array(),
); );
if ($this->useShortAttachment) { if ($this->useShortAttachment) {
@@ -159,7 +159,7 @@ class SlackHandler extends SocketHandler
$attachment['fields'][] = array( $attachment['fields'][] = array(
'title' => 'Level', 'title' => 'Level',
'value' => $record['level_name'], 'value' => $record['level_name'],
'short' => true 'short' => true,
); );
} }
@@ -169,7 +169,7 @@ class SlackHandler extends SocketHandler
$attachment['fields'][] = array( $attachment['fields'][] = array(
'title' => "Extra", 'title' => "Extra",
'value' => $this->stringify($record['extra']), 'value' => $this->stringify($record['extra']),
'short' => $this->useShortAttachment 'short' => $this->useShortAttachment,
); );
} else { } else {
// Add all extra fields as individual fields in attachment // Add all extra fields as individual fields in attachment
@@ -177,7 +177,7 @@ class SlackHandler extends SocketHandler
$attachment['fields'][] = array( $attachment['fields'][] = array(
'title' => $var, 'title' => $var,
'value' => $val, 'value' => $val,
'short' => $this->useShortAttachment 'short' => $this->useShortAttachment,
); );
} }
} }
@@ -188,7 +188,7 @@ class SlackHandler extends SocketHandler
$attachment['fields'][] = array( $attachment['fields'][] = array(
'title' => "Context", 'title' => "Context",
'value' => $this->stringify($record['context']), 'value' => $this->stringify($record['context']),
'short' => $this->useShortAttachment 'short' => $this->useShortAttachment,
); );
} else { } else {
// Add all context fields as individual fields in attachment // Add all context fields as individual fields in attachment
@@ -196,7 +196,7 @@ class SlackHandler extends SocketHandler
$attachment['fields'][] = array( $attachment['fields'][] = array(
'title' => $var, 'title' => $var,
'value' => $val, 'value' => $val,
'short' => $this->useShortAttachment 'short' => $this->useShortAttachment,
); );
} }
} }
@@ -267,8 +267,7 @@ class SlackHandler extends SocketHandler
/** /**
* Stringifies an array of key/value pairs to be used in attachment fields * Stringifies an array of key/value pairs to be used in attachment fields
* *
* @param array $fields * @param array $fields
* @access protected
* @return string * @return string
*/ */
protected function stringify($fields) protected function stringify($fields)

View File

@@ -33,7 +33,7 @@ class SocketHandler extends AbstractProcessingHandler
/** /**
* @param string $connectionString Socket connection string * @param string $connectionString Socket connection string
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true) public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true)
@@ -82,7 +82,7 @@ class SocketHandler extends AbstractProcessingHandler
/** /**
* Set socket connection to nbe persistent. It only has effect before the connection is initiated. * Set socket connection to nbe persistent. It only has effect before the connection is initiated.
* *
* @param boolean $persistent * @param bool $persistent
*/ */
public function setPersistent($persistent) public function setPersistent($persistent)
{ {
@@ -118,8 +118,7 @@ class SocketHandler extends AbstractProcessingHandler
/** /**
* Set writing timeout. Only has effect during connection in the writing cycle. * Set writing timeout. Only has effect during connection in the writing cycle.
* *
* @param float $seconds 0 for no timeout * @param float $seconds 0 for no timeout
*
*/ */
public function setWritingTimeout($seconds) public function setWritingTimeout($seconds)
{ {
@@ -140,7 +139,7 @@ class SocketHandler extends AbstractProcessingHandler
/** /**
* Get persistent setting * Get persistent setting
* *
* @return boolean * @return bool
*/ */
public function isPersistent() public function isPersistent()
{ {
@@ -182,7 +181,7 @@ class SocketHandler extends AbstractProcessingHandler
* *
* UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details. * UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details.
* *
* @return boolean * @return bool
*/ */
public function isConnected() public function isConnected()
{ {
@@ -329,6 +328,7 @@ class SocketHandler extends AbstractProcessingHandler
if ((time() - $this->lastWritingAt) >= $writingTimeout) { if ((time() - $this->lastWritingAt) >= $writingTimeout) {
$this->closeSocket(); $this->closeSocket();
return true; return true;
} }

View File

@@ -31,7 +31,7 @@ class StreamHandler extends AbstractProcessingHandler
/** /**
* @param resource|string $stream * @param resource|string $stream
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
* @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write)
* @param Boolean $useLocking Try to lock log file before doing any writes * @param Boolean $useLocking Try to lock log file before doing any writes

View File

@@ -26,7 +26,7 @@ class SwiftMailerHandler extends MailHandler
/** /**
* @param \Swift_Mailer $mailer The mailer to use * @param \Swift_Mailer $mailer The mailer to use
* @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true) public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true)
@@ -48,8 +48,8 @@ class SwiftMailerHandler extends MailHandler
/** /**
* Creates instance of Swift_Message to be sent * Creates instance of Swift_Message to be sent
* *
* @param string $content formatted email body to be sent * @param string $content formatted email body to be sent
* @param array $records Log records that formed the content * @param array $records Log records that formed the content
* @return \Swift_Message * @return \Swift_Message
*/ */
protected function buildMessage($content, array $records) protected function buildMessage($content, array $records)

View File

@@ -34,7 +34,7 @@ class SyslogHandler extends AbstractSyslogHandler
/** /**
* @param string $ident * @param string $ident
* @param mixed $facility * @param mixed $facility
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
* @param int $logopts Option flags for the openlog() call, defaults to LOG_PID * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID
*/ */

View File

@@ -27,7 +27,7 @@ class SyslogUdpHandler extends AbstractSyslogHandler
* @param string $host * @param string $host
* @param int $port * @param int $port
* @param mixed $facility * @param mixed $facility
* @param integer $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)

View File

@@ -156,7 +156,7 @@ class Logger implements LoggerInterface
/** /**
* Pushes a handler on to the stack. * Pushes a handler on to the stack.
* *
* @param HandlerInterface $handler * @param HandlerInterface $handler
* @return $this * @return $this
*/ */
public function pushHandler(HandlerInterface $handler) public function pushHandler(HandlerInterface $handler)
@@ -185,7 +185,7 @@ class Logger implements LoggerInterface
* *
* If a map is passed, keys will be ignored. * If a map is passed, keys will be ignored.
* *
* @param HandlerInterface[] $handlers * @param HandlerInterface[] $handlers
* @return $this * @return $this
*/ */
public function setHandlers(array $handlers) public function setHandlers(array $handlers)
@@ -209,7 +209,7 @@ class Logger implements LoggerInterface
/** /**
* Adds a processor on to the stack. * Adds a processor on to the stack.
* *
* @param callable $callback * @param callable $callback
* @return $this * @return $this
*/ */
public function pushProcessor($callback) public function pushProcessor($callback)
@@ -244,7 +244,6 @@ class Logger implements LoggerInterface
return $this->processors; return $this->processors;
} }
/** /**
* Control the use of microsecond resolution timestamps in the 'datetime' * Control the use of microsecond resolution timestamps in the 'datetime'
* member of new records. * member of new records.
@@ -260,13 +259,13 @@ class Logger implements LoggerInterface
*/ */
public function useMicrosecondTimestamps($micro) public function useMicrosecondTimestamps($micro)
{ {
$this->microsecondTimestamps = (bool)$micro; $this->microsecondTimestamps = (bool) $micro;
} }
/** /**
* Adds a log record. * Adds a log record.
* *
* @param integer $level The logging level * @param int $level The logging level
* @param string $message The log message * @param string $message The log message
* @param array $context The log context * @param array $context The log context
* @return Boolean Whether the record has been processed * @return Boolean Whether the record has been processed
@@ -433,7 +432,7 @@ class Logger implements LoggerInterface
/** /**
* Gets the name of the logging level. * Gets the name of the logging level.
* *
* @param integer $level * @param int $level
* @return string * @return string
*/ */
public static function getLevelName($level) public static function getLevelName($level)
@@ -463,7 +462,7 @@ class Logger implements LoggerInterface
/** /**
* Checks whether the Logger has a handler that listens on the given level * Checks whether the Logger has a handler that listens on the given level
* *
* @param integer $level * @param int $level
* @return Boolean * @return Boolean
*/ */
public function isHandling($level) public function isHandling($level)

View File

@@ -19,18 +19,18 @@ namespace Monolog\Processor;
abstract class MemoryProcessor abstract class MemoryProcessor
{ {
/** /**
* @var boolean If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported.
*/ */
protected $realUsage; protected $realUsage;
/** /**
* @var boolean If true, then format memory size to human readable string (MB, KB, B depending on size) * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size)
*/ */
protected $useFormatting; protected $useFormatting;
/** /**
* @param boolean $realUsage Set this to true to get the real size of memory allocated from system. * @param bool $realUsage Set this to true to get the real size of memory allocated from system.
* @param boolean $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size) * @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size)
*/ */
public function __construct($realUsage = true, $useFormatting = true) public function __construct($realUsage = true, $useFormatting = true)
{ {

View File

@@ -49,7 +49,7 @@ class Registry
* *
* @param Logger $logger Instance of the logging channel * @param Logger $logger Instance of the logging channel
* @param string|null $name Name of the logging channel ($logger->getName() by default) * @param string|null $name Name of the logging channel ($logger->getName() by default)
* @param boolean $overwrite Overwrite instance in the registry if the given name already exists? * @param bool $overwrite Overwrite instance in the registry if the given name already exists?
* @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists
*/ */
public static function addLogger(Logger $logger, $name = null, $overwrite = false) public static function addLogger(Logger $logger, $name = null, $overwrite = false)
@@ -107,8 +107,8 @@ class Registry
* Gets Logger instance from the registry * Gets Logger instance from the registry
* *
* @param string $name Name of the requested Logger instance * @param string $name Name of the requested Logger instance
* @return Logger Requested instance of Logger
* @throws \InvalidArgumentException If named Logger instance is not in the registry * @throws \InvalidArgumentException If named Logger instance is not in the registry
* @return Logger Requested instance of Logger
*/ */
public static function getInstance($name) public static function getInstance($name)
{ {
@@ -124,8 +124,8 @@ class Registry
* *
* @param string $name Name of the requested Logger instance * @param string $name Name of the requested Logger instance
* @param array $arguments Arguments passed to static method call * @param array $arguments Arguments passed to static method call
* @return Logger Requested instance of Logger
* @throws \InvalidArgumentException If named Logger instance is not in the registry * @throws \InvalidArgumentException If named Logger instance is not in the registry
* @return Logger Requested instance of Logger
*/ */
public static function __callStatic($name, $arguments) public static function __callStatic($name, $arguments)
{ {

View File

@@ -42,7 +42,7 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase
'extra' => array('ip' => '127.0.0.1'), 'extra' => array('ip' => '127.0.0.1'),
), ),
'unknown', 'unknown',
'error' 'error',
), ),
$message $message
); );
@@ -75,7 +75,7 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase
'extra' => array('ip' => '127.0.0.1'), 'extra' => array('ip' => '127.0.0.1'),
), ),
'test : 14', 'test : 14',
'error' 'error',
), ),
$message $message
); );
@@ -104,7 +104,7 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase
'meh', 'meh',
'log', 'log',
'unknown', 'unknown',
'log' 'log',
), ),
$message $message
); );
@@ -143,13 +143,13 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase
'meh', 'meh',
'log', 'log',
'unknown', 'unknown',
'info' 'info',
), ),
array( array(
'foo', 'foo',
'log2', 'log2',
'unknown', 'unknown',
'warn' 'warn',
), ),
), ),
$formatter->formatBatch($records) $formatter->formatBatch($records)

View File

@@ -108,7 +108,7 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
'context' => array('from' => 'logger'), 'context' => array('from' => 'logger'),
'datetime' => new \DateTime("@0"), 'datetime' => new \DateTime("@0"),
'extra' => array('key' => 'pair'), 'extra' => array('key' => 'pair'),
'message' => 'log' 'message' => 'log',
); );
$message = $formatter->format($record); $message = $formatter->format($record);
@@ -145,11 +145,11 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
'context' => array('from' => 'logger', 'exception' => array( 'context' => array('from' => 'logger', 'exception' => array(
'class' => '\Exception', 'class' => '\Exception',
'file' => '/some/file/in/dir.php:56', 'file' => '/some/file/in/dir.php:56',
'trace' => array('/some/file/1.php:23', '/some/file/2.php:3') 'trace' => array('/some/file/1.php:23', '/some/file/2.php:3'),
)), )),
'datetime' => new \DateTime("@0"), 'datetime' => new \DateTime("@0"),
'extra' => array(), 'extra' => array(),
'message' => 'log' 'message' => 'log',
); );
$message = $formatter->format($record); $message = $formatter->format($record);
@@ -173,7 +173,7 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
'context' => array('from' => 'logger'), 'context' => array('from' => 'logger'),
'datetime' => new \DateTime("@0"), 'datetime' => new \DateTime("@0"),
'extra' => array('key' => 'pair'), 'extra' => array('key' => 'pair'),
'message' => 'log' 'message' => 'log',
); );
$message = $formatter->format($record); $message = $formatter->format($record);

View File

@@ -44,7 +44,7 @@ class LineFormatterTest extends \PHPUnit_Framework_TestCase
'baz' => 'qux', 'baz' => 'qux',
'bool' => false, 'bool' => false,
'null' => null, 'null' => null,
) ),
)); ));
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'."\n", $message); $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'."\n", $message);
} }

View File

@@ -83,7 +83,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
'context' => array('from' => 'logger'), 'context' => array('from' => 'logger'),
'datetime' => new \DateTime("@0"), 'datetime' => new \DateTime("@0"),
'extra' => array('key' => 'pair'), 'extra' => array('key' => 'pair'),
'message' => 'log' 'message' => 'log',
); );
$message = json_decode($formatter->format($record), true); $message = json_decode($formatter->format($record), true);
@@ -116,7 +116,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
'context' => array('from' => 'logger'), 'context' => array('from' => 'logger'),
'datetime' => new \DateTime("@0"), 'datetime' => new \DateTime("@0"),
'extra' => array('key' => 'pair'), 'extra' => array('key' => 'pair'),
'message' => 'log' 'message' => 'log',
); );
$message = json_decode($formatter->format($record), true); $message = json_decode($formatter->format($record), true);
@@ -146,7 +146,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
'context' => array('from' => 'logger'), 'context' => array('from' => 'logger'),
'datetime' => new \DateTime("@0"), 'datetime' => new \DateTime("@0"),
'extra' => array('key' => 'pair'), 'extra' => array('key' => 'pair'),
'message' => 'log' 'message' => 'log',
); );
$message = json_decode($formatter->format($record), true); $message = json_decode($formatter->format($record), true);
@@ -223,7 +223,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
'context' => array('from' => 'logger'), 'context' => array('from' => 'logger'),
'datetime' => new \DateTime("@0"), 'datetime' => new \DateTime("@0"),
'extra' => array('key' => 'pair'), 'extra' => array('key' => 'pair'),
'message' => 'log' 'message' => 'log',
); );
$message = json_decode($formatter->format($record), true); $message = json_decode($formatter->format($record), true);
@@ -252,7 +252,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
'context' => array('from' => 'logger'), 'context' => array('from' => 'logger'),
'datetime' => new \DateTime("@0"), 'datetime' => new \DateTime("@0"),
'extra' => array('key' => 'pair'), 'extra' => array('key' => 'pair'),
'message' => 'log' 'message' => 'log',
); );
$message = json_decode($formatter->format($record), true); $message = json_decode($formatter->format($record), true);
@@ -278,7 +278,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
'context' => array('from' => 'logger'), 'context' => array('from' => 'logger'),
'datetime' => new \DateTime("@0"), 'datetime' => new \DateTime("@0"),
'extra' => array('key' => 'pair'), 'extra' => array('key' => 'pair'),
'message' => 'log' 'message' => 'log',
); );
$message = json_decode($formatter->format($record), true); $message = json_decode($formatter->format($record), true);

View File

@@ -1,5 +1,14 @@
<?php <?php
/*
* 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\Formatter; namespace Monolog\Formatter;
use Monolog\Logger; use Monolog\Logger;
@@ -128,9 +137,9 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
'property' => 'anything', 'property' => 'anything',
'nest3' => array( 'nest3' => array(
'nest4' => 'value', 'nest4' => 'value',
'property' => 'nothing' 'property' => 'nothing',
) ),
) ),
), ),
'level' => Logger::WARNING, 'level' => Logger::WARNING,
'level_name' => Logger::getLevelName(Logger::WARNING), 'level_name' => Logger::getLevelName(Logger::WARNING),
@@ -147,7 +156,7 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
'nest2' => array( 'nest2' => array(
'property' => 'anything', 'property' => 'anything',
'nest3' => '[...]', 'nest3' => '[...]',
) ),
), ),
$formattedResult['context'] $formattedResult['context']
); );
@@ -165,8 +174,8 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
'nest4' => array( 'nest4' => array(
'property' => 'nothing', 'property' => 'nothing',
), ),
) ),
) ),
), ),
'level' => Logger::WARNING, 'level' => Logger::WARNING,
'level_name' => Logger::getLevelName(Logger::WARNING), 'level_name' => Logger::getLevelName(Logger::WARNING),
@@ -186,9 +195,9 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
'property' => 'anything', 'property' => 'anything',
'nest4' => array( 'nest4' => array(
'property' => 'nothing', 'property' => 'nothing',
) ),
), ),
) ),
), ),
$formattedResult['context'] $formattedResult['context']
); );
@@ -205,7 +214,7 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
$record = array( $record = array(
'message' => 'some log message', 'message' => 'some log message',
'context' => array( 'context' => array(
'nest2' => $someObject 'nest2' => $someObject,
), ),
'level' => Logger::WARNING, 'level' => Logger::WARNING,
'level_name' => Logger::getLevelName(Logger::WARNING), 'level_name' => Logger::getLevelName(Logger::WARNING),

View File

@@ -51,7 +51,7 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
'inf' => 'INF', 'inf' => 'INF',
'-inf' => '-INF', '-inf' => '-INF',
'nan' => 'NaN', 'nan' => 'NaN',
) ),
), $formatted); ), $formatted);
} }
@@ -74,7 +74,7 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
'message' => $e2->getMessage(), 'message' => $e2->getMessage(),
'code' => $e2->getCode(), 'code' => $e2->getCode(),
'file' => $e2->getFile().':'.$e2->getLine(), 'file' => $e2->getFile().':'.$e2->getLine(),
) ),
), $formatted); ), $formatted);
} }

View File

@@ -1,4 +1,14 @@
<?php <?php
/*
* 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\Formatter; namespace Monolog\Formatter;
class ScalarFormatterTest extends \PHPUnit_Framework_TestCase class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
@@ -44,7 +54,7 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
'bam' => array(1, 2, 3), 'bam' => array(1, 2, 3),
'bat' => array('foo' => 'bar'), 'bat' => array('foo' => 'bar'),
'bap' => \DateTime::createFromFormat(\DateTime::ISO8601, '1970-01-01T00:00:00+0000'), 'bap' => \DateTime::createFromFormat(\DateTime::ISO8601, '1970-01-01T00:00:00+0000'),
'ban' => $exception 'ban' => $exception,
)); ));
$this->assertSame(array( $this->assertSame(array(
@@ -59,8 +69,8 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
'message' => $exception->getMessage(), 'message' => $exception->getMessage(),
'code' => $exception->getCode(), 'code' => $exception->getCode(),
'file' => $exception->getFile() . ':' . $exception->getLine(), 'file' => $exception->getFile() . ':' . $exception->getLine(),
'trace' => $this->buildTrace($exception) 'trace' => $this->buildTrace($exception),
)) )),
), $formatted); ), $formatted);
} }
@@ -68,11 +78,11 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
{ {
$context = array('file' => 'foo', 'line' => 1); $context = array('file' => 'foo', 'line' => 1);
$formatted = $this->formatter->format(array( $formatted = $this->formatter->format(array(
'context' => $context 'context' => $context,
)); ));
$this->assertSame(array( $this->assertSame(array(
'context' => $this->encodeJson($context) 'context' => $this->encodeJson($context),
), $formatted); ), $formatted);
} }
@@ -81,8 +91,8 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
$exception = new \Exception('foo'); $exception = new \Exception('foo');
$formatted = $this->formatter->format(array( $formatted = $this->formatter->format(array(
'context' => array( 'context' => array(
'exception' => $exception 'exception' => $exception,
) ),
)); ));
$this->assertSame(array( $this->assertSame(array(
@@ -92,9 +102,9 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
'message' => $exception->getMessage(), 'message' => $exception->getMessage(),
'code' => $exception->getCode(), 'code' => $exception->getCode(),
'file' => $exception->getFile() . ':' . $exception->getLine(), 'file' => $exception->getFile() . ':' . $exception->getLine(),
'trace' => $this->buildTrace($exception) 'trace' => $this->buildTrace($exception),
) ),
)) )),
), $formatted); ), $formatted);
} }
} }

View File

@@ -65,8 +65,8 @@ class AmqpHandlerTest extends TestCase
0, 0,
array( array(
'delivery_mode' => 2, 'delivery_mode' => 2,
'Content-type' => 'application/json' 'Content-type' => 'application/json',
) ),
); );
$handler->handle($record); $handler->handle($record);
@@ -117,8 +117,8 @@ class AmqpHandlerTest extends TestCase
null, null,
array( array(
'delivery_mode' => 2, 'delivery_mode' => 2,
'content_type' => 'application/json' 'content_type' => 'application/json',
) ),
); );
$handler->handle($record); $handler->handle($record);

View File

@@ -41,7 +41,7 @@ class ChromePHPHandlerTest extends TestCase
'test', 'test',
), ),
'request_uri' => '', 'request_uri' => '',
)))) )))),
); );
$this->assertEquals($expected, $handler->getHeaders()); $this->assertEquals($expected, $handler->getHeaders());
@@ -81,7 +81,7 @@ class ChromePHPHandlerTest extends TestCase
), ),
), ),
'request_uri' => '', 'request_uri' => '',
)))) )))),
); );
$this->assertEquals($expected, $handler->getHeaders()); $this->assertEquals($expected, $handler->getHeaders());
@@ -110,7 +110,7 @@ class ChromePHPHandlerTest extends TestCase
'test', 'test',
), ),
'request_uri' => '', 'request_uri' => '',
)))) )))),
); );
$this->assertEquals($expected, $handler2->getHeaders()); $this->assertEquals($expected, $handler2->getHeaders());

View File

@@ -67,7 +67,7 @@ class DynamoDbHandlerTest extends TestCase
->method('__call') ->method('__call')
->with('putItem', array(array( ->with('putItem', array(array(
'TableName' => 'foo', 'TableName' => 'foo',
'Item' => $formatted 'Item' => $formatted,
))); )));
$handler->handle($record); $handler->handle($record);

View File

@@ -174,7 +174,7 @@ class HipChatHandlerTest extends TestCase
array( array(
array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()), array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()),
array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()),
array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime()) array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime()),
), ),
'red', 'red',
), ),

View File

@@ -45,7 +45,7 @@ class LogEntriesHandlerTest extends TestCase
$records = array( $records = array(
$this->getRecord(), $this->getRecord(),
$this->getRecord(), $this->getRecord(),
$this->getRecord() $this->getRecord(),
); );
$this->createHandler(); $this->createHandler();
$this->handler->handleBatch($records); $this->handler->handleBatch($records);

View File

@@ -71,7 +71,8 @@ class NativeMailerHandlerTest extends TestCase
$mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org"); $mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org");
} }
public function testSend() { public function testSend()
{
$to = 'spammer@example.org'; $to = 'spammer@example.org';
$subject = 'dear victim'; $subject = 'dear victim';
$from = 'receiver@example.org'; $from = 'receiver@example.org';

View File

@@ -27,7 +27,6 @@ use PHPUnit_Framework_MockObject_MockObject;
*/ */
class PHPConsoleHandlerTest extends TestCase class PHPConsoleHandlerTest extends TestCase
{ {
/** @var Connector|PHPUnit_Framework_MockObject_MockObject */ /** @var Connector|PHPUnit_Framework_MockObject_MockObject */
protected $connector; protected $connector;
/** @var DebugDispatcher|PHPUnit_Framework_MockObject_MockObject */ /** @var DebugDispatcher|PHPUnit_Framework_MockObject_MockObject */
@@ -103,7 +102,7 @@ class PHPConsoleHandlerTest extends TestCase
protected function initLogger($handlerOptions = array(), $level = Logger::DEBUG) protected function initLogger($handlerOptions = array(), $level = Logger::DEBUG)
{ {
return new Logger('test', array( return new Logger('test', array(
new PHPConsoleHandler($handlerOptions, $this->connector, $level) new PHPConsoleHandler($handlerOptions, $this->connector, $level),
)); ));
} }

View File

@@ -109,7 +109,7 @@ class RavenHandlerTest extends TestCase
$user = array( $user = array(
'id' => '123', 'id' => '123',
'email' => 'test@test.com' 'email' => 'test@test.com',
); );
$recordWithContext = $this->getRecord(Logger::INFO, 'test', array('user' => $user)); $recordWithContext = $this->getRecord(Logger::INFO, 'test', array('user' => $user));

View File

@@ -1,5 +1,14 @@
<?php <?php
/*
* 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; namespace Monolog\Handler;
use Monolog\Logger; use Monolog\Logger;
@@ -63,7 +72,8 @@ class SwiftMailerHandlerTest extends TestCase
$handler->handleBatch($records); $handler->handleBatch($records);
} }
public function testMessageHaveUniqueId() { public function testMessageHaveUniqueId()
{
$messageTemplate = \Swift_Message::newInstance(); $messageTemplate = \Swift_Message::newInstance();
$handler = new SwiftMailerHandler($this->mailer, $messageTemplate); $handler = new SwiftMailerHandler($this->mailer, $messageTemplate);

View File

@@ -30,7 +30,7 @@ class ZendMonitorHandlerTest extends TestCase
{ {
$record = $this->getRecord(); $record = $this->getRecord();
$formatterResult = array( $formatterResult = array(
'message' => $record['message'] 'message' => $record['message'],
); );
$zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler') $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler')

View File

@@ -493,5 +493,4 @@ class LoggerTest extends \PHPUnit_Framework_TestCase
'without microseconds' => array(false, 'assertSame'), 'without microseconds' => array(false, 'assertSame'),
); );
} }
} }

View File

@@ -22,7 +22,7 @@ class PsrLogMessageProcessorTest extends \PHPUnit_Framework_TestCase
$message = $proc(array( $message = $proc(array(
'message' => '{foo}', 'message' => '{foo}',
'context' => array('foo' => $val) 'context' => array('foo' => $val),
)); ));
$this->assertEquals($expected, $message['message']); $this->assertEquals($expected, $message['message']);
} }

View File

@@ -24,6 +24,7 @@ class UidProcessorTest extends TestCase
$record = $processor($this->getRecord()); $record = $processor($this->getRecord());
$this->assertArrayHasKey('uid', $record['extra']); $this->assertArrayHasKey('uid', $record['extra']);
} }
public function testGetUid() public function testGetUid()
{ {
$processor = new UidProcessor(10); $processor = new UidProcessor(10);

View File

@@ -39,7 +39,7 @@ class TestCase extends \PHPUnit_Framework_TestCase
$this->getRecord(Logger::DEBUG, 'debug message 2'), $this->getRecord(Logger::DEBUG, 'debug message 2'),
$this->getRecord(Logger::INFO, 'information'), $this->getRecord(Logger::INFO, 'information'),
$this->getRecord(Logger::WARNING, 'warning'), $this->getRecord(Logger::WARNING, 'warning'),
$this->getRecord(Logger::ERROR, 'error') $this->getRecord(Logger::ERROR, 'error'),
); );
} }