Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

log.console

import log

Everything here is re-exported by log, so import log is enough and the names are called as log.*. Importing log.console on its own works too and reaches the same definitions.

ConsoleTransport: the default transport, printing to stdout (or stderr for Error/Critical) with optional ANSI coloring by level.

Classes

ConsoleTransport

class log.ConsoleTransport < Transport

ConsoleTransport is a log transport that facilitates sending log streams to the console.

ConsoleTransport.set_colors()

log.ConsoleTransport.set_colors(enabled: bool)

Enables or disables ANSI coloring of messages by level. Enabled by default unless the NO_COLOR environment variable is set.

Parameters

  • enabled (bool)

Returns — self

ConsoleTransport.write()

log.ConsoleTransport.write(message, level)

ConsoleTransport.flush()

log.ConsoleTransport.flush()