Skip to content

Printmessage

flowtask.components.PrintMessage

PrintMessage

PrintMessage(loop=None, job=None, stat=None, **kwargs)

Bases: FlowComponent

PrintMessage

Overview

    This component prints a formatted message to the console with optional coloring and logging.

.. table:: Properties
:widths: auto


+-------------+----------+-----------+-------------------------------------------------------+
| Name        | Required | Summary                                                           |
+-------------+----------+-----------+-------------------------------------------------------+
| message     |   Yes    | The message to print, with optional variable substitution.        |
+-------------+----------+-----------+-------------------------------------------------------+
| color       |   No     | The color to use for the message. Overrides the level-based color.|
+-------------+----------+-----------+-------------------------------------------------------+
| level       |   No     | The log level of the message ("INFO", "DEBUG", "WARN", "ERROR",   |
|             |          | "CRITICAL"). Default is "INFO".                                   |
+-------------+----------+-----------+-------------------------------------------------------+
| condition   |   No     | A condition to evaluate before printing the message. The message  |
|             |          | is printed only if the condition is True.                         |
+-------------+----------+-----------+-------------------------------------------------------+
|  first      |   Yes    | First message                                                     |
+-------------+----------+-----------+-------------------------------------------------------+
|  last       |   Yes    | Last message                                                      |
+-------------+----------+-----------+-------------------------------------------------------+

Returns

This component returns the printed message.


Example:

```yaml
PrintMessage:
  message: 'End Form Metadata: {orgid}/{formid}'
  color: green
  level: WARN
```

close async

close()

Method.

run async

run()

Run Message.

start async

start(**kwargs)

Initialize the color setup.