def trace_start(fpath, interval=5, *, auto=True):
    """Start tracing into the given file."""
    global _tracer
    if _tracer is None:
        _tracer = TraceDumper(fpath, interval, auto)
        _tracer.daemon = True
        _tracer.start()
    else:
        raise Exception("Already tracing to %s" % _tracer.fpath)
Start tracing into the given file.
electrum/utils/stacktracer.py