Migrate contacts interaction to the PSR-3 logger

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2020-07-16 19:36:59 +02:00
parent 8a433a7226
commit b3b856c9db
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
1 changed files with 8 additions and 7 deletions

View File

@ -33,8 +33,8 @@ use OCP\Contacts\Events\ContactInteractedWithEvent;
use OCP\EventDispatcher\Event; use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener; use OCP\EventDispatcher\IEventListener;
use OCP\IL10N; use OCP\IL10N;
use OCP\ILogger;
use OCP\IUserManager; use OCP\IUserManager;
use Psr\Log\LoggerInterface;
use Sabre\VObject\Component\VCard; use Sabre\VObject\Component\VCard;
use Sabre\VObject\Reader; use Sabre\VObject\Reader;
use Sabre\VObject\UUIDUtil; use Sabre\VObject\UUIDUtil;
@ -57,7 +57,7 @@ class ContactInteractionListener implements IEventListener {
/** @var IL10N */ /** @var IL10N */
private $l10n; private $l10n;
/** @var ILogger */ /** @var LoggerInterface */
private $logger; private $logger;
public function __construct(RecentContactMapper $mapper, public function __construct(RecentContactMapper $mapper,
@ -65,7 +65,7 @@ class ContactInteractionListener implements IEventListener {
IUserManager $userManager, IUserManager $userManager,
ITimeFactory $timeFactory, ITimeFactory $timeFactory,
IL10N $l10nFactory, IL10N $l10nFactory,
ILogger $logger) { LoggerInterface $logger) {
$this->mapper = $mapper; $this->mapper = $mapper;
$this->cardSearchDao = $cardSearchDao; $this->cardSearchDao = $cardSearchDao;
$this->userManager = $userManager; $this->userManager = $userManager;
@ -125,10 +125,11 @@ class ContactInteractionListener implements IEventListener {
$parsed->CATEGORIES = $this->l10n->t('Recently contacted'); $parsed->CATEGORIES = $this->l10n->t('Recently contacted');
$contact->setCard($parsed->serialize()); $contact->setCard($parsed->serialize());
} catch (Throwable $e) { } catch (Throwable $e) {
$this->logger->logException($e, [ $this->logger->warning(
'message' => 'Could not parse card to add recent category: ' . $e->getMessage(), 'Could not parse card to add recent category: ' . $e->getMessage(),
'level' => ILogger::WARN, [
]); 'exception' => $e,
]);
$contact->setCard($copy); $contact->setCard($copy);
} }
} else { } else {