Пример #1
0
def main():
    args = parser.parse_args()

    shippers = []
    for shipper_desc in args.shipper:
        shippers.append(build_shipper(shipper_desc))

    filterlist = [args.filters]
    if args.filters_append:
        filterlist.extend(args.filters_append)
    pipeline = filters.build(','.join(filterlist))

    for msg in pipeline(io.lines(sys.stdin)):
        for shpr in shippers:
            shpr.ship(msg)
Пример #2
0
def main():
    args = parser.parse_args()

    shippers = []
    for shipper_desc in args.shipper:
        shippers.append(build_shipper(shipper_desc))

    filterlist = [args.filters]
    if args.filters_append:
        filterlist.extend(args.filters_append)
    pipeline = filters.build(','.join(filterlist))

    for msg in pipeline(io.lines(sys.stdin)):
        for shpr in shippers:
            shpr.ship(msg)
Пример #3
0
def test_build_stdout_shipper_with_bulk_false():
    shipper = build_shipper('stdout,bulk=false')

    assert_true(isinstance(shipper, StdoutShipper))
    assert_false(shipper.bulk)
Пример #4
0
def test_build_redis_shipper_with_bulk_false():
    redis_shipper = build_shipper('redis,bulk=false')

    assert_true(isinstance(redis_shipper, RedisShipper))
    assert_false(redis_shipper.bulk)
Пример #5
0
def test_build_redis_shipper_with_key_arg():
    redis_shipper = build_shipper('redis,key=nginx-logs')

    assert_true(isinstance(redis_shipper, RedisShipper))
    assert_equal(redis_shipper.key, 'nginx-logs')
Пример #6
0
def test_build_stdout_shipper():
    stdout_shipper = build_shipper('stdout')

    assert_true(isinstance(stdout_shipper, StdoutShipper))
Пример #7
0
def test_build_shipper():
    my_shipper = build_shipper('null')

    assert_true(isinstance(my_shipper, NullShipper))
Пример #8
0
def test_build_stdout_shipper_with_bulk_false():
    shipper = build_shipper('stdout,bulk=false')

    assert_true(isinstance(shipper, StdoutShipper))
    assert_false(shipper.bulk)
Пример #9
0
def test_build_redis_shipper_with_bulk_false():
    redis_shipper = build_shipper('redis,bulk=false')

    assert_true(isinstance(redis_shipper, RedisShipper))
    assert_false(redis_shipper.bulk)
Пример #10
0
def test_build_redis_shipper_with_key_arg():
    redis_shipper = build_shipper('redis,key=nginx-logs')

    assert_true(isinstance(redis_shipper, RedisShipper))
    assert_equal(redis_shipper.key, 'nginx-logs')
Пример #11
0
def test_build_stdout_shipper():
    stdout_shipper = build_shipper('stdout')

    assert_true(isinstance(stdout_shipper, StdoutShipper))
Пример #12
0
def test_build_shipper():
    my_shipper = build_shipper('null')

    assert_true(isinstance(my_shipper, NullShipper))