]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Added logger when we match Tagging rules
authorNicolas Lœuillet <nicolas@loeuillet.org>
Fri, 12 May 2017 11:13:19 +0000 (13:13 +0200)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Fri, 12 May 2017 11:13:19 +0000 (13:13 +0200)
src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
src/Wallabag/CoreBundle/Resources/config/services.yml

index b490e2090b4a95d5f263b1d1c5f9d17be8cdc9d3..add27db2b4ea0741a06fe1a70dc2ee928a307ca9 100644 (file)
@@ -8,6 +8,7 @@ use Wallabag\CoreBundle\Entity\Tag;
 use Wallabag\CoreBundle\Repository\EntryRepository;
 use Wallabag\CoreBundle\Repository\TagRepository;
 use Wallabag\UserBundle\Entity\User;
+use Psr\Log\LoggerInterface;
 
 class RuleBasedTagger
 {
@@ -15,11 +16,12 @@ class RuleBasedTagger
     private $tagRepository;
     private $entryRepository;
 
-    public function __construct(RulerZ $rulerz, TagRepository $tagRepository, EntryRepository $entryRepository)
+    public function __construct(RulerZ $rulerz, TagRepository $tagRepository, EntryRepository $entryRepository, LoggerInterface $logger)
     {
         $this->rulerz = $rulerz;
         $this->tagRepository = $tagRepository;
         $this->entryRepository = $entryRepository;
+        $this->logger = $logger;
     }
 
     /**
@@ -36,6 +38,11 @@ class RuleBasedTagger
                 continue;
             }
 
+            $this->logger->info('Matching rule.', [
+                'rule' => $rule->getRule(),
+                'tags' => $rule->getTags(),
+            ]);
+
             foreach ($rule->getTags() as $label) {
                 $tag = $this->getTag($label);
 
index 6c9195ce5abd07e2450eff32d8f56f3a5aa42e4e..a9134ac3ba1cf24bb90b46c0db8e030d7e758abf 100644 (file)
@@ -99,6 +99,7 @@ services:
             - "@rulerz"
             - "@wallabag_core.tag_repository"
             - "@wallabag_core.entry_repository"
+            - "@logger"
 
     # repository as a service
     wallabag_core.entry_repository: