Selaa lähdekoodia

Add some documentation on the POutputDispatcher

Jason R. Coombs 12 vuotta sitten
vanhempi
commit
a86885e9d4
1 muutettua tiedostoa jossa 15 lisäystä ja 3 poistoa
  1. 15 3
      supervisor/dispatchers.py

+ 15 - 3
supervisor/dispatchers.py

@@ -61,9 +61,15 @@ class PDispatcher:
         pass
 
 class POutputDispatcher(PDispatcher):
-    """ Output (stdout/stderr) dispatcher, capture output sent within
-    <!--XSUPERVISOR:BEGIN--><!--XSUPERVISOR:END--> tags and notify
-    with a ProcessCommunicationEvent """
+    """
+    A Process Output (stdout/stderr) dispatcher. Serves several purposes:
+
+    - capture output sent within <!--XSUPERVISOR:BEGIN--> and
+      <!--XSUPERVISOR:END--> tags and signal a ProcessCommunicationEvent
+      by calling notify(event).
+    - route the output to the appropriate log handlers as specified in the
+      config.
+    """
 
     process = None # process which "owns" this dispatcher
     channel = None # 'stderr' or 'stdout'
@@ -74,6 +80,12 @@ class POutputDispatcher(PDispatcher):
     output_buffer = '' # data waiting to be logged
 
     def __init__(self, process, event_type, fd):
+        """
+        Initialize the dispatcher.
+
+        `event_type` should be one of ProcessLogStdoutEvent or
+        ProcessLogStderrEvent
+        """
         self.process = process
         self.event_type = event_type
         self.fd = fd