abcvoting.output

Print messages to terminal depending on a given verbosity level.

Similar to the Python logging module. Also meant to be used as Singleton.

The verbosity levels are:

  • CRITICAL

  • ERROR

  • WARNING

  • INFO

  • DETAILS

  • DEBUG

  • DEBUG2

The default verbosity is WARNING.

Expand for references to abcvoting.output

Properties of committees

abcvoting.properties

class abcvoting.output.Output(verbosity=30, logger=None)

Handling the output based on the current verbosity level.

This is inspired by the class logging.Logger(). A verbosity level is stored, only messages printed with methods with higher importance will be printed.

Parameters:
verbosityint

Verbosity level.

Minimum level of importance of messages to be printed, as defined by constants in this module

loggerlogging.Logger, optional

Optional logger.

Can be used to send messages also to a log file or elsewhere, log level is separate from verbosity.

critical(msg, wrap=True, indent='')

Print a message with verbosity level CRITICAL.

Parameters:
msgstr

The message.

wrapbool, optional

Wrap the message at 99 characters (if too long).

indentstr, optional

Indent each line with the this string.

debug(msg, wrap=True, indent='')

Print a message with verbosity level DEBUG.

Parameters:
msgstr

The message.

wrapbool, optional

Wrap the message at 99 characters (if too long).

indentstr, optional

Indent each line with the this string.

debug2(msg, wrap=True, indent='')

Print a message with verbosity level DEBUG2.

Parameters:
msgstr

The message.

wrapbool, optional

Wrap the message at 99 characters (if too long).

indentstr, optional

Indent each line with the this string.

details(msg, wrap=True, indent='')

Print a message with verbosity level DETAILS.

Parameters:
msgstr

The message.

wrapbool, optional

Wrap the message at 99 characters (if too long).

indentstr, optional

Indent each line with the this string.

error(msg, wrap=True, indent='')

Print a message with verbosity level ERROR.

Parameters:
msgstr

The message.

wrapbool, optional

Wrap the message at 99 characters (if too long).

indentstr, optional

Indent each line with the this string.

info(msg, wrap=True, indent='')

Print a message with verbosity level INFO.

Parameters:
msgstr

The message.

wrapbool, optional

Wrap the message at 99 characters (if too long).

indentstr, optional

Indent each line with the this string.

set_verbosity(verbosity=30)

Set verbosity level.

Parameters:
verbosityint

Verbosity level.

Expand for references to abcvoting.output.Output.set_verbosity

abcvoting.properties

warning(msg, wrap=True, indent='')

Print a message with verbosity level WARNING.

Parameters:
msgstr

The message.

wrapbool, optional

Wrap the message at 99 characters (if too long).

indentstr, optional

Indent each line with the this string.