Skip to content

Commit

Permalink
Fixing dependencies in production mode
Browse files Browse the repository at this point in the history
  • Loading branch information
fkeloks committed Sep 5, 2022
1 parent b5c9a15 commit d4338ba
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ services:
IbexaLogsUi\Bundle\EventSubscriber\MenuSubscriber:
tags:
- { name: kernel.event_subscriber }

IbexaLogsUi\Bundle\Twig\DumpLogExtension:
tags:
- { name: twig.extension }
6 changes: 3 additions & 3 deletions src/Resources/views/themes/admin/logs/logs.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,20 @@
</div>
</td>
<td class="text-break">
<samp>{{ profiler_dump_log(log.message, log.context) }}</samp>
<samp>{{ dump_log_message(log.message, log.context) }}</samp>
{% if log.context is not empty or log.extra is not empty %}
<details class="mt-2">
<summary>{{ 'logs_ui.text.show_more'|trans }}</summary>
{% if log.context is not empty %}
<div class="mt-2">
<strong>{{ 'logs_ui.text.context'|trans }}&nbsp;</strong>
{{ profiler_dump(log.context, maxDepth=1) }}
{{ dump_log_context(log.context, maxDepth=1) }}
</div>
{% endif %}
{% if log.extra is not empty %}
<div class="mt-2">
<strong>{{ 'logs_ui.text.extra'|trans }}&nbsp;</strong>
{{ profiler_dump(log.extra, maxDepth=1) }}
{{ dump_log_context(log.extra, maxDepth=1) }}
</div>
{% endif %}
</details>
Expand Down
28 changes: 28 additions & 0 deletions src/Twig/DumpLogExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace IbexaLogsUi\Bundle\Twig;

use Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension;
use Twig\TwigFunction;

class DumpLogExtension extends WebProfilerExtension
{
public function getName(): string
{
return 'dump_log';
}

public function getFunctions(): array
{
return [
new TwigFunction('dump_log_message', [$this, 'dumpLog'], [
'is_safe' => ['html'],
'needs_environment' => true
]),
new TwigFunction('dump_log_context', [$this, 'dumpData'], [
'is_safe' => ['html'],
'needs_environment' => true
]),
];
}
}

0 comments on commit d4338ba

Please sign in to comment.