gridtest.logger package

Submodules

gridtest.logger.message module

Copyright (C) 2017-2020 Vanessa Sochat.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

class gridtest.logger.message.GridTestMessage(MESSAGELEVEL=None)[source]

Bases: object

abort(message)[source]
addColor(level, text)[source]

addColor to the prompt (usually prefix) if terminal supports, and specified to do so

critical(message)[source]
custom(prefix, message='', color='\x1b[95m')[source]
debug(message)[source]
emit(level, message, prefix=None, color=None)[source]

emit is the main function to print the message optionally with a prefix

Arguments:
  • level (int) : the level of the message

  • message (str) : the message to print

  • prefix (str) : a prefix for the message

emitError(level)[source]

determine if a level should print to stderr, includes all levels but INFO and QUIET

emitOutput(level)[source]

determine if a level should print to stdout only includes INFO

error(message)[source]
exit(message, return_code=1)[source]
exit_info(message, return_code=0)[source]
failure(message)[source]

Given a message string, print as a failure in red.

Parameters:
  • message: the message to print in red (indicating failure).

get_logs(join_newline=True)[source]

‘get_logs will return the complete history, joined by newline (default) or as is.

info(message)[source]
isEnabledFor(messageLevel)[source]

check if a messageLevel is enabled to emit a level

is_quiet()[source]

is_quiet returns true if the level is under 1

log(message)[source]
newline()[source]
show_progress(iteration, total, length=40, min_level=0, prefix=None, carriage_return=True, suffix=None, symbol=None)[source]

create a terminal progress bar, default bar shows for verbose+

Parameters
  • iteration (current iteration (Int))

  • total (total iterations (Int))

  • length (character length of bar (Int))

spinner = <gridtest.logger.spinner.Spinner object>
success(message)[source]

Given a message string, print as a success in green.

Parameters:
  • message: the message to print in green (indicating success).

table(rows, col_width=2)[source]

table will print a table of entries. If the rows is a dictionary, the keys are interpreted as column names. if not, a numbered list is used.

useColor()[source]

useColor will determine if color should be added to a print. Will check if being run in a terminal, and if has support for asci

verbose(message)[source]
verbose1(message)[source]
verbose2(message)[source]
verbose3(message)[source]
warning(message)[source]
write(stream, message)[source]

write will write a message to a stream, first checking the encoding

gridtest.logger.message.convert2boolean(arg)[source]

convert2boolean is used for environmental variables that must be returned as boolean

gridtest.logger.message.get_logging_level()[source]

get_logging_level will configure a logging to standard out based on selected level, which should be in an environment variable called MESSAGELEVEL. if MESSAGELEVEL is not set, the maximum level (5) is assumed (all messages).

gridtest.logger.message.get_user_color_preference()[source]

gridtest.logger.namer module

Copyright (C) 2018-2020 Vanessa Sochat.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

class gridtest.logger.namer.RobotNamer[source]

Bases: object

generate(delim='-', length=4, chars='0123456789')[source]
Generate a robot name. Inspiration from Haikunator, but much more

poorly implemented ;)

Parameters
  • delim (Delimiter)

  • length (TokenLength)

  • chars (TokenChars)

gridtest.logger.namer.main()[source]

gridtest.logger.progress module

clint.textui.progress

A derivation of clint version, to not introduce a dependency and add custom functionality. Credit to base code goes to https://github.com/kennethreitz/clint/blob/master/clint/textui/progress.py

class gridtest.logger.progress.ProgressBar(label='', width=32, hide=None, empty_char=' ', filled_char='-', expected_size=None, every=1)[source]

Bases: object

done()[source]
format_time(seconds)[source]
show(progress, count=None)[source]
gridtest.logger.progress.bar(it, label='', width=32, hide=None, empty_char=' ', filled_char='-', expected_size=None, every=1)[source]

Progress iterator. Wrap your iterables with it.

gridtest.logger.spinner module

Copyright (C) 2017-2020 Vanessa Sochat.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

class gridtest.logger.spinner.Spinner(delay=None, generator=None)[source]

Bases: object

static balloons_cursor()[source]
static changing_arrows()[source]
delay = 0.1
run()[source]
select_generator(generator)[source]
spinning = False
static spinning_cursor()[source]
start()[source]
stop()[source]

Module contents