diff --git a/Controller/LogViewController.php b/Controller/LogViewController.php new file mode 100644 index 0000000..327c2ff --- /dev/null +++ b/Controller/LogViewController.php @@ -0,0 +1,24 @@ +getLatest($amount); + + dump(($logs)); + + return $this->render('@ArdentLogger/errors.html.twig', [ + 'logs' => $logs, + ]); + } +} diff --git a/Resources/views/errors.html.twig b/Resources/views/errors.html.twig new file mode 100644 index 0000000..07b4891 --- /dev/null +++ b/Resources/views/errors.html.twig @@ -0,0 +1,19 @@ +{% extends '@ArdentLogger/layout.html.twig' %} + +{% block ardent_logger_user_content %} + Error overview
+ + {% for log in logs %} + {# @var log \App\Ardent\LoggerBundle\Entity\LogEntry #} +
+
+
{{ log.levelName }} #{{ log.id }}
+
{{ log.createdAt | date('D, d M y H:i:s') }}
+

{{ log.message }}

+ {% for context in log.context %} +

> {{ context }}

+ {% endfor %} +
+
+ {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/Resources/views/layout.html.twig b/Resources/views/layout.html.twig new file mode 100644 index 0000000..1549a3a --- /dev/null +++ b/Resources/views/layout.html.twig @@ -0,0 +1,2 @@ +{% block ardent_logger_user_content %} +{% endblock %} \ No newline at end of file diff --git a/Service/LoggerService.php b/Service/LoggerService.php index 640ddcf..e85aae9 100644 --- a/Service/LoggerService.php +++ b/Service/LoggerService.php @@ -4,7 +4,6 @@ namespace App\Ardent\LoggerBundle\Service; use App\Ardent\LoggerBundle\Entity\LogEntry; use Doctrine\ORM\EntityManagerInterface; -use phpDocumentor\Reflection\Types\This; use Psr\Log\InvalidArgumentException; class LoggerService @@ -168,7 +167,7 @@ class LoggerService return $context; } - public function getLatest($level = self::DEBUG, $amount = 1) + public function getLatest($amount = 1, $level = self::DEBUG) { $qb = $this->em->createQueryBuilder();