lighthouse.log.cli
¶lighthouse.log.cli.
color_string
(color, string)[source]¶Colorizes a given string, if coloring is available.
lighthouse.log.cli.
color_for_level
(level)[source]¶Returns the colorama Fore color for a given log level.
If color is not available, returns None.
lighthouse.log.cli.
create_thread_color_cycle
()[source]¶Generates a never-ending cycle of colors to choose from for individual threads.
If color is not available, a cycle that repeats None every time is returned instead.
lighthouse.log.cli.
color_for_thread
(thread_id)[source]¶Associates the thread ID with the next color in the thread_colors
cycle,
so that thread-specific parts of a log have a consistent separate color.
lighthouse.log.cli.
CLIHandler
(stream=None)[source]¶Bases: logging.StreamHandler
, object
Specialized StreamHandler that provides color output if the output is a terminal and the colorama library is available.
Initialize the handler.
If stream is not specified, sys.stderr is used.
is_tty
¶Returns true if the handler’s stream is a terminal.