scikitplot.sp_logging#

Scikit-plots Logging Module

This module provides advanced logging utilities for Python applications, including support for singleton-based logging with customizable formatters, handlers, and thread-safety. It extends Python’s standard logging library to enhance usability and flexibility for large-scale projects.

Scikit-plots logging helpers, supports vendoring.

Module Dependencies:

  • Python standard library: logging

  • This module defines a logging class based on the built-in logging module.

User guide. See the Logging System section for further details.

Logging Levels#

CRITICAL

int([x]) -> integer

DEBUG

int([x]) -> integer

ERROR

int([x]) -> integer

FATAL

int([x]) -> integer

INFO

int([x]) -> integer

NOTSET

int([x]) -> integer

WARN

int([x]) -> integer

WARNING

int([x]) -> integer

Functional Interface - get_logger#

AlwaysStdErrHandler

A custom logging handler inherited from StreamHandler that enforces the use of a specific output stream: either standard error (sys.stderr) or standard output (sys.stdout).

GoogleLogFormatter

A custom logging formatter inherited from Formatter that formats log messages in a Google-style format.

critical

Logs a message at the CRITICAL log level.

debug

Logs a message at the DEBUG log level.

error

Logs a message at the ERROR log level.

error_log

Empty helper method.

fatal

Logs a message at the FATAL - CRITICAL log level.

getEffectiveLevel

Return how much logging output will be produced.

get_logger

Return SP (scikitplot) logger instance.

log_if

Log 'msg % args' at level 'level' only if condition is fulfilled.

setLevel

Sets the threshold for what messages will be logged.

vlog

Logs a message at the specified log level.

warn

Logs a message at the WARN - WARNING log level.

warning

Logs a message at the WARNING log level.

Class Interface - SpLogger#

SpLogger

A singleton logger class that provides a shared logger instance with customizable name, formatter, handler, logging level, and thread-safety.

sp_logger

An instance of SpLogger, providing logging functionality.