km3flux.logger

Module Contents

Functions

supports_color()

Checks if the terminal supports color.

colored(text, color=None, on_color=None, attrs=None, ansi_code=None)

Colorize text, while stripping nested ANSI color sequences.

hash_coloured_escapes(text)

Return the ANSI hash colour prefix and suffix for a given text

isnotebook()

Check if running within a Jupyter notebook

get_logger(name, filename=None, stream_loglevel='INFO', file_loglevel='DEBUG')

Helper function to get a logger

set_level(log_or_name, level)

Set the log level for given logger

Attributes

loggers

ATTRIBUTES

ATTRIBUTES_RE

HIGHLIGHTS

HIGHLIGHTS_RE

COLORS

COLORS_RE

RESET

RESET_RE

log

km3flux.logger.loggers[source]
km3flux.logger.ATTRIBUTES[source]
km3flux.logger.ATTRIBUTES_RE[source]
km3flux.logger.HIGHLIGHTS[source]
km3flux.logger.HIGHLIGHTS_RE[source]
km3flux.logger.COLORS[source]
km3flux.logger.COLORS_RE[source]
km3flux.logger.RESET = \033[0m[source]
km3flux.logger.RESET_RE = \033\[0m[source]
km3flux.logger.supports_color()[source]

Checks if the terminal supports color.

km3flux.logger.colored(text, color=None, on_color=None, attrs=None, ansi_code=None)[source]

Colorize text, while stripping nested ANSI color sequences.

Author: Konstantin Lepa <konstantin.lepa@gmail.com> / termcolor

Available text colors:

red, green, yellow, blue, magenta, cyan, white.

Available text highlights:

on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white.

Available attributes:

bold, dark, underline, blink, reverse, concealed.

Example:

colored(‘Hello, World!’, ‘red’, ‘on_grey’, [‘blue’, ‘blink’]) colored(‘Hello, World!’, ‘green’)

km3flux.logger.hash_coloured_escapes(text)[source]

Return the ANSI hash colour prefix and suffix for a given text

km3flux.logger.isnotebook()[source]

Check if running within a Jupyter notebook

km3flux.logger.get_logger(name, filename=None, stream_loglevel='INFO', file_loglevel='DEBUG')[source]

Helper function to get a logger

km3flux.logger.set_level(log_or_name, level)[source]

Set the log level for given logger

km3flux.logger.log[source]