(self, record)
Emit a record.

        The record is formatted, and then sent to the syslog server. If
        exception information is present, it is NOT sent to the server.
Emit a record.
Emit a record .
def emit(self, record):
        """
        Emit a record.

        The record is formatted, and then sent to the syslog server. If
        exception information is present, it is NOT sent to the server.
        """
        try:
            msg = self.format(record)
            if self.ident:
                msg = self.ident + msg
            if self.append_nul:
                msg += '\000'

            # We need to convert record level to lowercase, maybe this will
            # change in the future.
            prio = '<%d>' % self.encodePriority(self.facility,
                                                self.mapPriority(record.levelname))
            prio = prio.encode('utf-8')
            # Message is a string. Convert to bytes as required by RFC 5424
            msg = msg.encode('utf-8')
            msg = prio + msg
            if self.unixsocket:
                try:
                    self.socket.send(msg)
                except OSError:
                    self.socket.close()
                    self._connect_unixsocket(self.address)
                    self.socket.send(msg)
            elif self.socktype == socket.SOCK_DGRAM:
                self.socket.sendto(msg, self.address)
            else:
                self.socket.sendall(msg)
        except Exception:
            self.handleError(record)
def emit ( self , record ) : try : msg = self . format ( record ) if self . ident : msg = self . ident + msg if self . append_nul : msg += '\000' # We need to convert record level to lowercase, maybe this will # change in the future. prio = '<%d>' % self . encodePriority ( self . facility , self . mapPriority ( record . levelname ) ) prio = prio . encode ( 'utf-8' ) # Message is a string. Convert to bytes as required by RFC 5424 msg = msg . encode ( 'utf-8' ) msg = prio + msg if self . unixsocket : try : self . socket . send ( msg ) except OSError : self . socket . close ( ) self . _connect_unixsocket ( self . address ) self . socket . send ( msg ) elif self . socktype == socket . SOCK_DGRAM : self . socket . sendto ( msg , self . address ) else : self . socket . sendall ( msg ) except Exception : self . handleError ( record )