Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0763898

Browse files
committed
bug #23588 [WebProfilerBundle] Display trace and context in the logger profiler (lyrixx)
This PR was merged into the 3.3 branch. Discussion ---------- [WebProfilerBundle] Display trace and context in the logger profiler | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Right now the behavior is not perfect. It can display only the trace **or** the context. Some time, we want both. More over, using `{{ profiler_dump_log(log.message, trace) }}` is wrong Commits ------- ef1e508 [WebProfilerBundle] Display trace and context in the logger profiler
2 parents 95fd077 + ef1e508 commit 0763898

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

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

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -224,31 +224,33 @@
224224
{% endmacro %}
225225

226226
{% macro render_log_message(category, log_index, log) %}
227-
{% if log.context.exception.trace is defined %}
228-
{{ profiler_dump_log(log.message, log.context) }}
229-
230-
{% set context_id = 'context-' ~ category ~ '-' ~ log_index %}
227+
{% set has_context = log.context is defined and log.context is not empty %}
228+
{% set has_trace = log.context.exception.trace is defined %}
231229

232-
<span class="metadata">
233-
<a class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ context_id }}" data-toggle-alt-content="Hide trace">Show trace</a>
234-
235-
<div id="{{ context_id }}" class="context sf-toggle-content sf-toggle-hidden">
236-
{{ profiler_dump(log.context.exception.trace, maxDepth=1) }}
237-
</div>
238-
</span>
239-
{% elseif log.context is defined and log.context is not empty %}
230+
{% if not has_context %}
231+
{{ profiler_dump_log(log.message) }}
232+
{% else %}
240233
{{ profiler_dump_log(log.message, log.context) }}
241234

242-
{% set context_id = 'context-' ~ category ~ '-' ~ log_index %}
235+
<div class="text-small font-normal">
236+
{% set context_id = 'context-' ~ category ~ '-' ~ log_index %}
237+
<a class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ context_id }}" data-toggle-alt-content="Hide context">Show context</a>
243238

244-
<span class="metadata">
245-
<a class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ context_id }}" data-toggle-alt-content="Hide context">Show context</a>
239+
{% if has_trace %}
240+
&nbsp;&nbsp;
241+
{% set trace_id = 'trace-' ~ category ~ '-' ~ log_index %}
242+
<a class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ trace_id }}" data-toggle-alt-content="Hide trace">Show trace</a>
243+
{% endif %}
244+
</div>
245+
246+
<div id="{{ context_id }}" class="context sf-toggle-content sf-toggle-hidden">
247+
{{ profiler_dump(log.context, maxDepth=1) }}
248+
</div>
246249

247-
<div id="{{ context_id }}" class="context sf-toggle-content sf-toggle-hidden">
248-
{{ profiler_dump(log.context, maxDepth=1) }}
250+
{% if has_trace %}
251+
<div id="{{ trace_id }}" class="context sf-toggle-content sf-toggle-hidden">
252+
{{ profiler_dump(log.context.exception.trace, maxDepth=1) }}
249253
</div>
250-
</span>
251-
{% else %}
252-
{{ profiler_dump_log(log.message) }}
254+
{% endif %}
253255
{% endif %}
254256
{% endmacro %}

0 commit comments

Comments
 (0)