Skip to content

Commit 8725daf

Browse files
committed
[WebProfilerBundle] Improved page for logs
1 parent dece1e0 commit 8725daf

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

src/Symfony/Bridge/Monolog/Handler/DebugHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function getLogs()
3535
'priority' => $record['level'],
3636
'priorityName' => $record['level_name'],
3737
'context' => $record['context'],
38+
'channel' => isset($record['channel']) ? $record['channel'] : '',
3839
);
3940
}
4041

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,30 @@
8787
</table>
8888

8989
{% if collector.logs %}
90-
<ul class="alt">
91-
{% for log in collector.logs if priority >= 0 and log.priority >= priority or priority < 0 and log.context.type|default(0) == priority %}
92-
<li class="{{ cycle(['odd', 'even'], loop.index) }}{% if log.priority >= 400 %} error{% elseif log.priority >= 300 %} warning{% endif %}{% if log.context.scream is defined %} scream{% endif %}">
93-
{{ logger.display_message(loop.index, log) }}
94-
</li>
90+
<table>
91+
<tr>
92+
<th>#</th>
93+
<th>Priority</th>
94+
<th>Channel</th>
95+
<th>Message and context</th>
96+
</tr>
97+
{% for i, log in collector.logs if priority >= 0 and log.priority >= priority or priority < 0 and log.context.type|default(0) == priority %}
98+
<tr class="{% if log.priority >= 400 %}error{% elseif log.priority >= 300 %}warning{% endif %}{% if log.context.scream is defined %}scream{% endif %}">
99+
<td>{{ i + 1 }}</td>
100+
<td>
101+
{%- if log.context.type is defined and (constant('E_DEPRECATED') == log.context.type or constant('E_USER_DEPRECATED') == log.context.type) -%}
102+
DEPRECATION
103+
{%- else -%}
104+
{{ log.priorityName }}
105+
{%- endif -%}
106+
</td>
107+
<td>{{ log.channel is defined ? log.channel }}</td>
108+
<td>{{ logger.display_message(loop.index, log) }}</td>
109+
</tr>
95110
{% else %}
96-
<li><em>No logs available for this priority.</em></li>
111+
<tr><td colspan="4"><em>No logs available for {{ priority }} priority.</em></td></tr>
97112
{% endfor %}
98-
</ul>
113+
</table>
99114
{% else %}
100115
<p>
101116
<em>No logs available.</em>
@@ -105,8 +120,8 @@
105120

106121

107122
{% macro display_message(log_index, log) %}
108-
{% if 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) %}
109-
DEPRECATION - {{ log.message }}
123+
{% if log.context.stack is defined and log.context.type is defined and (constant('E_DEPRECATED') == log.context.type or constant('E_USER_DEPRECATED') == log.context.type) %}
124+
{{ log.message }}
110125
{% set id = 'sf-call-stack-' ~ log_index %}
111126
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">
112127
<img class="toggle" id="{{ id }}-off" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="display:none">
@@ -133,7 +148,7 @@
133148
{% endif %}
134149
{% endfor %}
135150
{% else %}
136-
{{ log.priorityName }} - {{ log.message }}
151+
{{ log.message }}
137152
{% if log.context is defined and log.context is not empty %}
138153
<br />
139154
<small>

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ pre, code {
179179
width: 250px;
180180
margin-left: -100%;
181181
}
182-
#collector-content table td {
182+
table td {
183183
background-color: white;
184184
}
185185
h1 {
@@ -273,15 +273,15 @@ ul.alt li {
273273
ul.alt li.even {
274274
background: #f1f7e2;
275275
}
276-
ul.alt li.error {
276+
ul.alt li.error, tr.error td {
277277
background-color: #f66;
278278
margin-bottom: 1px;
279279
}
280-
ul.alt li.warning {
280+
ul.alt li.warning, tr.warning td {
281281
background-color: #ffcc00;
282282
margin-bottom: 1px;
283283
}
284-
ul.alt li.scream, ul.alt li.scream strong {
284+
ul.alt li.scream, ul.alt li.scream strong, tr.scream td, tr.scream strong {
285285
color: gray;
286286
}
287287
ul.sf-call-stack li {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy