Exemplo n.º 1
0
def notify(_context, message):
    """Notifies the recipient of the desired event given the model.
    Log notifications using openstack's default logging system"""

    priority = message.get('priority',
                           CONF.default_notification_level)
    priority = priority.lower()
    logger = logging.getLogger(
        'eho.openstack.common.notification.%s' %
        message['event_type'])
    getattr(logger, priority)(jsonutils.dumps(message))
Exemplo n.º 2
0
Arquivo: api.py Projeto: akshayms/eho
#    License for the specific language governing permissions and limitations
#    under the License.

import uuid

from oslo.config import cfg

from eho.openstack.common import context
from eho.openstack.common.gettextutils import _
from eho.openstack.common import importutils
from eho.openstack.common import jsonutils
from eho.openstack.common import log as logging
from eho.openstack.common import timeutils


LOG = logging.getLogger(__name__)

notifier_opts = [
    cfg.MultiStrOpt('notification_driver',
                    default=[],
                    deprecated_name='list_notifier_drivers',
                    help='Driver or drivers to handle sending notifications'),
    cfg.StrOpt('default_notification_level',
               default='INFO',
               help='Default notification level for outgoing notifications'),
    cfg.StrOpt('default_publisher_id',
               default='$host',
               help='Default publisher_id for outgoing notifications'),
]

CONF = cfg.CONF