This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/data/logs_model/logs_producer/__init__.py
2019-11-12 11:09:47 -05:00

27 lines
657 B
Python

import logging
logger = logging.getLogger(__name__)
class LogSendException(Exception):
""" A generic error when sending the logs to its destination.
e.g. Kinesis, Kafka, Elasticsearch, ...
"""
pass
class LogProducerProxy(object):
def __init__(self):
self._model = None
def initialize(self, model):
self._model = model
logger.info('===============================')
logger.info('Using producer `%s`', self._model)
logger.info('===============================')
def __getattr__(self, attr):
if not self._model:
raise AttributeError("LogsModelProxy is not initialized")
return getattr(self._model, attr)