docs: def main():
      """
      Main application loop.
      """
  
      env = os.environ
  
      try:
          host = env['SYSLOG_SERVER']
          port = int(env['SYSLOG_PORT'])
          socktype = socket.SOCK_DGRAM if env['SYSLOG_PROTO'] == 'udp' \
              else socket.SOCK_STREAM
      except KeyError:
          sys.exit("SYSLOG_SERVER, SYSLOG_PORT and SYSLOG_PROTO are required.")
  
      handler = SysLogHandler(
          address=(host, port),
          socktype=socktype,
      )
      handler.setFormatter(PalletFormatter())
  
      for event_headers, event_data in supervisor_events(sys.stdin, sys.stdout):
          event = logging.LogRecord(
              name=event_headers['processname'],
              level=logging.INFO,
              pathname=None,
              lineno=0,
              msg=event_data,
              args=(),
              exc_info=None,
          )
          event.process = int(event_headers['pid'])
          handler.handle(event)