예제 #1
0
def main():
    for line in io.lines(sys.stdin):
        msg = json.loads(line)
        if '@timestamp' in msg:
            print(msg['@timestamp'], msg['@message'])
        else:
            print(msg['@message'])
예제 #2
0
파일: logtext.py 프로젝트: alphagov/tagalog
def main():
    for line in io.lines(sys.stdin):
        msg = json.loads(line)
        if '@timestamp' in msg:
            print(msg['@timestamp'], msg['@message'])
        else:
            print(msg['@message'])
예제 #3
0
파일: logtag.py 프로젝트: alphagov/tagalog
def main():
    args = parser.parse_args()
    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)):
        print(json.dumps(msg))
예제 #4
0
def main():
    args = parser.parse_args()
    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)):
        print(json.dumps(msg))
예제 #5
0
파일: test_io.py 프로젝트: alphagov/tagalog
def test_lines():
    _, fname = tempfile.mkstemp()
    register_cleanup(fname)

    with open(fname, 'w') as f:
        f.writelines(['foo\n', 'bar\n', 'baz\n'])

    with open(fname) as f:
        res = io.lines(f)
        assert_equal(next(res), 'foo\n')
        assert_equal(next(res), 'bar\n')
        assert_equal(next(res), 'baz\n')
예제 #6
0
def test_lines():
    _, fname = tempfile.mkstemp()
    register_cleanup(fname)

    with open(fname, 'w') as f:
        f.writelines(['foo\n', 'bar\n', 'baz\n'])

    with open(fname) as f:
        res = io.lines(f)
        assert_equal(next(res), 'foo\n')
        assert_equal(next(res), 'bar\n')
        assert_equal(next(res), 'baz\n')
예제 #7
0
def test_lines():
    _, fname = tempfile.mkstemp()
    register_cleanup(fname)

    with open(fname, "w") as f:
        f.writelines(["foo\n", "bar\n", "baz\n"])

    with open(fname) as f:
        res = io.lines(f)
        assert_equal(next(res), "foo\n")
        assert_equal(next(res), "bar\n")
        assert_equal(next(res), "baz\n")
예제 #8
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)
예제 #9
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)
예제 #10
0
def main():
    for msg in io.lines(sys.stdin):
        print(now(), msg, end='')
예제 #11
0
def main():
    for msg in io.lines(sys.stdin):
        print(now(), msg, end='')