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)
def test_build_stdout_shipper_with_bulk_false(): shipper = build_shipper('stdout,bulk=false') assert_true(isinstance(shipper, StdoutShipper)) assert_false(shipper.bulk)
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)
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')
def test_build_stdout_shipper(): stdout_shipper = build_shipper('stdout') assert_true(isinstance(stdout_shipper, StdoutShipper))
def test_build_shipper(): my_shipper = build_shipper('null') assert_true(isinstance(my_shipper, NullShipper))