get_logger#
- scikitplot.get_logger()[source]#
Return SP (scikitplot) logger instance.
- Returns:
- logging.Logger
An instance of the Python logging library Logger.
- Return type:
See also
logger
An alias of
sp_logging
module, providing logging functionality.logging.getLogger
Standard library function to retrieve
logging.Logger
instance. For more: https://docs.python.org/3/library/logging.html
Notes
See Python documentation (https://docs.python.org/3/library/logging.html) for detailed API. Below is only a summary.
The logger has 5 levels of logging from the most serious to the least:
CRITICAL
orFATAL
ERROR
WARNING
INFO
DEBUG
NOTSET
The logger has the following methods, based on these logging levels:
critical(msg, *args, **kwargs)
orfatal(msg, *args, **kwargs)
error(msg, *args, **kwargs)
warning(msg, *args, **kwargs)
orwarn(msg, *args, **kwargs)
info(msg, *args, **kwargs)
debug(msg, *args, **kwargs)
The
msg
can contain string formatting. An example of logging at theERROR
level using string formatting is:>>> sp.get_logger().error("The value %d is invalid.", 3)
You can also specify the logging verbosity. In this case, the WARN level log will not be emitted:
>>> sp.get_logger().setLevel(sp.sp_logging.WARNING) >>> sp.get_logger().debug( ... "This is a debug." ... ) # This will not be shown, as level is WARNING. >>> sp.get_logger().info( ... "This is a info." ... ) # This will not be shown, as level is WARNING. >>> sp.get_logger().warning("This is a warning.")
Examples
Get the root
logger
frommodule attr
:>>> from scikitplot import logger >>> logger.setLevel(logger.INFO) # default WARNING >>> logger.info("This is a info message from the sp logger.") >>> import scikitplot as sp >>> sp.logger.setLevel(sp.logger.INFO) # default WARNING >>> sp.logger.info("This is a info message from the sp logger.")
2025-06-26 20:37:27.862459: I scikitplot 139648004451200 3536182465.py:3:<module>] This is a info message from the sp logger.
2025-06-26 20:37:27.863420: I scikitplot 139648004451200 3536182465.py:7:<module>] This is a info message from the sp logger.
Get the root
logger
fromfunc
:>>> import scikitplot as sp >>> sp.get_logger().setLevel(sp.sp_logging.INFO) # default WARNING >>> sp.get_logger().info("This is a info message from the sp logger.")
2025-06-26 20:37:27.868644: I scikitplot 139648004451200 interactiveshell.py:3672:run_code] This is a info message from the sp logger.