#stream #split #tail #output #multiple #python-3 #print

app json-outer

将尾部输出分割成多个文件

1 个不稳定版本

0.1.0 2023年5月5日

#10#python-3

MIT-0 许可证

7KB
62 代码行,不包括注释

json-outer

从给定的参数启动进程,并带有时间戳区分地打印stdout/stderr

示例

文件:sample.py

#!/usr/bin/env python3
import time
import sys
a = 0
while True:
    a += 1
    time.sleep(1)
    if a % 2 == 0:
        print(f'line {a}', flush=True, file=sys.stdout)
    else:
        print(f'line {a}', flush=True, file=sys.stderr)
    if a % 10 == 0:
        inprovided = input("please give me some input")
        print(f"input provided: {inprovided}")

cargo run python3 sample.py

示例stdout

{"log":"line 2","stream":"stdout","time":"2023-05-02T18:00:38.526892071+05:30"}
{"log":"line 2","stream":"stdout","time":"2023-05-02T18:00:38.526892071+05:30"}

依赖项

~4–13MB
~143K SLoC