Skip to content

Commit da76e39

Browse files
authored
Merge pull request #24925 from QuLogic/loglevel-docs
DOC: Improve documentation for set_loglevel
2 parents 8d2329a + 7979c2d commit da76e39

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lib/matplotlib/__init__.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,22 @@ def _ensure_handler():
247247

248248
def set_loglevel(level):
249249
"""
250-
Set Matplotlib's root logger and root logger handler level, creating
251-
the handler if it does not exist yet.
250+
Configure Matplotlib's logging levels.
251+
252+
Matplotlib uses the standard library `logging` framework under the root
253+
logger 'matplotlib'. This is a helper function to:
254+
255+
- set Matplotlib's root logger level
256+
- set the root logger handler's level, creating the handler
257+
if it does not exist yet
252258
253259
Typically, one should call ``set_loglevel("info")`` or
254260
``set_loglevel("debug")`` to get additional debugging information.
255261
262+
Users or applications that are installing their own logging handlers
263+
may want to directly manipulate ``logging.getLogger('matplotlib')`` rather
264+
than use this function.
265+
256266
Parameters
257267
----------
258268
level : {"notset", "debug", "info", "warning", "error", "critical"}
@@ -263,6 +273,7 @@ def set_loglevel(level):
263273
The first time this function is called, an additional handler is attached
264274
to Matplotlib's root handler; this handler is reused every time and this
265275
function simply manipulates the logger and handler's level.
276+
266277
"""
267278
_log.setLevel(level.upper())
268279
_ensure_handler().setLevel(level.upper())

0 commit comments

Comments
 (0)