|
224 | 224 | {% endmacro %}
|
225 | 225 |
|
226 | 226 | {% 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 %} |
231 | 229 |
|
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 %} |
240 | 233 | {{ profiler_dump_log(log.message, log.context) }}
|
241 | 234 |
|
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> |
243 | 238 |
|
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 | + |
| 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> |
246 | 249 |
|
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) }} |
249 | 253 | </div>
|
250 |
| - </span> |
251 |
| - {% else %} |
252 |
| - {{ profiler_dump_log(log.message) }} |
| 254 | + {% endif %} |
253 | 255 | {% endif %}
|
254 | 256 | {% endmacro %}
|
0 commit comments