MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / shutdown

Function shutdown

tools/python-3.11.9-amd64/Lib/logging/__init__.py:2170–2198  ·  view source on GitHub ↗

Perform any cleanup actions in the logging system (e.g. flushing buffers). Should be called at application exit.

(handlerList=_handlerList)

Source from the content-addressed store, hash-verified

2168 root.manager._clear_cache()
2169
2170def shutdown(handlerList=_handlerList):
2171 """
2172 Perform any cleanup actions in the logging system (e.g. flushing
2173 buffers).
2174
2175 Should be called at application exit.
2176 """
2177 for wr in reversed(handlerList[:]):
2178 #errors might occur, for example, if files are locked
2179 #we just ignore them if raiseExceptions is not set
2180 try:
2181 h = wr()
2182 if h:
2183 try:
2184 h.acquire()
2185 h.flush()
2186 h.close()
2187 except (OSError, ValueError):
2188 # Ignore errors which might be caused
2189 # because handlers have been closed but
2190 # references to them are still around at
2191 # application exit.
2192 pass
2193 finally:
2194 h.release()
2195 except: # ignore everything, as we're shutting down
2196 if raiseExceptions:
2197 raise
2198 #else, swallow
2199
2200#Let's try and shutdown automatically on application exit...
2201import atexit

Callers

nothing calls this directly

Calls 4

acquireMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected