diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2017-05-12 16:17:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-12 16:17:48 +0200 |
commit | 75045d6462265a389dead8ea554b7aae0f9e9e08 (patch) | |
tree | 62c2478aea4ef8553ca3bf69f2e752ceb0ebe57a /src/Wallabag | |
parent | 06568b15bb9e9116fa4d4a42246e1b0e497bbf25 (diff) | |
parent | a1146b6551da01a1fd2b5711a5cf68fb1791c055 (diff) | |
download | wallabag-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/Wallabag')
-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: |