Skip to content

Instantly share code, notes, and snippets.

@meejah
Created August 17, 2017 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meejah/bcfa45f87fb97858c64e3bf4ce3936d4 to your computer and use it in GitHub Desktop.
Save meejah/bcfa45f87fb97858c64e3bf4ce3936d4 to your computer and use it in GitHub Desktop.
from eliot import start_action
from eliot.twisted import DeferredContext
import eliot
from twisted.internet.task import react, deferLater
from twisted.internet.defer import _inlineCallbacks, Deferred
def thing(reactor):
with start_action(action_type=u"a thing"):
d = deferLater(reactor, 1.0, lambda: "thing a")
dc = DeferredContext(d)
dc.addActionFinish()
return d
def start_logging():
eliot.to_file(
open("eliot.log", "wb")
)
def main(reactor):
start_logging()
d = thing(reactor)
return d
if __name__ == '__main__':
react(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment