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

Class NullHandler

Lib/logging/__init__.py:2287–2307  ·  view source on GitHub ↗

This handler does nothing. It's intended to be used to avoid the "No handlers could be found for logger XXX" one-off warning. This is important for library code, which may contain code to log events. If a user of the library does not configure logging, the one-off warning might be

Source from the content-addressed store, hash-verified

2285# Null handler
2286
2287class NullHandler(Handler):
2288 """
2289 This handler does nothing. It's intended to be used to avoid the
2290 "No handlers could be found for logger XXX" one-off warning. This is
2291 important for library code, which may contain code to log events. If a user
2292 of the library does not configure logging, the one-off warning might be
2293 produced; to avoid this, the library developer simply needs to instantiate
2294 a NullHandler and add it to the top-level logger of the library module or
2295 package.
2296 """
2297 def handle(self, record):
2298 """Stub."""
2299
2300 def emit(self, record):
2301 """Stub."""
2302
2303 def createLock(self):
2304 self.lock = None
2305
2306 def _at_fork_reinit(self):
2307 pass
2308
2309# Warnings integration
2310

Callers 1

_showwarningFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…