log dependency

This commit is contained in:
Yuri Kuznetsov
2021-05-06 13:14:57 +03:00
parent 8fccdae675
commit fcde65eaee
18 changed files with 145 additions and 64 deletions

View File

@@ -44,6 +44,7 @@ use Espo\Core\{
Utils\TemplateFileManager,
Mail\EmailSender as EmailSender,
Utils\Util,
Utils\Log,
};
use Exception;
@@ -69,6 +70,8 @@ class AssignmentProcessor
protected $metadata;
protected $log;
public function __construct(
EntityManager $entityManager,
HtmlizerFactory $htmlizerFactory,
@@ -76,7 +79,8 @@ class AssignmentProcessor
Config $config,
TemplateFileManager $templateFileManager,
Metadata $metadata,
Language $language
Language $language,
Log $log
) {
$this->entityManager = $entityManager;
$this->htmlizerFactory = $htmlizerFactory;
@@ -85,6 +89,7 @@ class AssignmentProcessor
$this->templateFileManager = $templateFileManager;
$this->metadata = $metadata;
$this->language = $language;
$this->log = $log;
}
public function process(StdClass $data): void
@@ -205,7 +210,7 @@ class AssignmentProcessor
$this->emailSender->send($email);
}
catch (Exception $e) {
$GLOBALS['log']->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
$this->log->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
}
}