'Initialize the dispatcher.
`event_type` should be one of ProcessLogStdoutEvent or
ProcessLogStderrEvent'

def __init__(self, process, event_type, fd):

    self.process = process
    self.event_type = event_type
    self.fd = fd
    self.channel = channel = self.event_type.channel
    self._setup_logging(process.config, channel)
    capture_maxbytes = getattr(process.config, ('%s_capture_maxbytes' % channel))
    if capture_maxbytes:
        self.capturelog = loggers.handle_boundIO(self.process.config.options.getLogger(), fmt='%(message)s', maxbytes=capture_maxbytes)
    self.childlog = self.mainlog
    begintoken = self.event_type.BEGIN_TOKEN
    endtoken = self.event_type.END_TOKEN
    self.begintoken_data = (begintoken, len(begintoken))
    self.endtoken_data = (endtoken, len(endtoken))
    self.mainlog_level = loggers.LevelsByName.DEBG
    config = self.process.config
    self.log_to_mainlog = (config.options.loglevel <= self.mainlog_level)
    self.stdout_events_enabled = config.stdout_events_enabled
    self.stderr_events_enabled = config.stderr_events_enabled
