示例#1
0
 def onClose(self, wasClean, code, reason):
     """
     WebSocket callback
     """
     try:
         eliot.remove_destination(self._received_eliot_log)
     except ValueError:
         pass
示例#2
0
 def onClose(self, wasClean, code, reason):
     """
     WebSocket callback
     """
     try:
         eliot.remove_destination(self._received_eliot_log)
     except ValueError:
         pass
示例#3
0
 def stopService(self):
     if self.capture_logs:
         globalLogPublisher.removeObserver(self.twisted_observer)
         self.stdlib_cleanup()
     if self.task is not None:
         self.task.finish()
     for dest in self.destinations:
         remove_destination(dest)
     return Service.stopService(self)
示例#4
0
 def _setUp(self):
     self.logs = []
     add_destination(self.logs.append)
     self.addCleanup(lambda: remove_destination(self.logs.append))
     self.addDetail(
         self.LOG_DETAIL_NAME,
         Content(
             UTF8_TEXT,
             # Safeguard the logs against _tearDown.  Capture the list
             # object in the lambda's defaults.
             lambda logs=self.logs: [_eliottree(logs)],
         ),
     )
示例#5
0
    def test_tree(self):
        """
        ``_eliottree`` returns a ``bytes`` string containing a rendered tree of
        Eliot actions and messages.
        """
        events = []
        add_destinations(events.append)
        self.addCleanup(lambda: remove_destination(events.append))

        with start_action(action_type=u"foo"):
            pass

        # I don't know exactly what the tree rendering looks like.  That's why
        # I'm using eliot-tree!  So this assertion is sort of lame.
        self.assertThat(
            _eliottree(events),
            Contains(u"foo/1 \N{RIGHTWARDS DOUBLE ARROW} started"),
        )
示例#6
0
 def stopService(self):
     for dest in self.destinations:
         remove_destination(dest)
     globalLogPublisher.removeObserver(self.twisted_observer)
     self.stdlib_cleanup()
     return Service.stopService(self)
示例#7
0
 def stopService(self):
     for dest in self.destinations:
         remove_destination(dest)
     globalLogPublisher.removeObserver(self.twisted_observer)
     self.stdlib_cleanup()
     return Service.stopService(self)
示例#8
0
 def __exit__(self, typ_, exc, tb):
     if exc:
         pprint(self.messages)
     eliot.remove_destination(self)