pip install eliot python from eliot import start_action, to_file, log_call import threading to_file(open("logs.log", "w")) def worker(): with start_action(action_type="myapp:worker"): log_call({"name": "worker", "thread_id": threading.get_ident()}, do_work)() def do_work(): print("Worker doing work...") threads = [] for i in range(5): t = threading.Thread(target=worker) threads.append(t) t.start() for t in threads: t.join()


上一篇:
下一篇:
切换中文