Refactor Newsletter and Bridge to use logger_factory instance
[MAILPOET-2444]
This commit is contained in:
committed by
Jack Kitterhing
parent
e4262b0a6d
commit
0a4aa5ce3f
@ -23,8 +23,15 @@ class PostNotificationScheduler {
|
||||
const INTERVAL_IMMEDIATE = 'immediate';
|
||||
const INTERVAL_MONTHLY = 'monthly';
|
||||
|
||||
/** @var LoggerFactory */
|
||||
private $logger_factory;
|
||||
|
||||
public function __construct() {
|
||||
$this->logger_factory = LoggerFactory::getInstance();
|
||||
}
|
||||
|
||||
function transitionHook($new_status, $old_status, $post) {
|
||||
LoggerFactory::getLogger('post-notifications')->addInfo(
|
||||
$this->logger_factory->getLogger('post-notifications')->addInfo(
|
||||
'transition post notification hook initiated',
|
||||
[
|
||||
'post_id' => $post->ID,
|
||||
@ -40,7 +47,7 @@ class PostNotificationScheduler {
|
||||
}
|
||||
|
||||
function schedulePostNotification($post_id) {
|
||||
LoggerFactory::getLogger('post-notifications')->addInfo(
|
||||
$this->logger_factory->getLogger('post-notifications')->addInfo(
|
||||
'schedule post notification hook',
|
||||
['post_id' => $post_id]
|
||||
);
|
||||
@ -88,7 +95,7 @@ class PostNotificationScheduler {
|
||||
$sending_task->status = SendingQueue::STATUS_SCHEDULED;
|
||||
$sending_task->scheduled_at = $next_run_date;
|
||||
$sending_task->save();
|
||||
LoggerFactory::getLogger('post-notifications')->addInfo(
|
||||
$this->logger_factory->getLogger('post-notifications')->addInfo(
|
||||
'schedule post notification',
|
||||
['sending_task' => $sending_task->id(), 'scheduled_at' => $next_run_date]
|
||||
);
|
||||
@ -135,5 +142,4 @@ class PostNotificationScheduler {
|
||||
$relation->save();
|
||||
return $relation->value;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user