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

Method __init__

Lib/logging/handlers.py:1138–1168  ·  view source on GitHub ↗
(self, appname, dllname=None, logtype="Application")

Source from the content-addressed store, hash-verified

1136 which contains the message definitions you want to use in the event log.
1137 """
1138 def __init__(self, appname, dllname=None, logtype="Application"):
1139 logging.Handler.__init__(self)
1140 import _winapi
1141 self._winapi = _winapi
1142 self.appname = appname
1143 if not dllname:
1144 # backward compatibility
1145 try:
1146 import win32evtlogutil
1147 dllname = os.path.split(win32evtlogutil.__file__)
1148 dllname = os.path.split(dllname[0])
1149 dllname = os.path.join(dllname[0], r'win32service.pyd')
1150 except ImportError:
1151 pass
1152 self.dllname = dllname
1153 self.logtype = logtype
1154 # Administrative privileges are required to add a source to the registry.
1155 # This may not be available for a user that just wants to add to an
1156 # existing source - handle this specific case.
1157 try:
1158 self._add_source_to_registry(appname, dllname, logtype)
1159 except PermissionError:
1160 pass
1161 self.deftype = _winapi.EVENTLOG_ERROR_TYPE
1162 self.typemap = {
1163 logging.DEBUG: _winapi.EVENTLOG_INFORMATION_TYPE,
1164 logging.INFO: _winapi.EVENTLOG_INFORMATION_TYPE,
1165 logging.WARNING: _winapi.EVENTLOG_WARNING_TYPE,
1166 logging.ERROR: _winapi.EVENTLOG_ERROR_TYPE,
1167 logging.CRITICAL: _winapi.EVENTLOG_ERROR_TYPE,
1168 }
1169
1170 @staticmethod
1171 def _add_source_to_registry(appname, dllname, logtype):

Callers

nothing calls this directly

Calls 4

__init__Method · 0.45
splitMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected