allow newlines in cli output, add FirePHP handler to browser console log

This commit is contained in:
Daniel Seifert 2019-09-20 22:30:27 +02:00
parent bd16bf36cd
commit d21a3f892d
2 changed files with 18 additions and 2 deletions

View File

@ -5,7 +5,7 @@ require __DIR__ . '/../../../../source/bootstrap.php';
\D3StartSQLLog('Query for 100 items cheaper than 49,99');
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
$list = $db->getAll('SELECT * FROM oxarticles WHERE oxprice < ? LIMIT 100', [49.99]);
$list = $db->getAll('SELECT * '.PHP_EOL.'FROM oxarticles WHERE oxprice < ? LIMIT 100', [49.99]);
\D3StopSQLLog();

View File

@ -34,6 +34,7 @@ class LoggerFactory
$handlers[] = $this->getStreamHandler();
} else {
$handlers[] = $this->getBrowserConsoleHandler();
$handlers[] = $this->getFirePHPHandler();
}
return $handlers;
}
@ -53,7 +54,14 @@ class LoggerFactory
$ttl_color = "$channel $level_name: $message {$newline} $context {$newline} %extra%" . PHP_EOL;
$streamHandler->setFormatter(new Monolog\Formatter\LineFormatter($ttl_color));
$streamHandler->setFormatter(
new Monolog\Formatter\LineFormatter(
$ttl_color,
null,
true,
true
)
);
return $streamHandler;
}
@ -66,6 +74,14 @@ class LoggerFactory
return new Monolog\Handler\BrowserConsoleHandler();
}
/**
* @return Monolog\Handler\FirePHPHandler
*/
private function getFirePHPHandler()
{
return new Monolog\Handler\FirePHPHandler();
}
/**
* @return array
*/