stouputils.print.message module#

info(
*values: Any,
color: str = '\x1b[92m',
text: str = 'INFO ',
prefix: str = '',
file: TextIO | list[TextIO] | None = None,
use_colored: bool = False,
**print_kwargs: Any,
) None[source]#

Print an information message looking like “[INFO HH:MM:SS] message” in green by default.

Parameters:
  • values (Any) – Values to print (like the print function)

  • color (str) – Color of the message (default: GREEN)

  • text (str) – Text of the message (default: “INFO “)

  • prefix (str) – Prefix to add to the values

  • file (TextIO|list[TextIO]) – File(s) to write the message to (default: sys.stdout)

  • use_colored (bool) – Whether to use the colored() function to format the message

  • print_kwargs (dict) – Keyword arguments to pass to the print function

debug(
*values: Any,
flush: bool = True,
color: str = '\x1b[96m',
text: str = 'DEBUG',
**print_kwargs: Any,
) None[source]#

Print a debug message looking like “[DEBUG HH:MM:SS] message” in cyan by default.

alt_debug(
*values: Any,
flush: bool = True,
color: str = '\x1b[94m',
text: str = 'DEBUG',
**print_kwargs: Any,
) None[source]#

Print a debug message looking like “[DEBUG HH:MM:SS] message” in blue by default.

suggestion(
*values: Any,
flush: bool = True,
color: str = '\x1b[96m',
text: str = 'SUGGESTION',
**print_kwargs: Any,
) None[source]#

Print a suggestion message looking like “[SUGGESTION HH:MM:SS] message” in cyan by default.

progress(
*values: Any,
flush: bool = True,
color: str = '\x1b[95m',
text: str = 'PROGRESS',
**print_kwargs: Any,
) None[source]#

Print a progress message looking like “[PROGRESS HH:MM:SS] message” in magenta by default.

warning(
*values: Any,
flush: bool = True,
color: str = '\x1b[93m',
text: str = 'WARNING',
**print_kwargs: Any,
) None[source]#

Print a warning message looking like “[WARNING HH:MM:SS] message” in yellow by default and in sys.stderr.

error(
*values: Any,
exit: bool = False,
flush: bool = True,
color: str = '\x1b[91m',
text: str = 'ERROR',
**print_kwargs: Any,
) None[source]#

Print an error message (in sys.stderr and in red by default) and optionally ask the user to continue or stop the program.

Parameters:
  • values (Any) – Values to print (like the print function)

  • exit (bool) – Whether to ask the user to continue or stop the program, false to ignore the error automatically and continue

  • flush (bool) – Whether to flush the output

  • color (str) – Color of the message (default: RED)

  • text (str) – Text in the message (replaces “ERROR “)

  • print_kwargs (dict) – Keyword arguments to pass to the print function