Esempio n. 1
0
def init_config(config=None):
    """
    Initialize the server with the endpoints.
    Args:
        config:
    """
    if config is None:
        config = ConfigManager().configuration
    else:
        config = config
    ConfigureLogging(**config["logger"])
    app.config.update(**config)
Esempio n. 2
0
from message_handler import MessageHandler

logger = logging.getLogger(__name__)


class EmailNotifier:

    def __init__(self, handler, consumer):
        self.handler = handler
        self.consumer = consumer

    def init(self, ):
        try:
            logger.info("Email Notifier initialization...")
            self.consumer.run()
        except Exception as e:
            logger.exception(e)
        finally:
            logger.info("Email Notifier :: Finish execution")


if __name__ == "__main__":
    config = ConfigManager().configuration
    ConfigureLogging(**config["logger"])
    try:
        handler = MessageHandler(**config.get("smtp"))
        consumer = MessageConsumer(handler, **config.get("rabbit"))
        EmailNotifier(handler, consumer).init()
    except:
        logger.info("Email Notifier :: Finish execution")
Esempio n. 3
0
def configure_logging(set_environment):
    log_config = configmanager.ConfigManager(
        test=True).get_specific_configuration("logger")
    ConfigureLogging(**log_config)