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:
parent
5688d9c4c8
commit
f46a8be648
5 changed files with 95 additions and 7 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue