MCPcopy Index your code
hub / github.com/python/cpython / emit

Method emit

Lib/logging/handlers.py:1213–1233  ·  view source on GitHub ↗

Emit a record. Determine the message ID, event category and event type. Then log the message in the NT event log.

(self, record)

Source from the content-addressed store, hash-verified

1211 return self.typemap.get(record.levelno, self.deftype)
1212
1213 def emit(self, record):
1214 """
1215 Emit a record.
1216
1217 Determine the message ID, event category and event type. Then
1218 log the message in the NT event log.
1219 """
1220 try:
1221 id = self.getMessageID(record)
1222 cat = self.getEventCategory(record)
1223 type = self.getEventType(record)
1224 msg = self.format(record)
1225
1226 # Get a handle to the event log
1227 handle = self._winapi.RegisterEventSource(None, self.appname)
1228 try:
1229 self._winapi.ReportEvent(handle, type, cat, id, msg)
1230 finally:
1231 self._winapi.DeregisterEventSource(handle)
1232 except Exception:
1233 self.handleError(record)
1234
1235 def close(self):
1236 """

Callers 1

test_without_pywin32Method · 0.95

Calls 5

getMessageIDMethod · 0.95
getEventCategoryMethod · 0.95
getEventTypeMethod · 0.95
formatMethod · 0.45
handleErrorMethod · 0.45

Tested by 1

test_without_pywin32Method · 0.76