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

Class Handler

Lib/logging/__init__.py:922–1109  ·  view source on GitHub ↗

Handler instances dispatch logging events to specific destinations. The base handler class. Acts as a placeholder which defines the Handler interface. Handlers can optionally use Formatter instances to format records as desired. By default, no formatter is specified; in this case,

Source from the content-addressed store, hash-verified

920
921
922class Handler(Filterer):
923 """
924 Handler instances dispatch logging events to specific destinations.
925
926 The base handler class. Acts as a placeholder which defines the Handler
927 interface. Handlers can optionally use Formatter instances to format
928 records as desired. By default, no formatter is specified; in this case,
929 the 'raw' message as determined by record.message is logged.
930 """
931 def __init__(self, level=NOTSET):
932 """
933 Initializes the instance - basically setting the formatter to None
934 and the filter list to empty.
935 """
936 Filterer.__init__(self)
937 self._name = None
938 self.level = _checkLevel(level)
939 self.formatter = None
940 self._closed = False
941 # Add the handler to the global _handlerList (for cleanup on shutdown)
942 _addHandlerRef(self)
943 self.createLock()
944
945 def get_name(self):
946 return self._name
947
948 def set_name(self, name):
949 with _lock:
950 if self._name in _handlers:
951 del _handlers[self._name]
952 self._name = name
953 if name:
954 _handlers[name] = self
955
956 name = property(get_name, set_name)
957
958 def createLock(self):
959 """
960 Acquire a thread lock for serializing access to the underlying I/O.
961 """
962 self.lock = threading.RLock()
963 _register_at_fork_reinit_lock(self)
964
965 def _at_fork_reinit(self):
966 self.lock._at_fork_reinit()
967
968 def acquire(self):
969 """
970 Acquire the I/O thread lock.
971 """
972 if self.lock:
973 self.lock.acquire()
974
975 def release(self):
976 """
977 Release the I/O thread lock.
978 """
979 if self.lock:

Callers

nothing calls this directly

Calls 1

propertyClass · 0.85

Tested by

no test coverage detected