How to use pygelf - 10 common examples

To help you get started, we’ve selected a few pygelf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keeprocking / pygelf / tests / test_handler_specific.py View on Github external
def test_tls_handler_init():
    with pytest.raises(ValueError):
        GelfTlsHandler(host='127.0.0.1', port=12204, validate=True)

    with pytest.raises(ValueError):
        GelfTlsHandler(host='127.0.0.1', port=12204, keyfile='/dev/null')
github keeprocking / pygelf / tests / test_handler_specific.py View on Github external
def test_tls_handler_init():
    with pytest.raises(ValueError):
        GelfTlsHandler(host='127.0.0.1', port=12204, validate=True)

    with pytest.raises(ValueError):
        GelfTlsHandler(host='127.0.0.1', port=12204, keyfile='/dev/null')
github keeprocking / pygelf / tests / test_core_functions.py View on Github external
def test_split():
    message = b'12345'
    header = b'\x1e\x0f'
    chunks = list(gelf.split(message, 2))
    expected = [
        (struct.pack('b', 0), struct.pack('b', 3), b'12'),
        (struct.pack('b', 1), struct.pack('b', 3), b'34'),
        (struct.pack('b', 2), struct.pack('b', 3), b'5')
    ]

    assert len(chunks) == len(expected)

    for index, chunk in enumerate(chunks):
        expected_index, expected_chunks_count, expected_chunk = expected[index]
        assert chunk[:2] == header
        assert chunk[10:11] == expected_index
        assert chunk[11:12] == expected_chunks_count
        assert chunk[12:] == expected_chunk
github keeprocking / pygelf / tests / test_queuehandler_support.py View on Github external
    GelfHttpHandler(host='127.0.0.1', port=12203),
    GelfHttpHandler(host='127.0.0.1', port=12203, compress=False),
    GelfTlsHandler(host='127.0.0.1', port=12204),
    # GelfTlsHandler(host='127.0.0.1', port=12204, validate=True, ca_certs='tests/config/cert.pem'),
])
def handler(request):
    return request.param
github keeprocking / pygelf / tests / test_static_fields.py View on Github external
    GelfHttpHandler(host='127.0.0.1', port=12203, **STATIC_FIELDS),
    GelfHttpHandler(host='127.0.0.1', port=12203, compress=False, **STATIC_FIELDS),
    GelfTlsHandler(host='127.0.0.1', port=12204, **STATIC_FIELDS),
    # GelfTlsHandler(host='127.0.0.1', port=12204, validate=True, ca_certs='tests/config/cert.pem', **STATIC_FIELDS),
    GelfTcpHandler(host='127.0.0.1', port=12201, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfUdpHandler(host='127.0.0.1', port=12202, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfUdpHandler(host='127.0.0.1', port=12202, compress=False, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfHttpHandler(host='127.0.0.1', port=12203, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfHttpHandler(host='127.0.0.1', port=12203, compress=False, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfTlsHandler(host='127.0.0.1', port=12204, static_fields=STATIC_FIELDS),
    # GelfTlsHandler(host='127.0.0.1', port=12204, validate=True, ca_certs='tests/config/cert.pem', static_fields=STATIC_FIELDS, _ozzy='billie jean'),
])
def handler(request):
    return request.param
github keeprocking / pygelf / tests / test_static_fields.py View on Github external
    GelfHttpHandler(host='127.0.0.1', port=12203, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfHttpHandler(host='127.0.0.1', port=12203, compress=False, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfTlsHandler(host='127.0.0.1', port=12204, static_fields=STATIC_FIELDS),
    # GelfTlsHandler(host='127.0.0.1', port=12204, validate=True, ca_certs='tests/config/cert.pem', static_fields=STATIC_FIELDS, _ozzy='billie jean'),
])
def handler(request):
    return request.param
github keeprocking / pygelf / tests / test_static_fields.py View on Github external
    GelfHttpHandler(host='127.0.0.1', port=12203, compress=False, **STATIC_FIELDS),
    GelfTlsHandler(host='127.0.0.1', port=12204, **STATIC_FIELDS),
    # GelfTlsHandler(host='127.0.0.1', port=12204, validate=True, ca_certs='tests/config/cert.pem', **STATIC_FIELDS),
    GelfTcpHandler(host='127.0.0.1', port=12201, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfUdpHandler(host='127.0.0.1', port=12202, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfUdpHandler(host='127.0.0.1', port=12202, compress=False, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfHttpHandler(host='127.0.0.1', port=12203, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfHttpHandler(host='127.0.0.1', port=12203, compress=False, static_fields=STATIC_FIELDS, _ozzy='billie jean'),
    GelfTlsHandler(host='127.0.0.1', port=12204, static_fields=STATIC_FIELDS),
    # GelfTlsHandler(host='127.0.0.1', port=12204, validate=True, ca_certs='tests/config/cert.pem', static_fields=STATIC_FIELDS, _ozzy='billie jean'),
])
def handler(request):
    return request.param
github keeprocking / pygelf / tests / test_inputs.py View on Github external
    GelfHttpHandler(host='127.0.0.1', port=12203, debug=True, **ADDITIONAL_FIELDS),
    GelfHttpHandler(host='127.0.0.1', port=12203, debug=True, compress=False, **ADDITIONAL_FIELDS),
])
def handler(request):
    return request.param
github keeprocking / pygelf / tests / test_debug_mode.py View on Github external
    GelfHttpHandler(host='127.0.0.1', port=12203, debug=True),
    GelfHttpHandler(host='127.0.0.1', port=12203, compress=False, debug=True),
    GelfTlsHandler(host='127.0.0.1', port=12204, debug=True),
    # GelfTlsHandler(host='127.0.0.1', port=12204, debug=True, validate=True, ca_certs='tests/config/cert.pem'),
])
def handler(request):
    return request.param
github keeprocking / pygelf / tests / test_dynamic_fields.py View on Github external
    GelfHttpHandler(host='127.0.0.1', port=12203, compress=False, include_extra_fields=True),
    GelfTlsHandler(host='127.0.0.1', port=12204, include_extra_fields=True),
    # GelfTlsHandler(host='127.0.0.1', port=12204, validate=True, ca_certs='tests/config/cert.pem', include_extra_fields=True),
])
def handler(request):
    return request.param