1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-31 10:20:14 +02:00
This commit is contained in:
Jordi Boggiano
2015-03-01 14:12:35 +00:00
parent 951f024bfb
commit 995a61bec8
9 changed files with 25 additions and 16 deletions

15
.php_cs Normal file
View File

@@ -0,0 +1,15 @@
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->files()
->name('*.php')
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
;
return Symfony\CS\Config\Config::create()
->fixers(array(
'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',
))
->finder($finder)
;

View File

@@ -11,7 +11,6 @@
namespace Monolog\Handler;
/**
* Sampling handler
*

View File

@@ -157,11 +157,8 @@ class SlackHandler extends SocketHandler
}
if ($this->includeExtra) {
if (!empty($record['extra'])) {
if ($this->useShortAttachment) {
$attachment['fields'][] = array(
'title' => "Extra",
'value' => $this->stringify($record['extra']),
@@ -170,7 +167,7 @@ class SlackHandler extends SocketHandler
} else {
// Add all extra fields as individual fields in attachment
foreach ($record['extra'] as $var => $val) {
$attachment['fields'][] = array(
$attachment['fields'][] = array(
'title' => $var,
'value' => $val,
'short' => $this->useShortAttachment
@@ -180,9 +177,7 @@ class SlackHandler extends SocketHandler
}
if (!empty($record['context'])) {
if ($this->useShortAttachment) {
$attachment['fields'][] = array(
'title' => "Context",
'value' => $this->stringify($record['context']),
@@ -191,7 +186,7 @@ class SlackHandler extends SocketHandler
} else {
// Add all context fields as individual fields in attachment
foreach ($record['context'] as $var => $val) {
$attachment['fields'][] = array(
$attachment['fields'][] = array(
'title' => $var,
'value' => $val,
'short' => $this->useShortAttachment

View File

@@ -72,6 +72,7 @@ class Registry
{
if ($logger instanceof Logger) {
$index = array_search($logger, self::$loggers, true);
return false !== $index;
} else {
return isset(self::$loggers[$logger]);

View File

@@ -24,7 +24,7 @@ class GelfHandlerLegacyTest extends TestCase
$this->markTestSkipped("mlehner/gelf-php not installed");
}
require_once __DIR__ . '/GelfMocks.php';
require_once __DIR__ . '/GelfMockMessagePublisher.php';
}
/**
@@ -45,7 +45,7 @@ class GelfHandlerLegacyTest extends TestCase
protected function getMessagePublisher()
{
return new MockMessagePublisher('localhost');
return new GelfMockMessagePublisher('localhost');
}
public function testDebug()

View File

@@ -14,7 +14,7 @@ namespace Monolog\Handler;
use Gelf\MessagePublisher;
use Gelf\Message;
class MockMessagePublisher extends MessagePublisher
class GelfMockMessagePublisher extends MessagePublisher
{
public function publish(Message $message)
{

View File

@@ -11,8 +11,6 @@
namespace Monolog;
use Monolog\Logger;
use Monolog\Registry;
class RegistryTest extends \PHPUnit_Framework_TestCase
{
@@ -40,6 +38,7 @@ class RegistryTest extends \PHPUnit_Framework_TestCase
$logger1 = new Logger('test1');
$logger2 = new Logger('test2');
$logger3 = new Logger('test3');
return array(
// only instances
array(