mirror of
https://github.com/Seldaek/monolog.git
synced 2025-07-31 18:30:15 +02:00
Some consmetic changes
This commit is contained in:
@@ -21,9 +21,8 @@ use Monolog\Formatter\LineFormatter;
|
|||||||
*/
|
*/
|
||||||
class BrowserConsoleHandler extends AbstractProcessingHandler
|
class BrowserConsoleHandler extends AbstractProcessingHandler
|
||||||
{
|
{
|
||||||
static protected
|
static protected $initialized = false;
|
||||||
$initialized = false,
|
static protected $records = array();
|
||||||
$records = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
@@ -104,7 +103,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "(function(c){if (console && console.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);";
|
return "(function(c){if (c && c.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);";
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function handleStyles($formatted)
|
static public function handleStyles($formatted)
|
||||||
|
@@ -32,7 +32,7 @@ class BrowserConsoleHandlerTest extends TestCase
|
|||||||
$handler->handle($this->getRecord(Logger::DEBUG, 'foo[bar]{color: red}'));
|
$handler->handle($this->getRecord(Logger::DEBUG, 'foo[bar]{color: red}'));
|
||||||
|
|
||||||
$expected = <<<EOF
|
$expected = <<<EOF
|
||||||
(function(c){if (console && console.groupCollapsed) {
|
(function(c){if (c && c.groupCollapsed) {
|
||||||
c.log("%cfoo%cbar%c", "font-weight: normal", "color: red", "font-weight: normal");
|
c.log("%cfoo%cbar%c", "font-weight: normal", "color: red", "font-weight: normal");
|
||||||
}})(console);
|
}})(console);
|
||||||
EOF;
|
EOF;
|
||||||
@@ -50,7 +50,7 @@ EOF;
|
|||||||
$handler->handle($this->getRecord(Logger::DEBUG, '[foo]{macro: autolabel}'));
|
$handler->handle($this->getRecord(Logger::DEBUG, '[foo]{macro: autolabel}'));
|
||||||
|
|
||||||
$expected = <<<EOF
|
$expected = <<<EOF
|
||||||
(function(c){if (console && console.groupCollapsed) {
|
(function(c){if (c && c.groupCollapsed) {
|
||||||
c.log("%c%cfoo%c", "font-weight: normal", "background-color: blue; color: white; border-radius: 3px; padding: 0 2px 0 2px", "font-weight: normal");
|
c.log("%c%cfoo%c", "font-weight: normal", "background-color: blue; color: white; border-radius: 3px; padding: 0 2px 0 2px", "font-weight: normal");
|
||||||
c.log("%c%cbar%c", "font-weight: normal", "background-color: green; color: white; border-radius: 3px; padding: 0 2px 0 2px", "font-weight: normal");
|
c.log("%c%cbar%c", "font-weight: normal", "background-color: green; color: white; border-radius: 3px; padding: 0 2px 0 2px", "font-weight: normal");
|
||||||
c.log("%c%cfoo%c", "font-weight: normal", "background-color: blue; color: white; border-radius: 3px; padding: 0 2px 0 2px", "font-weight: normal");
|
c.log("%c%cfoo%c", "font-weight: normal", "background-color: blue; color: white; border-radius: 3px; padding: 0 2px 0 2px", "font-weight: normal");
|
||||||
@@ -68,7 +68,7 @@ EOF;
|
|||||||
$handler->handle($this->getRecord(Logger::DEBUG, 'test', array('foo' => 'bar')));
|
$handler->handle($this->getRecord(Logger::DEBUG, 'test', array('foo' => 'bar')));
|
||||||
|
|
||||||
$expected = <<<EOF
|
$expected = <<<EOF
|
||||||
(function(c){if (console && console.groupCollapsed) {
|
(function(c){if (c && c.groupCollapsed) {
|
||||||
c.groupCollapsed("%ctest", "font-weight: normal");
|
c.groupCollapsed("%ctest", "font-weight: normal");
|
||||||
c.log("%c%s", "font-weight: bold", "Context");
|
c.log("%c%s", "font-weight: bold", "Context");
|
||||||
c.log("%s: %o", "foo", "bar");
|
c.log("%s: %o", "foo", "bar");
|
||||||
@@ -93,7 +93,7 @@ EOF;
|
|||||||
$handler2->handle($this->getRecord(Logger::DEBUG, 'test4'));
|
$handler2->handle($this->getRecord(Logger::DEBUG, 'test4'));
|
||||||
|
|
||||||
$expected = <<<EOF
|
$expected = <<<EOF
|
||||||
(function(c){if (console && console.groupCollapsed) {
|
(function(c){if (c && c.groupCollapsed) {
|
||||||
c.log("%ctest1", "font-weight: normal");
|
c.log("%ctest1", "font-weight: normal");
|
||||||
c.log("%ctest2", "font-weight: normal");
|
c.log("%ctest2", "font-weight: normal");
|
||||||
c.log("%ctest3", "font-weight: normal");
|
c.log("%ctest3", "font-weight: normal");
|
||||||
|
Reference in New Issue
Block a user