コード例 #1
0
ファイル: logship.py プロジェクト: alphagov-mirror/tagalog
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
ファイル: logship.py プロジェクト: alphagov/tagalog
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
ファイル: test_shipper.py プロジェクト: alphagov/tagalog
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
ファイル: test_shipper.py プロジェクト: alphagov/tagalog
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
ファイル: test_shipper.py プロジェクト: alphagov/tagalog
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
ファイル: test_shipper.py プロジェクト: alphagov/tagalog
def test_build_stdout_shipper():
    stdout_shipper = build_shipper('stdout')

    assert_true(isinstance(stdout_shipper, StdoutShipper))
コード例 #7
0
ファイル: test_shipper.py プロジェクト: alphagov/tagalog
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))