logging.getHandlerByName
Prev: logging.Formatter | Up: logging | Next: logging.getHandlerNames
Rel: logging.addLevelName, logging.basicConfig, logging.BufferingFormatter, logging.captureWarnings
Ref: docs.python.org — logging.getHandlerByName
Tags: #public #python3 #stdlib #logging
Import
import logging
from logging import getHandlerByName
Signature & Overview
logging.getHandlerByName(name)
Get a handler with the specified name, or None if there isn't one with that name.
Usage
import logging
h = logging.NullHandler()
h.name = "demo_named_handler"
assert logging.getHandlerByName("demo_named_handler") is h
Gotchas
- Requires Python 3.12+: Returns
Noneif no handler with that.nameis registered.
REPL Inspect
from logging import getHandlerByName
help(getHandlerByName)
Linked from
Related notes
- tuts/python3/stdlib_module/logging/Formatter Linked here; links to this page; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/getHandlerNames Linked here; links to this page; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/logging/addLevelName Linked here; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/basicConfig Linked here; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/BufferingFormatter Linked here; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/captureWarnings Linked here; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/critical shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/debug shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/disable shared tags: #logging, #stdlib