Created
August 17, 2017 21:15
-
-
Save meejah/bcfa45f87fb97858c64e3bf4ce3936d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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