コード例 #1
0
ファイル: __init__.py プロジェクト: adieu/heka-py
    def __init__(self):

        from heka.streams import DebugCaptureStream
        from heka.encoders import JSONEncoder

        self.stream = DebugCaptureStream()
        self.encoder = JSONEncoder()
コード例 #2
0
ファイル: __init__.py プロジェクト: adieu/heka-py
class DebugCaptureSender(object):
    def __init__(self):

        from heka.streams import DebugCaptureStream
        from heka.encoders import JSONEncoder

        self.stream = DebugCaptureStream()
        self.encoder = JSONEncoder()

    def send_message(self, msg):
        self.stream.write(self.encoder.encode(msg))

    def __getattr__(self, key):
        return getattr(self.stream, key)
コード例 #3
0
 def setUp(self):
     self.stream = DebugCaptureStream()
     self.client = HekaClient(self.stream, self.logger)
     # overwrite the class-wide threadlocal w/ an instance one
     # so values won't persist btn tests
     self.timer_ob = self.client.timer(self.timer_name)
     self.timer_ob.__dict__['_local'] = threading.local()
コード例 #4
0
    def setUp(self):
        self.mock_stream = DebugCaptureStream()

        class NoEncoder(object):
            def __init__(self, hmc):
                pass

            def encode(self, msg):
                return msg

        self.client = HekaClient(self.mock_stream,
                                 self.logger,
                                 encoder=NoEncoder)
        # overwrite the class-wide threadlocal w/ an instance one
        # so values won't persist btn tests
        self.timer_ob = self.client.timer(self.timer_name)
        self.timer_ob.__dict__['_local'] = threading.local()
コード例 #5
0
ファイル: base.py プロジェクト: graydon/ichnaea
 def setup_heka(cls):
     # Clobber the stream with a debug version
     cls.heka_client = configure_heka()
     cls.heka_client.stream = DebugCaptureStream()
     cls.heka_client.encoder = NullEncoder(None)
 def setUp(self):
     self.stream = DebugCaptureStream()
     self.client = HekaClient(self.stream, self.logger)