foundry_dev_tools.utils.misc module#
These are miscellaneous utility functions/classes.
- class foundry_dev_tools.utils.misc.TailHelper[source]#
Bases:
object
Tails logs.
- Parameters:
print_handler – the way it prints the lines e.g. :py:meth:print or a :py:class:logging.Logger
start_message – the start_message to print before the first line or if None it will print a horizontal line
previous_line_number – the previous line number that was printed, if not none the start_message will never be printed and the first line will be the line after :py:attr:previous_line_number
- tail(log_lines)[source]#
Handles the logs.
If :py:attr:TailHelper.previous_line_number is None it will print the :py:attr:TailHelper.start_message and print everything contained int :py:attr:logs But if the :py:attr:TailHelper.previous_line_number is an integer it will print the logs from that given line number, this will only print new lines.
- Parameters:
log_lines (Sequence[str] | None) – a list of lines, if None execution will be skipped
- foundry_dev_tools.utils.misc.print_horizontal_line(c='-', print_handler=<built-in function print>)[source]#
Print a horizontal line with :py:attr:c.
It uses the amount of terminal columns to print a line of good length :param c: the char to print :param print_handler: the function to use for printing