def METHOD_NAME(self, record):
    """This function is called each time a  message is logged.
    In our design, it's role is to invoke a specific handler
    for corresponding notification type, registered before
    via :meth:`register` function by caller.
    Specific notification handler should prepare translated
    message string, split one event for particular users
    and execute :meth:`send_notification` function for each user
    who should be notified.
    """
    #
    # Emit is called with a lock held, see
    # http://docs.python.org/2/library/logging.html#logging.Handler.handle
    #
    if (
        not NotificationHandler.loaded_notifications
        and 'oioioi.notifications' in settings.INSTALLED_APPS
    ):
        load_modules('notifications')
        NotificationHandler.loaded_notifications = True
    if hasattr(record, 'notification'):
        notification_type = getattr(record, 'notification')
        if notification_type in NotificationHandler.notification_functions:
            notification_function = NotificationHandler.notification_functions[
                notification_type
            ]
            notification_function(record)
        else:
            logger.error(
                "Internal error in notification module:"
                " Tried to handle a non-exisitent notification \"%s\""
                " Please check, if the notification is"
                " registered correctly.",
                notification_type,
            )