Skip to content

Commit

Permalink
[WebProfilerBundle] Improved page for logs
Browse files Browse the repository at this point in the history
  • Loading branch information
hason authored and fabpot committed May 17, 2015
1 parent 4b71fe0 commit 5fdc650
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/Symfony/Bridge/Monolog/Handler/DebugHandler.php
Expand Up @@ -35,6 +35,7 @@ public function getLogs()
'priority' => $record['level'],
'priorityName' => $record['level_name'],
'context' => $record['context'],
'channel' => isset($record['channel']) ? $record['channel'] : '',
);
}

Expand Down
Expand Up @@ -87,20 +87,30 @@
</table>

{% if collector.logs %}
<ul class="alt">
<table>
<tr>
<th>#</th>
<th>Priority</th>
<th>Channel</th>
<th>Message and context</th>
</tr>

{% 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 %}
{% 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 or is_deprecation %} warning{% endif %}">
{{ logger.display_message(loop.index, log, is_deprecation) }}
</li>
<tr class="{{ cycle(['odd', 'even'], log_loop_index) }}{% if log.context.scream is defined %} scream{% elseif log.priority >= 400 %} error{% elseif log.priority >= 300 or is_deprecation %} warning{% endif %}">
<td>{{ log_loop_index }}</td>
<td>{{ is_deprecation ? 'DEPRECATION' : log.priorityName }}</td>
<td>{{ log.channel is defined ? log.channel }}</td>
<td>{{ logger.display_message(loop.index, log, is_deprecation) }}</td>
</tr>
{% endif %}
{% else %}
<li><em>No logs available for this priority.</em></li>
<tr><td colspan="4"><em>No logs available for {{ priority }} priority.</em></td></tr>
{% endfor %}
</ul>
</table>
{% else %}
<p>
<em>No logs available.</em>
Expand All @@ -114,7 +124,7 @@
{% set stack = log.context.stack|default([]) %}
{% set id = 'sf-call-stack-' ~ log_index %}

DEPRECATED - {{ log.message }}
{{ log.message }}

{% if stack %}
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">
Expand Down Expand Up @@ -144,7 +154,7 @@
{% endif %}
{% endfor %}
{% else %}
{{ log.priorityName }} - {{ log.message }}
{{ log.message }}
{% if log.context is defined and log.context is not empty %}
<br />
<small>
Expand Down
Expand Up @@ -179,7 +179,7 @@ pre, code {
width: 250px;
margin-left: -100%;
}
#collector-content table td {
table td {
background-color: white;
}
h1 {
Expand Down Expand Up @@ -273,15 +273,15 @@ ul.alt li {
ul.alt li.even {
background: #f1f7e2;
}
ul.alt li.error {
ul.alt li.error, tr.error td {
background-color: #f66;
margin-bottom: 1px;
}
ul.alt li.warning {
ul.alt li.warning, tr.warning td {
background-color: #ffcc00;
margin-bottom: 1px;
}
ul.alt li.scream, ul.alt li.scream strong {
ul.alt li.scream, ul.alt li.scream strong, tr.scream td, tr.scream strong {
color: gray;
}
ul.sf-call-stack li {
Expand Down

0 comments on commit 5fdc650

Please sign in to comment.