@param NotificationInterface $notification The notification itself
@param int                   $level        Level of the current notification

@return bool
554478
public function shouldHandle(NotificationInterface $notification, $level)
    {
        return $this->shellCommandAvailable ? $this->level >= $level : false;
    }
210119
public static function log($level, $message, array $context = array())
    {
        return self::getInstance()->log($level, $message, $context);
    }
939558
public function setSubject(NotificationInterface $notification, $subject, $flush = false)
    {
        $notification->setSubject($subject);
        $this->flush($flush);

        $event = new NotificationEvent($notification);
        $this->dispatcher->dispatch(MgiletNotificationEvents::MODIFIED, $event);

        return $notification;
    }
325807
public void publish(final Notification notification) {
        LOGGER.debug("Dispatching notification: " + notification.getClass().toString());
        final ArrayList<Subscription> subscriptions = SUBSCRIPTION_MAP.get(notification.getClass());
        if (subscriptions == null) {
            LOGGER.debug("No subscribers to inform from notification: " + notification.getClass().getName());
            return;
        }
        for (final Subscription subscription: subscriptions) {
            if (subscription.getScope() != null && subscription.getGroup() != null && subscription.getLevel() != null) { // subscription was the most specific
                if (subscription.getScope().equals(notification.getScope()) && subscription.getGroup().equals(notification.getGroup()) && subscription.getLevel() == notification.getLevel()) {
                    alertSubscriber(notification, subscription.getSubscriber());
                }
            } else if (subscription.getGroup() != null && subscription.getLevel() != null) { // subscription was very specific
                if (subscription.getGroup().equals(notification.getGroup()) && subscription.getLevel() == notification.getLevel()) {
                    alertSubscriber(notification, subscription.getSubscriber());
                }
            } else if (subscription.getGroup() != null) { // subscription was somewhat specific
                if (subscription.getGroup().equals(notification.getGroup())) {
                    alertSubscriber(notification, subscription.getSubscriber());
                }
            } else if (subscription.getLevel() != null) { // subscription was somewhat specific
                if (subscription.getLevel() == notification.getLevel()) {
                    alertSubscriber(notification, subscription.getSubscriber());
                }
            } else { // subscription was not specific
                alertSubscriber(notification, subscription.getSubscriber());
            }
        }
    }
617410
public function send(string $recipientID, Notification $notification): void
    {
        $app = App::get();

        if ($notification->id === null) {
            $notification->id = 'n' . uniqid() . 'x' . base_convert(rand(0, 999999999), 10, 16);
        }
        if ($notification->dateCreated === null) {
            $notification->dateCreated = time();
        }

        if ($this->hasEventListeners('beforeSendNotification')) {
            $eventDetails = new \IvoPetkov\BearFrameworkAddons\Notifications\BeforeSendNotificationEventDetails($recipientID, $notification);
            $this->dispatchEvent('beforeSendNotification', $eventDetails);
            if ($eventDetails->preventDefault) {
                return;
            }
        }

        if (strlen($notification->type) > 0) {
            $otherNotifications = $this->getList($recipientID);
            foreach ($otherNotifications as $otherNotification) {
                if ((string) $notification->type === (string) $otherNotification->type) {
                    $this->delete($recipientID, $otherNotification->id);
                }
            }
        }

        $this->set($recipientID, $notification);

        if ($this->hasEventListeners('sendNotification')) {
            $eventDetails = new \IvoPetkov\BearFrameworkAddons\Notifications\SendNotificationEventDetails($recipientID, $notification);
            $this->dispatchEvent('sendNotification', $eventDetails);
        }
    }
387761
public function pushNotification(PushNotification $notification, PushSubscription $subscription, int $ttl = 3600) : ResponseInterface
    {
        return $this->pushNotificationAsync($notification, $subscription, $ttl)->wait();
    }
729912
private function getNotificationCategory(NotificationEntity $notification)
    {
        $fqnClass = $notification->getFQNClass();
        if (!isset($this->categories[$fqnClass])) {
            if (!class_exists($fqnClass, true)) {
                $this->categories[$fqnClass] = sprintf('Unable to find the category class %s', $fqnClass);
            } else {
                $obj = null;
                $error = null;
                try {
                    $obj = $this->app->make($fqnClass);
                } catch (Exception $x) {
                    $error = $x;
                } catch (Throwable $x) {
                    $error = $x;
                }
                if ($error !== null) {
                    $this->categories[$fqnClass] = sprintf('Failed to initialize category class %1$s: %2$s', $fqnClass, $error->getMessage());
                } elseif (!($obj instanceof CategoryInterface)) {
                    $this->categories[$fqnClass] = sprintf('The class %1$s does not implement %2$s', $fqnClass, CategoryInterface::class);
                } else {
                    $this->categories[$fqnClass] = $obj;
                }
            }
        }
        if (is_string($this->categories[$fqnClass])) {
            throw new Exception($this->categories[$fqnClass]);
        }

        return $this->categories[$fqnClass];
    }
344984
@Override
    public void emit(Level level, String message, long sequence) {
        if (_broadcaster != null) _broadcaster.sendNotification(new Notification(
            level.toString(),
            _name != null ? _name : this,
            sequence,
            message
        ));
    }
1216522
public function augment(SubscriptionNotification $notification)
	{
		$this->in  = $notification->in;
		$this->out = $notification->out;
	}
1133551
public function send($notifiable, Notification $notification)
    {
        return $notifiable->routeNotificationFor('database', $notification)->create(
            $this->buildPayload($notifiable, $notification)
        );
    }
373027
public function notify(NotificationInterface $notification)
    {
        $notified = false;
        $this->eventDispatcher->dispatch(Events::PRE_NOTIFY, new PreNotifyEvent($notification));

        foreach ($this->handlers as $handler) {
            if ($notification->getHandlerName() !== $handler->getName()) {
                continue;
            }
            $notified = $this->handle($notification, $handler) || $notified;
        }

        if ($this->throwIfNotNotified && ! $notified) {
            $message = 'No handler has been defined for '.\get_class($notification);
            if (\method_exists($notification, 'getConfig')) {
                $message .= ' ('.\json_encode($notification->getConfig()).')';
            }

            throw new NotificationFailedException($message);
        }

        $this->eventDispatcher->dispatch(Events::POST_NOTIFY, new PostNotifyEvent($notification));
    }
443879
public function log($level, $message, array $context = []) {
		if (!Logger::check($level)) {
			return;
		}
		if (count($context) > 0) {
			foreach ($context as $k => $v) {
				$message = str_replace('{' . $k . '}', $v, $message);
			}
		}
		syslog($this->getLevel($level), $message);
	}
708163
public function log($level, $message, $context = array())
    {
        $level = isset($this->levels[$level]) ? $level : $this->level;

        // Check if the level would be handled
        if (isset($this->levels[$level])) {
            if ($this->levels[$level] < $this->levels[$this->handledLevel]) {
                return false;
            }
        }

        return $this->writeLog($level, $message, $context);
    }
456858
public function log($message, $level = 0) {
        foreach ($this->_loggers as $logger) {
            try {
                $logger->logMessage($message, $level);
            } catch (LoggerException $e) {
                throw $e;
            }
        }
    }
926322
protected function pushNotification($notification, $notifiable)
    {
        if ($notifiable instanceof NotifiableGroup) {
            foreach ($notifiable->getGroup() as $toBeNotified) {
                $this->push($notification, $toBeNotified);
            }
        } else {
            // @todo Change this fucking shite
            $notification = $notifiable->notifications()->create($notification);

            event(new NotificationAdded($notification, $notifiable));
        }
    }
960818
public function log($message, $level = LogLevel::DEBUG)
    {
        $this->runtime->log($message, $level);
    }
373340
public function send(Notification $notification)
    {
        $message = $this->composeMessage($notification);
        $message->send($this->mailer);
    }