aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2017-05-12 16:17:48 +0200
committerGitHub <noreply@github.com>2017-05-12 16:17:48 +0200
commit75045d6462265a389dead8ea554b7aae0f9e9e08 (patch)
tree62c2478aea4ef8553ca3bf69f2e752ceb0ebe57a /src
parent06568b15bb9e9116fa4d4a42246e1b0e497bbf25 (diff)
parenta1146b6551da01a1fd2b5711a5cf68fb1791c055 (diff)
downloadwallabag-75045d6462265a389dead8ea554b7aae0f9e9e08.tar.gz
wallabag-75045d6462265a389dead8ea554b7aae0f9e9e08.tar.zst
wallabag-75045d6462265a389dead8ea554b7aae0f9e9e08.zip
Merge pull request #3110 from wallabag/add-logger-matching-rules
Added logger when we match Tagging rules
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php9
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml1
2 files changed, 9 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
index b490e209..add27db2 100644
--- a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
+++ b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
@@ -8,6 +8,7 @@ use Wallabag\CoreBundle\Entity\Tag;
8use Wallabag\CoreBundle\Repository\EntryRepository; 8use Wallabag\CoreBundle\Repository\EntryRepository;
9use Wallabag\CoreBundle\Repository\TagRepository; 9use Wallabag\CoreBundle\Repository\TagRepository;
10use Wallabag\UserBundle\Entity\User; 10use Wallabag\UserBundle\Entity\User;
11use Psr\Log\LoggerInterface;
11 12
12class RuleBasedTagger 13class RuleBasedTagger
13{ 14{
@@ -15,11 +16,12 @@ class RuleBasedTagger
15 private $tagRepository; 16 private $tagRepository;
16 private $entryRepository; 17 private $entryRepository;
17 18
18 public function __construct(RulerZ $rulerz, TagRepository $tagRepository, EntryRepository $entryRepository) 19 public function __construct(RulerZ $rulerz, TagRepository $tagRepository, EntryRepository $entryRepository, LoggerInterface $logger)
19 { 20 {
20 $this->rulerz = $rulerz; 21 $this->rulerz = $rulerz;
21 $this->tagRepository = $tagRepository; 22 $this->tagRepository = $tagRepository;
22 $this->entryRepository = $entryRepository; 23 $this->entryRepository = $entryRepository;
24 $this->logger = $logger;
23 } 25 }
24 26
25 /** 27 /**
@@ -36,6 +38,11 @@ class RuleBasedTagger
36 continue; 38 continue;
37 } 39 }
38 40
41 $this->logger->info('Matching rule.', [
42 'rule' => $rule->getRule(),
43 'tags' => $rule->getTags(),
44 ]);
45
39 foreach ($rule->getTags() as $label) { 46 foreach ($rule->getTags() as $label) {
40 $tag = $this->getTag($label); 47 $tag = $this->getTag($label);
41 48
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index 6c9195ce..a9134ac3 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -99,6 +99,7 @@ services:
99 - "@rulerz" 99 - "@rulerz"
100 - "@wallabag_core.tag_repository" 100 - "@wallabag_core.tag_repository"
101 - "@wallabag_core.entry_repository" 101 - "@wallabag_core.entry_repository"
102 - "@logger"
102 103
103 # repository as a service 104 # repository as a service
104 wallabag_core.entry_repository: 105 wallabag_core.entry_repository: