فهرست منبع

merged branch Seldaek/monologbridge (PR #5297)

Commits
-------

e49afde Update monolog compatibility
832f8dd Add support for Monolog 1.2.0

Discussion
----------

Add support for Monolog 1.2.0

It's BC just in case someone still uses an older monolog version

---------------------------------------------------------------------------

by stloyd at 2012-08-19T07:20:24Z

IMO you should update `composer.json` too.

---------------------------------------------------------------------------

by Seldaek at 2012-08-19T07:36:51Z

1.* is still ok I think. Obviously the latest version is better, and if you update composer will pick the latest, but I don't think we need to force people to upgrade if there is no BC break.

---------------------------------------------------------------------------

by stloyd at 2012-08-19T07:46:31Z

But adding support for version `1.2` without changing `composer.json` which actually is: `>=1.0,<1.2-dev` is useless IMO.

---------------------------------------------------------------------------

by Seldaek at 2012-08-19T07:50:16Z

Where do you see `>=1.0,<1.2-dev`?

---------------------------------------------------------------------------

by stloyd at 2012-08-19T07:55:36Z

Here, in `2.0` branch: https://github.com/symfony/symfony/blob/2.0/composer.json#L21

---------------------------------------------------------------------------

by Seldaek at 2012-08-19T07:58:28Z

Ok fixed.. Everywhere else in the master branch it is required with `1.*` so I didn't get what you meant :)
Fabien Potencier 13 سال پیش
والد
کامیت
07d108af5e
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 1 1
      composer.json
  2. 5 1
      src/Symfony/Bridge/Monolog/Handler/DebugHandler.php

+ 1 - 1
composer.json

@@ -18,7 +18,7 @@
     "require": {
         "php": ">=5.3.2",
         "doctrine/common": ">=2.1,<2.3-dev",
-        "monolog/monolog": ">=1.0,<1.2-dev",
+        "monolog/monolog": ">=1.0,<1.3-dev",
         "swiftmailer/swiftmailer": "4.2.*",
         "twig/twig": ">=1.1,<2.0-dev"
     },

+ 5 - 1
src/Symfony/Bridge/Monolog/Handler/DebugHandler.php

@@ -47,7 +47,11 @@ class DebugHandler extends TestHandler implements DebugLoggerInterface
     public function countErrors()
     {
         $cnt = 0;
-        foreach (array(Logger::ERROR, Logger::CRITICAL, Logger::ALERT) as $level) {
+        $levels = array(Logger::ERROR, Logger::CRITICAL, Logger::ALERT);
+        if (defined('Monolog\Logger::EMERGENCY')) {
+            $levels[] = Logger::EMERGENCY;
+        }
+        foreach ($levels as $level) {
             if (isset($this->recordsByLevel[$level])) {
                 $cnt += count($this->recordsByLevel[$level]);
             }