From 7a6f5054fd41def1b935ddf86c1b4a62433a02d4 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Mon, 3 Mar 2014 15:03:15 -0800 Subject: [PATCH] Expose PublishErrorsHandler through oslo.messaging Fix up the imports so that the log handler for publishing error messages is available through the oslo.messaging package instead of users having to know the full path inside the sub-module. Change-Id: I5c8ddaf451f7c977d8c400fe920512cdafbc7fdf --- oslo/messaging/notify/__init__.py | 4 +++- oslo/messaging/notify/log_handler.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/oslo/messaging/notify/__init__.py b/oslo/messaging/notify/__init__.py index 92d726ba7..2ac72b0a9 100644 --- a/oslo/messaging/notify/__init__.py +++ b/oslo/messaging/notify/__init__.py @@ -16,9 +16,11 @@ __all__ = ['Notifier', 'LoggingNotificationHandler', 'get_notification_listener', - 'NotificationResult'] + 'NotificationResult', + 'PublishErrorsHandler'] from .notifier import * from .listener import * +from .log_handler import * from .logger import * from .dispatcher import NotificationResult diff --git a/oslo/messaging/notify/log_handler.py b/oslo/messaging/notify/log_handler.py index 679eb69d5..cd5251bfe 100644 --- a/oslo/messaging/notify/log_handler.py +++ b/oslo/messaging/notify/log_handler.py @@ -13,11 +13,13 @@ import logging from oslo.config import cfg -from oslo import messaging class PublishErrorsHandler(logging.Handler): def __init__(self, *args, **kwargs): + # NOTE(dhellmann): Avoid a cyclical import by doing this one + # at runtime. + from oslo import messaging logging.Handler.__init__(self, *args, **kwargs) self._transport = messaging.get_transport(cfg.CONF) self._notifier = messaging.Notifier(self._transport,