public function __construct($app, array $defaultPaths = null, \Psr\Log\LoggerInterface $logger = null, $traceAlwaysOn = false, \Closure $lastAction = null, $ignore = [])
 {
     $this->app = $app;
     // Start BooBoo
     BooBoo::setUp($logger, $traceAlwaysOn, $lastAction, $ignore);
     if (!is_null($defaultPaths)) {
         foreach ($defaultPaths as $format => $path) {
             BooBoo::defaultErrorPath($format, $path);
         }
     }
 }
Exemple #2
0
\HTTP\Support\TypeSupport::addSupport([]);
class APIException extends \Exception\BooBoo
{
    const BAD_CALL = 'Incorrect use of API';
    protected function getTag()
    {
        return 'ApiError';
    }
    protected function getTemplates()
    {
        return ['json' => __DIR__ . '/../src/templates/json.php'];
    }
}
$logger = (new \Monolog\Logger('TEST'))->pushHandler(new \Monolog\Handler\FingersCrossedHandler(new \Monolog\Handler\StreamHandler(__DIR__ . '/log'), \Monolog\Logger::WARNING))->pushHandler(new \Monolog\Handler\FilterHandler(new \Monolog\Handler\StreamHandler(__DIR__ . '/error.log', \Monolog\Logger::DEBUG), \Monolog\Logger::DEBUG, \Monolog\Logger::NOTICE));
BooBoo::setUp($logger, true, function () {
    error_log("testing callable");
}, [E_NOTICE, E_DEPRECATED]);
//BooBoo::setUp();
//throw new Exception("FAIL");
//trigger_error("hahaha", E_USER_NOTICE);
$logger->debug("DEBBUGGINGGGGGGGGGGGGG");
$logger->notice("this will only appear in the logs when there's an error higuer or equal to a \\Monolog\\Logger::WARNING");
//$logger->warning("this will only appear in the logs when there's an error higuer or equal to a \Monolog\Logger::WARNING");
BooBoo::addVars(['userAgent' => 'mine']);
//try {
throw (new APIException(APIException::BAD_CALL))->response((new \HTTP\Response())->withStatus(400))->displayMessage("BAHAHAHAHA")->logContext(['bananas' => 'aaa'])->templateData(['a' => 'b'])->trace(false);
//} catch (\Exception $e) {
throw new \Exception('mmm');
//}
//fatal error
$a->o();