metawards.utils.Console¶
- 
class 
metawards.utils.Console[source]¶ This is a singleton class that provides access to printing and logging functions to the console. This uses ‘rich’ for rich console printing
- 
__init__()¶ Initialize self. See help(type(self)) for accurate signature.
Methods
center(text, *args, **kwargs)command(text, *args, **kwargs)debug(text, variables, level, markdown, **kwargs)Print a debug string to the console. debugging_enabled(level)Return whether debug output is enabled (optionally for the specified level) - if not, then anything sent to ‘debug’ (for that level) is not printed error(text, *args, **kwargs)Print an error to the console info(text, *args, **kwargs)Print an info section to the console panel(text, markdown[, width, expand])Print within a panel to the console print(text, markdown, style, *args, **kwargs)Print to the console print_exception()Print the current-handled exception print_population(population[, demographics])print_profiler(profiler, *args, **kwargs)progress(visible, show_limit)redirect_output(outdir, auto_bzip)Redirect all output and error to the directory ‘outdir’ rule(title[, style])Write a rule across the screen with optional title save(file, IO])Save the accumulated printing to the console to ‘file’. set_debugging_enabled(enabled[, level])Switch on or off debugging output set_theme(theme)Set the theme used for the console - this should be one of the themes in metawards.themes set_use_progress(use_progress)set_use_spinner(use_spinner)spinner(text)supports_emojis()Return whether or not you can print emojis to this console warning(text, *args, **kwargs)Print a warning to the console - 
static 
debug(text: str, variables: List[any] = None, level: int = None, markdown: bool = False, **kwargs)[source]¶ Print a debug string to the console. This will only be printed if debugging is enabled. You can also print the values of variables by passing them as a list to ‘variables’
- 
static 
debugging_enabled(level: int = None)[source]¶ Return whether debug output is enabled (optionally for the specified level) - if not, then anything sent to ‘debug’ (for that level) is not printed
- 
static 
panel(text: str, markdown: bool = False, width=None, padding: bool = True, style: str = None, expand=True, *args, **kwargs)[source]¶ Print within a panel to the console
- 
static 
print(text: str, markdown: bool = False, style: str = None, *args, **kwargs)[source]¶ Print to the console
- 
static 
redirect_output(outdir: str, auto_bzip: bool = True)[source]¶ Redirect all output and error to the directory ‘outdir’
- 
static 
rule(title: str = None, style=None, **kwargs)[source]¶ Write a rule across the screen with optional title
- 
static 
save(file: Union[str, IO])[source]¶ Save the accumulated printing to the console to ‘file’. This can be a file or a filehandle. The buffer is cleared after saving
-