(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.
        """
        msg = self._custom_format(record)
        # Message is a string. Convert to bytes as required by RFC 5424
        if type(msg) is unicode:
            msg = msg.encode('utf-8')
            ## this puts BOM in wrong place
            #if codecs:
            #    msg = codecs.BOM_UTF8 + msg
        try:
            if self.unixsocket:
                try:
                    self.socket.send(msg)
                except socket.error:
                    self._connect_unixsocket(self.address)
                    self.socket.send(msg)
            elif self.socktype == socket.SOCK_DGRAM:
                now = time.time()
                if now - 1 > self._udp_reset:
                    self.socket.close()
                    self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
                    self._udp_reset = now
                self.socket.sendto(msg, self.address)
            else:
                self.socket.sendall(msg)
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            self.handleError(record)
def emit ( self , record ) : msg = self . _custom_format ( record ) # Message is a string. Convert to bytes as required by RFC 5424 if type ( msg ) is unicode : msg = msg . encode ( 'utf-8' ) ## this puts BOM in wrong place #if codecs: #    msg = codecs.BOM_UTF8 + msg try : if self . unixsocket : try : self . socket . send ( msg ) except socket . error : self . _connect_unixsocket ( self . address ) self . socket . send ( msg ) elif self . socktype == socket . SOCK_DGRAM : now = time . time ( ) if now - 1 > self . _udp_reset : self . socket . close ( ) self . socket = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM ) self . _udp_reset = now self . socket . sendto ( msg , self . address ) else : self . socket . sendall ( msg ) except ( KeyboardInterrupt , SystemExit ) : raise except : self . handleError ( record )