Example #1
0
def test_pack(compress):
    message = {'version': '1.1', 'short_message': 'test pack'}
    packed_message = gelf.pack(message, compress)
    unpacked_message = zlib.decompress(
        packed_message) if compress else packed_message
    unpacked_message = json.loads(unpacked_message.decode('utf-8'))
    assert message == unpacked_message
Example #2
0
File: logs.py Project: withgame/zou
 def convert_record_to_gelf(self, record):
     l = gelf.make(
         record,
         self.domain,
         self.debug,
         self.version,
         self.additional_fields,
         self.include_extra_fields,
     )
     l.update({"_X-OVH-TOKEN": self.ovh_token})
     return gelf.pack(l, self.compress, self.json_default)
Example #3
0
def test_pack(compress):
    message = {
        'version': '1.1',
        'short_message': 'test pack',
        'foo': _ObjWithStr()
    }
    expected = json.loads(json.dumps(message, default=str))
    packed_message = gelf.pack(message, compress, default=str)
    unpacked_message = zlib.decompress(
        packed_message) if compress else packed_message
    unpacked_message = json.loads(unpacked_message.decode('utf-8'))
    assert expected == unpacked_message
Example #4
0
 def convert_record_to_gelf(self, record):
     return gelf.pack(
         gelf.make(record, self.domain, self.debug, self.version,
                   self.additional_fields, self.include_extra_fields),
         self.compress, self.json_default)
Example #5
0
 def makePickle(self, record):
     message = gelf.make(record, self.domain, self.debug, self.version, self.additional_fields, self.include_extra_fields)
     packed = gelf.pack(message, self.compress)
     return packed
Example #6
0
    def makePickle(self, record):
        message = gelf.make(record, self.domain, self.debug, self.version, self.additional_fields, self.include_extra_fields)
        packed = gelf.pack(message)

        """ if you send the message over tcp, it should always be null terminated or the input will reject it """
        return packed + b'\x00'
Example #7
0
 def makePickle(self, record):
     message = gelf.make(record, self.debug, self.version, self.additional_fields, self.extra_fields)
     packed = gelf.pack(message, self.compress)
     return packed
Example #8
0
    def makePickle(self, record):
        message = gelf.make(record, self.debug, self.version, self.additional_fields, self.extra_fields)
        packed = gelf.pack(message)

        """ if you send the message over tcp, it should always be null terminated or the input will reject it """
        return packed + b'\x00'
Example #9
0
def test_pack(compress):
    message = {'version': '1.1', 'short_message': 'test pack'}
    packed_message = gelf.pack(message, compress)
    unpacked_message = zlib.decompress(packed_message) if compress else packed_message
    unpacked_message = json.loads(unpacked_message.decode('utf-8'))
    assert message == unpacked_message