bug #14226 [Profiler][Logger] fixed cycle odd/even. (aitboudad)

This PR was merged into the 2.6 branch.

Discussion
----------

[Profiler][Logger] fixed cycle odd/even.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | ~
| Tests pass?   | yes
| License       | MIT

Before:
![selection_023](https://cloud.githubusercontent.com/assets/1753742/6999021/bcdf1bb0-dbee-11e4-843a-0b01842aeec4.png)

After:
![selection_024](https://cloud.githubusercontent.com/assets/1753742/6999022/c5dcffde-dbee-11e4-9410-bf6fc8000e38.png)

Commits
-------

9a9c56f [Profiler][Logger] fixed cycle odd/even.
This commit is contained in:
Nicolas Grekas 2015-04-06 10:58:04 +02:00
commit 347b17e966
1 changed files with 3 additions and 1 deletions

View File

@ -88,10 +88,12 @@
{% if collector.logs %}
<ul class="alt">
{% set log_loop_index = 0 %}
{% for log in collector.logs %}
{% set is_deprecation = log.context.level is defined and log.context.type is defined and (constant('E_DEPRECATED') == log.context.type or constant('E_USER_DEPRECATED') == log.context.type) %}
{% if priority == '-100' ? is_deprecation : log.priority >= priority %}
<li class="{{ cycle(['odd', 'even'], loop.index) }}{% if log.context.scream is defined %} scream{% elseif log.priority >= 400 %} error{% elseif log.priority >= 300 %} warning{% endif %}">
{% set log_loop_index = log_loop_index + 1 %}
<li class="{{ cycle(['odd', 'even'], log_loop_index) }}{% if log.context.scream is defined %} scream{% elseif log.priority >= 400 %} error{% elseif log.priority >= 300 %} warning{% endif %}">
{{ logger.display_message(loop.index, log, is_deprecation) }}
</li>
{% endif %}