MCPcopy Index your code
hub / github.com/RustPython/RustPython / emit

Method emit

Lib/logging/handlers.py:985–1023  ·  view source on GitHub ↗

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.

(self, record)

Source from the content-addressed store, hash-verified

983 append_nul = True # some old syslog daemons expect a NUL terminator
984
985 def emit(self, record):
986 """
987 Emit a record.
988
989 The record is formatted, and then sent to the syslog server. If
990 exception information is present, it is NOT sent to the server.
991 """
992 try:
993 msg = self.format(record)
994 if self.ident:
995 msg = self.ident + msg
996 if self.append_nul:
997 msg += '\000'
998
999 # We need to convert record level to lowercase, maybe this will
1000 # change in the future.
1001 prio = '<%d>' % self.encodePriority(self.facility,
1002 self.mapPriority(record.levelname))
1003 prio = prio.encode('utf-8')
1004 # Message is a string. Convert to bytes as required by RFC 5424
1005 msg = msg.encode('utf-8')
1006 msg = prio + msg
1007
1008 if not self.socket:
1009 self.createSocket()
1010
1011 if self.unixsocket:
1012 try:
1013 self.socket.send(msg)
1014 except OSError:
1015 self.socket.close()
1016 self._connect_unixsocket(self.address)
1017 self.socket.send(msg)
1018 elif self.socktype == socket.SOCK_DGRAM:
1019 self.socket.sendto(msg, self.address)
1020 else:
1021 self.socket.sendall(msg)
1022 except Exception:
1023 self.handleError(record)
1024
1025class SMTPHandler(logging.Handler):
1026 """

Callers

nothing calls this directly

Calls 11

encodePriorityMethod · 0.95
mapPriorityMethod · 0.95
createSocketMethod · 0.95
_connect_unixsocketMethod · 0.95
formatMethod · 0.45
encodeMethod · 0.45
sendMethod · 0.45
closeMethod · 0.45
sendtoMethod · 0.45
sendallMethod · 0.45
handleErrorMethod · 0.45

Tested by

no test coverage detected