Logging System#

This module contains functions related to sp_logging (Scikit-plots Logging).

Note

The Scikit-plots logging system is meant for internal scikit-plots usage. For use in other packages, we recommend implementing your own logger instead.

Tip

The Scikit-plots logging system compatible with python logging API system. This module defines a logging class based on the built-in logging module.

Configuring the logging system#

First, import the logger, Get a root logger by module:

>>> from scikitplot import logger
>>> logger.setLevel(logger.INFO)  # default WARNING
>>> logger.info("This is a info message from the sp logger.")
2025-06-19 00:04:17.865573: W scikitplot 140354697898880 python.py:96:<module>] TOML write support requires `toml` package. Install via `pip install toml`.
2025-06-19 00:04:17.993759: I scikitplot 140354697898880 948823027.py:3:<module>] This is a info message from the sp logger.

Get a root logger by func:

>>> from scikitplot import logger
>>> logger.setLevel(logger.INFO)  # default WARNING
>>> logger.info("This is a info message from the sp logger.")
2025-06-19 00:04:17.999264: I scikitplot 140354697898880 948823027.py:3:<module>] This is a info message from the sp logger.

Note

This module builds on Python’s standard logging library. For more information on Python’s logging API, refer to the official documentation: https://docs.python.org/3/library/logging.html

>>> import logging
>>> logger = logging.getLogger(__name__)
>>> logger.setLevel(logging.DEBUG)

Logging Levels:

  • NOTSET (0) : NOTSET

  • DEBUG (10) : Detailed information useful during development, typically of interest only when diagnosing problems.

  • INFO (20) : Confirmation that things are working as expected.

  • WARNING (30): An indication that something unexpected happened, or indicative of some problem in the near future.

  • ERROR (40) : Due to a more serious problem, the software has not been able to perform some function.

  • CRITICAL = FATAL (50): A very serious error, indicating that the program itself may be unable to continue running.