1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-21 16:46:11 +02:00
This commit is contained in:
Jordi Boggiano
2015-07-14 10:25:17 +01:00
parent cf6fa57dd4
commit ca1376bd61
20 changed files with 42 additions and 41 deletions

View File

@@ -63,8 +63,8 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
// Check content type
foreach (headers_list() as $header) {
if (stripos($header, 'content-type:') === 0) {
// This handler only works with HTML and javascript outputs
// text/javascript is obsolete in favour of application/javascript, but still used
// This handler only works with HTML and javascript outputs
// text/javascript is obsolete in favour of application/javascript, but still used
if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) {
$htmlTags = false;
} elseif (stripos($header, 'text/html') === false) {

View File

@@ -129,7 +129,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
$json = @json_encode(self::$json);
$data = base64_encode(utf8_encode($json));
if (strlen($data) > 240*1024) {
if (strlen($data) > 240 * 1024) {
self::$overflowed = true;
$record = array(

View File

@@ -33,7 +33,6 @@ class Util
{
while ($retries--) {
if (curl_exec($ch) === false) {
if (false === in_array(curl_errno($ch), self::$retriableErrorCodes, true) || !$retries) {
if ($closeAfterDone) {
curl_close($ch);

View File

@@ -215,7 +215,7 @@ class PHPConsoleHandler extends AbstractProcessingHandler
{
$tags = null;
if (!empty($record['context'])) {
$context =& $record['context'];
$context = & $record['context'];
foreach ($this->options['debugTagsKeysInContext'] as $key) {
if (!empty($context[$key])) {
$tags = $context[$key];
@@ -240,4 +240,3 @@ class PHPConsoleHandler extends AbstractProcessingHandler
return new LineFormatter('%message%');
}
}

View File

@@ -167,7 +167,6 @@ class RavenHandler extends AbstractProcessingHandler
if ($previousUserContext !== false) {
$this->ravenClient->user_context($previousUserContext);
}
}
/**

View File

@@ -56,8 +56,7 @@ class RedisHandler extends AbstractProcessingHandler
*/
protected function write(array $record)
{
if ($this->capSize)
{
if ($this->capSize) {
$this->writeCapped($record);
} else {
$this->redisClient->rpush($this->redisKey, $record["formatted"]);
@@ -73,7 +72,7 @@ class RedisHandler extends AbstractProcessingHandler
*/
protected function writeCapped(array $record)
{
if($this->redisClient instanceof \Redis) {
if ($this->redisClient instanceof \Redis) {
$this->redisClient->multi()
->rpush($this->redisKey, $record["formatted"])
->ltrim($this->redisKey, -$this->capSize, -1)
@@ -81,7 +80,7 @@ class RedisHandler extends AbstractProcessingHandler
} else {
$redisKey = $this->redisKey;
$capSize = $this->capSize;
$this->redisClient->transaction(function($tx) use($record, $redisKey, $capSize) {
$this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) {
$tx->rpush($redisKey, $record["formatted"]);
$tx->ltrim($redisKey, -$capSize, -1);
});

View File

@@ -219,6 +219,7 @@ class SlackHandler extends SocketHandler
if ($this->iconEmoji) {
$dataArray['icon_emoji'] = ":{$this->iconEmoji}:";
}
return $dataArray;
}

View File

@@ -190,7 +190,7 @@ class SocketHandler extends AbstractProcessingHandler
protected function streamSetTimeout()
{
$seconds = floor($this->timeout);
$microseconds = round(($this->timeout - $seconds)*1e6);
$microseconds = round(($this->timeout - $seconds) * 1e6);
return stream_set_timeout($this->resource, $seconds, $microseconds);
}

View File

@@ -57,7 +57,7 @@ class SwiftMailerHandler extends MailHandler
$message = null;
if ($this->messageTemplate instanceof \Swift_Message) {
$message = clone $this->messageTemplate;
} else if (is_callable($this->messageTemplate)) {
} elseif (is_callable($this->messageTemplate)) {
$message = call_user_func($this->messageTemplate, $content, $records);
}

View File

@@ -11,8 +11,6 @@
namespace Monolog\Handler;
use Monolog\Logger;
/**
* Used for testing purposes.
*
@@ -28,7 +26,7 @@ use Monolog\Logger;
* @method boolean hasNotice($record)
* @method boolean hasInfo($record)
* @method boolean hasDebug($record)
*
*
* @method boolean hasEmergencyRecords()
* @method boolean hasAlertRecords()
* @method boolean hasCriticalRecords()
@@ -37,7 +35,7 @@ use Monolog\Logger;
* @method boolean hasNoticeRecords()
* @method boolean hasInfoRecords()
* @method boolean hasDebugRecords()
*
*
* @method boolean hasEmergencyThatContains($message)
* @method boolean hasAlertThatContains($message)
* @method boolean hasCriticalThatContains($message)
@@ -46,7 +44,7 @@ use Monolog\Logger;
* @method boolean hasNoticeThatContains($message)
* @method boolean hasInfoThatContains($message)
* @method boolean hasDebugThatContains($message)
*
*
* @method boolean hasEmergencyThatMatches($message)
* @method boolean hasAlertThatMatches($message)
* @method boolean hasCriticalThatMatches($message)
@@ -55,7 +53,7 @@ use Monolog\Logger;
* @method boolean hasNoticeThatMatches($message)
* @method boolean hasInfoThatMatches($message)
* @method boolean hasDebugThatMatches($message)
*
*
* @method boolean hasEmergencyThatPasses($message)
* @method boolean hasAlertThatPasses($message)
* @method boolean hasCriticalThatPasses($message)
@@ -86,21 +84,21 @@ class TestHandler extends AbstractProcessingHandler
$record = $record['message'];
}
return $this->hasRecordThatPasses(function($rec) use ($record) {
return $this->hasRecordThatPasses(function ($rec) use ($record) {
return $rec['message'] === $record;
}, $level);
}
public function hasRecordThatContains($message, $level)
{
return $this->hasRecordThatPasses(function($rec) use ($message) {
return $this->hasRecordThatPasses(function ($rec) use ($message) {
return strpos($rec['message'], $message) !== false;
}, $level);
}
public function hasRecordThatMatches($regex, $level)
{
return $this->hasRecordThatPasses(function($rec) use ($regex) {
return $this->hasRecordThatPasses(function ($rec) use ($regex) {
return preg_match($regex, $rec['message']) > 0;
}, $level);
}
@@ -133,7 +131,6 @@ class TestHandler extends AbstractProcessingHandler
$this->records[] = $record;
}
public function __call($method, $args)
{
if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
@@ -141,6 +138,7 @@ class TestHandler extends AbstractProcessingHandler
$level = constant('Monolog\Logger::' . strtoupper($matches[2]));
if (method_exists($this, $genericMethod)) {
$args[] = $level;
return call_user_func_array(array($this, $genericMethod), $args);
}
}