scikitplot.logging#

logging (alias, logger) module provide unified both Python logging and logging.Logger utilities.

View aliases#

Main aliases

scikitplot.logging

Compat aliases

scikitplot.logger

Inspired by “Tensorflow’s logging system” [1].

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

See also

References

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

Logging Levels#

CRITICAL

int([x]) -> integer int(x, base=10) -> integer

DEBUG

int([x]) -> integer int(x, base=10) -> integer

ERROR

int([x]) -> integer int(x, base=10) -> integer

FATAL

int([x]) -> integer int(x, base=10) -> integer

INFO

int([x]) -> integer int(x, base=10) -> integer

NOTSET

int([x]) -> integer int(x, base=10) -> integer

WARN

int([x]) -> integer int(x, base=10) -> integer

WARNING

int([x]) -> integer int(x, base=10) -> integer

Logging Helpers#

AlwaysStdErrHandler

A custom logging handler inherited from StreamHandler.

GoogleLogFormatter

A custom logging formatter inherited from Formatter.

getEffectiveLevel

Return the effective level for the scikit-plots logger.

get_logger

Return SP (scikitplot) logger instance.

get_verbosity

Return the current verbosity level.

setLevel

Set the logger's level.

set_verbosity

Set the verbosity level.

Log the Message#

Log the message at a predefined logging level.

log

Log a message at the specified log level.

log_every_n

Log once per n calls from the same call site.

log_first_n

Log only for the first n calls from the same call site.

log_if

Log only if a condition is True.

vlog

Log a message at the specified log level.

debug

Log a message at the DEBUG log level.

info

Log a message at the INFO log level.

warning

Log a message at the WARNING log level.

warn

Log a message at the WARN -> WARNING log level.

error

Log a message at the ERROR log level.

error_log

Log an error-like message at a specified level.

exception

Log a message with severity 'ERROR' on the root logger.

TaskLevelStatusMessage

Compatibility wrapper for legacy call sites.

critical

Log a message at the CRITICAL log level.

fatal

Log a message at the FATAL -> CRITICAL log level.