Shortcuts

ride.utils.logging

Module Contents

Functions

_process_rank()

if_rank_zero(fn)

getLogger(name[, log_once])

style(text[, fg, bg, bold, dim, underline, blink, ...])

Styles a text with ANSI styles and returns the new string. By

style_logging()

init_logging([logdir, logging_backend])

Attributes

LOG_LEVELS

process_rank

logger

_ansi_colors

_ansi_reset_all

ride.utils.logging.LOG_LEVELS[source]
ride.utils.logging._process_rank()[source]
ride.utils.logging.process_rank[source]
ride.utils.logging.if_rank_zero(fn)[source]
ride.utils.logging.getLogger(name, log_once=False)[source]
ride.utils.logging.logger[source]
ride.utils.logging._ansi_colors[source]
ride.utils.logging._ansi_reset_all = '\x1b[0m'[source]
ride.utils.logging.style(text, fg=None, bg=None, bold=None, dim=None, underline=None, blink=None, reverse=None, reset=True)[source]

Styles a text with ANSI styles and returns the new string. By default the styling is self contained which means that at the end of the string a reset code is issued. This can be prevented by passing reset=False.

This is a modified version of the one found in click https://click.palletsprojects.com/en/7.x/

Examples:

logger.info(style('Hello World!', fg='green'))
logger.info(style('ATTENTION!', blink=True))
logger.info(style('Some things', reverse=True, fg='cyan'))

Supported color names:

  • black (might be a gray)

  • red

  • green

  • yellow (might be an orange)

  • blue

  • magenta

  • cyan

  • white (might be light gray)

  • bright_black

  • bright_red

  • bright_green

  • bright_yellow

  • bright_blue

  • bright_magenta

  • bright_cyan

  • bright_white

  • reset (reset the color code only)

Parameters:
  • text – the string to style with ansi codes.

  • fg – if provided this will become the foreground color.

  • bg – if provided this will become the background color.

  • bold – if provided this will enable or disable bold mode.

  • dim – if provided this will enable or disable dim mode. This is badly supported.

  • underline – if provided this will enable or disable underline.

  • blink – if provided this will enable or disable blinking.

  • reverse – if provided this will enable or disable inverse rendering (foreground becomes background and the other way round).

  • reset – by default a reset-all code is added at the end of the string which means that styles do not carry over. This can be disabled to compose styles.

ride.utils.logging.style_logging()[source]
ride.utils.logging.init_logging(logdir: str = None, logging_backend: str = 'tensorboard')[source]
Read the Docs v: latest
Versions
latest
stable
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.