momentGW.logging
Logging.
Module Contents
- momentGW.logging.write(msg, *args, **kwargs)
Print a message to the console.
- momentGW.logging.warn(msg, *args, **kwargs)
Print a message to the console with a warning comment.
- momentGW.logging.rate(value, good_threshold, ok_threshold, invert=False)
Return a colour rating based on a value and thresholds.
- class momentGW.logging.Status(msg, *args, **kwargs)
A status spinner with nested status messages.
- class momentGW.logging.Table(*args, **kwargs)
Bases:
rich.table.TableA table with additional context manager methods.
Notes
Since the Live object is created with transient=True, tables using the context manager will be removed from the display after the context manager is exited. Tables should be manually printed to the console if they are required to be displayed afterwards.
- add_column(*args, **kwargs)
Add a column to the table.
- add_row(*args, **kwargs)
Add a row to the table.
- classmethod grid(*headers: Column | str, padding: rich.padding.PaddingDimensions = 0, collapse_padding: bool = True, pad_edge: bool = False, expand: bool = False) Table
Get a table with no lines, headers, or footer.
- Parameters:
*headers (Union[Column, str]) – Column headers, either as a string, or
Columninstance.padding (PaddingDimensions, optional) – Get padding around cells. Defaults to 0.
collapse_padding (bool, optional) – Enable collapsing of padding around cells. Defaults to True.
pad_edge (bool, optional) – Enable padding around edges of table. Defaults to False.
expand (bool, optional) – Expand the table to fit the available space if
True, otherwise the table width will be auto-calculated. Defaults to False.
- Returns:
A table instance.
- Return type:
- momentGW.logging.time(msg, elapsed)
Record a time.
- momentGW.logging.dump_times()
Print a table with the timings.
- momentGW.logging.init_logging()
Initialise the logging with a header.
- momentGW.logging.with_timer(task_name)
Run a function with a timer.
- momentGW.logging.with_status(task_name)
Run a function with a status spinner.
- momentGW.logging.with_table(**kwargs)
Run a function with a table.
- momentGW.logging.with_comment(comment)
Run a function with a comment.
- momentGW.logging.with_silent()
Run a function silently.
- momentGW.logging.with_modifiers(**kwargs)
Run a function with modified logging.