Skip to content

Commit

Permalink
Merge remote branch 'Seldaek/monolog_bundle'
Browse files Browse the repository at this point in the history
* Seldaek/monolog_bundle:
  [MonologBundle] Added support for new Monolog log level
  [FrameworkBundle] Treat all log messages >=ERR as errors
  • Loading branch information
fabpot committed May 2, 2011
2 parents 8746f7b + a56ea15 commit 12fb4a0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<ol class="traces">
{% for log in logs %}
<li>
{% if 'ERR' == log.priorityName %}
{% if 'EMERG' == log.priorityName or 'ERR' == log.priorityName or 'CRIT' == log.priorityName
or 'ALERT' == log.priorityName or 'ERROR' == log.priorityName or 'CRITICAL' == log.priorityName %}
<em>{{ log.priorityName }}</em>
{% else %}
{{ log.priorityName }}
Expand Down
11 changes: 8 additions & 3 deletions src/Symfony/Bundle/MonologBundle/Logger/DebugHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bundle\MonologBundle\Logger;

use Monolog\Logger;
use Monolog\Handler\TestHandler;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;

Expand Down Expand Up @@ -43,8 +44,12 @@ public function getLogs()
*/
public function countErrors()
{
return isset($this->recordsByLevel[\Monolog\Logger::ERROR])
? count($this->recordsByLevel[\Monolog\Logger::ERROR])
: 0;
$cnt = 0;
foreach (array(Logger::ERROR, Logger::CRITICAL, Logger::ALERT) as $level) {
if (isset($this->recordsByLevel[$level])) {
$cnt += count($this->recordsByLevel[$level])
}
}
return $cnt;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,19 @@

<xsd:simpleType name="level">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="error" />
<xsd:enumeration value="warning" />
<xsd:enumeration value="info" />
<xsd:enumeration value="debug" />
<xsd:enumeration value="info" />
<xsd:enumeration value="warning" />
<xsd:enumeration value="error" />
<xsd:enumeration value="critical" />
<xsd:enumeration value="alert" />

<xsd:enumeration value="100" />
<xsd:enumeration value="200" />
<xsd:enumeration value="300" />
<xsd:enumeration value="400" />
<xsd:enumeration value="500" />
<xsd:enumeration value="550" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>

0 comments on commit 12fb4a0

Please sign in to comment.