mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-12 16:14:08 +02:00
Use more "unique" markers format for styling
This commit is contained in:
@@ -29,7 +29,7 @@ class BrowserConsoleHandlerTest extends TestCase
|
||||
$handler = new BrowserConsoleHandler();
|
||||
$handler->setFormatter($this->getIdentityFormatter());
|
||||
|
||||
$handler->handle($this->getRecord(Logger::DEBUG, 'foo[bar]{color: red}'));
|
||||
$handler->handle($this->getRecord(Logger::DEBUG, 'foo[[bar]]{color: red}'));
|
||||
|
||||
$expected = <<<EOF
|
||||
(function(c){if (c && c.groupCollapsed) {
|
||||
@@ -40,14 +40,31 @@ EOF;
|
||||
$this->assertEquals($expected, BrowserConsoleHandler::generateScript());
|
||||
}
|
||||
|
||||
public function testEscaping()
|
||||
{
|
||||
$handler = new BrowserConsoleHandler();
|
||||
$handler->setFormatter($this->getIdentityFormatter());
|
||||
|
||||
$handler->handle($this->getRecord(Logger::DEBUG, "[foo] [[\"bar\n[baz]\"]]{color: red}"));
|
||||
|
||||
$expected = <<<EOF
|
||||
(function(c){if (c && c.groupCollapsed) {
|
||||
c.log("%c[foo] %c\"bar\\n[baz]\"%c", "font-weight: normal", "color: red", "font-weight: normal");
|
||||
}})(console);
|
||||
EOF;
|
||||
|
||||
$this->assertEquals($expected, BrowserConsoleHandler::generateScript());
|
||||
}
|
||||
|
||||
|
||||
public function testAutolabel()
|
||||
{
|
||||
$handler = new BrowserConsoleHandler();
|
||||
$handler->setFormatter($this->getIdentityFormatter());
|
||||
|
||||
$handler->handle($this->getRecord(Logger::DEBUG, '[foo]{macro: autolabel}'));
|
||||
$handler->handle($this->getRecord(Logger::DEBUG, '[bar]{macro: autolabel}'));
|
||||
$handler->handle($this->getRecord(Logger::DEBUG, '[foo]{macro: autolabel}'));
|
||||
$handler->handle($this->getRecord(Logger::DEBUG, '[[foo]]{macro: autolabel}'));
|
||||
$handler->handle($this->getRecord(Logger::DEBUG, '[[bar]]{macro: autolabel}'));
|
||||
$handler->handle($this->getRecord(Logger::DEBUG, '[[foo]]{macro: autolabel}'));
|
||||
|
||||
$expected = <<<EOF
|
||||
(function(c){if (c && c.groupCollapsed) {
|
||||
|
Reference in New Issue
Block a user