mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-23 17:41:01 +00:00
Added logger when we match Tagging rules
This commit is contained in:
parent
06568b15bb
commit
0a033767db
2 changed files with 9 additions and 1 deletions
|
@ -8,6 +8,7 @@ use Wallabag\CoreBundle\Entity\Tag;
|
||||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||||
use Wallabag\CoreBundle\Repository\TagRepository;
|
use Wallabag\CoreBundle\Repository\TagRepository;
|
||||||
use Wallabag\UserBundle\Entity\User;
|
use Wallabag\UserBundle\Entity\User;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class RuleBasedTagger
|
class RuleBasedTagger
|
||||||
{
|
{
|
||||||
|
@ -15,11 +16,12 @@ class RuleBasedTagger
|
||||||
private $tagRepository;
|
private $tagRepository;
|
||||||
private $entryRepository;
|
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->rulerz = $rulerz;
|
||||||
$this->tagRepository = $tagRepository;
|
$this->tagRepository = $tagRepository;
|
||||||
$this->entryRepository = $entryRepository;
|
$this->entryRepository = $entryRepository;
|
||||||
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,6 +38,11 @@ class RuleBasedTagger
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->logger->info('Matching rule.', [
|
||||||
|
'rule' => $rule->getRule(),
|
||||||
|
'tags' => $rule->getTags(),
|
||||||
|
]);
|
||||||
|
|
||||||
foreach ($rule->getTags() as $label) {
|
foreach ($rule->getTags() as $label) {
|
||||||
$tag = $this->getTag($label);
|
$tag = $this->getTag($label);
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ services:
|
||||||
- "@rulerz"
|
- "@rulerz"
|
||||||
- "@wallabag_core.tag_repository"
|
- "@wallabag_core.tag_repository"
|
||||||
- "@wallabag_core.entry_repository"
|
- "@wallabag_core.entry_repository"
|
||||||
|
- "@logger"
|
||||||
|
|
||||||
# repository as a service
|
# repository as a service
|
||||||
wallabag_core.entry_repository:
|
wallabag_core.entry_repository:
|
||||||
|
|
Loading…
Reference in a new issue