LoggerConfig::getFor always returns the same instance of Logger for the same $name.

This avoid issues when push handlers/processors to that logger.
Use the Monolog\ErrorHandler to log errors and exceptions.
PHPCI/Logging/Handler becomes PHPCI/ErrorHandler.
And it only throws ErrorException for reported errors.
No need to initialize a second $loggerConfig in daemonise.

Close #892
This commit is contained in:
Adirelle 2015-03-30 08:56:30 +02:00 committed by Tobias van Beek
commit 7c622bd712
5 changed files with 95 additions and 7 deletions

View file

@ -8,7 +8,6 @@
*/
// Let PHP take a guess as to the default timezone, if the user hasn't set one:
use PHPCI\Logging\Handler;
use PHPCI\Logging\LoggerConfig;
$timezone = ini_get('date.timezone');
@ -43,9 +42,10 @@ if (!file_exists(dirname(__FILE__) . '/vendor/autoload.php') && defined('PHPCI_I
// Load Composer autoloader:
require_once(dirname(__FILE__) . '/vendor/autoload.php');
\PHPCI\ErrorHandler::register();
if (defined('PHPCI_IS_CONSOLE') && PHPCI_IS_CONSOLE) {
$loggerConfig = LoggerConfig::newFromFile(__DIR__ . "/loggerconfig.php");
Handler::register($loggerConfig->getFor('_'));
}
// Load configuration if present: