diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2017-05-12 13:13:19 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2017-05-12 13:13:19 +0200 |
commit | 0a033767db51d17439bfbd16bb0558327f1fc7a0 (patch) | |
tree | 778cd686b7f75b1341700139027eed52c4e2384b | |
parent | 06568b15bb9e9116fa4d4a42246e1b0e497bbf25 (diff) | |
download | wallabag-0a033767db51d17439bfbd16bb0558327f1fc7a0.tar.gz wallabag-0a033767db51d17439bfbd16bb0558327f1fc7a0.tar.zst wallabag-0a033767db51d17439bfbd16bb0558327f1fc7a0.zip |
Added logger when we match Tagging rules
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php | 9 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/config/services.yml | 1 |
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; | |||
8 | use Wallabag\CoreBundle\Repository\EntryRepository; | 8 | use Wallabag\CoreBundle\Repository\EntryRepository; |
9 | use Wallabag\CoreBundle\Repository\TagRepository; | 9 | use Wallabag\CoreBundle\Repository\TagRepository; |
10 | use Wallabag\UserBundle\Entity\User; | 10 | use Wallabag\UserBundle\Entity\User; |
11 | use Psr\Log\LoggerInterface; | ||
11 | 12 | ||
12 | class RuleBasedTagger | 13 | class 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: |