Skip to content

[WebProfilerBundle] Improved page for logs #13324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Symfony/Bridge/Monolog/Handler/DebugHandler.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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