Added logger when we match Tagging rules

This commit is contained in:
Nicolas Lœuillet 2017-05-12 13:13:19 +02:00
parent 06568b15bb
commit 0a033767db
No known key found for this signature in database
GPG key ID: 7A5E5FFCBA7EF402
2 changed files with 9 additions and 1 deletions

View 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);

View file

@ -99,6 +99,7 @@ services:
- "@rulerz"
- "@wallabag_core.tag_repository"
- "@wallabag_core.entry_repository"
- "@logger"
# repository as a service
wallabag_core.entry_repository: