Emit a record. Determine the message ID, event category and event type. Then log the message in the NT event log.
(self, record)
| 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 | """ |