Skip to content

Commit 65d4ae0

Browse files
committed
feature #13324 [WebProfilerBundle] Improved page for logs (hason)
This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes #13324). Discussion ---------- [WebProfilerBundle] Improved page for logs | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - *Before* ![logs-before](https://cloud.githubusercontent.com/assets/288535/5661713/3942c530-972f-11e4-89cb-2e185a6d07ac.png) *After* ![logs-after](https://cloud.githubusercontent.com/assets/288535/5661681/d02b50da-972e-11e4-96e8-0572428ba82f.png) Commits ------- 5fdc650 [WebProfilerBundle] Improved page for logs
2 parents 4b71fe0 + 5fdc650 commit 65d4ae0

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
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: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,30 @@
8787
</table>
8888

8989
{% if collector.logs %}
90-
<ul class="alt">
90+
<table>
91+
<tr>
92+
<th>#</th>
93+
<th>Priority</th>
94+
<th>Channel</th>
95+
<th>Message and context</th>
96+
</tr>
97+
9198
{% set log_loop_index = 0 %}
9299
{% for log in collector.logs %}
93100
{% 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) %}
94101
{% if priority == '-100' ? is_deprecation : log.priority >= priority %}
95102
{% set log_loop_index = log_loop_index + 1 %}
96-
<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 %}">
97-
{{ logger.display_message(loop.index, log, is_deprecation) }}
98-
</li>
103+
<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 %}">
104+
<td>{{ log_loop_index }}</td>
105+
<td>{{ is_deprecation ? 'DEPRECATION' : log.priorityName }}</td>
106+
<td>{{ log.channel is defined ? log.channel }}</td>
107+
<td>{{ logger.display_message(loop.index, log, is_deprecation) }}</td>
108+
</tr>
99109
{% endif %}
100110
{% else %}
101-
<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>
102112
{% endfor %}
103-
</ul>
113+
</table>
104114
{% else %}
105115
<p>
106116
<em>No logs available.</em>
@@ -114,7 +124,7 @@
114124
{% set stack = log.context.stack|default([]) %}
115125
{% set id = 'sf-call-stack-' ~ log_index %}
116126

117-
DEPRECATED - {{ log.message }}
127+
{{ log.message }}
118128

119129
{% if stack %}
120130
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">
@@ -144,7 +154,7 @@
144154
{% endif %}
145155
{% endfor %}
146156
{% else %}
147-
{{ log.priorityName }} - {{ log.message }}
157+
{{ log.message }}
148158
{% if log.context is defined and log.context is not empty %}
149159
<br />
150160
<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