|
| 1 | +.. _doc_output_panel: |
| 2 | + |
| 3 | +Output panel |
| 4 | +============ |
| 5 | + |
| 6 | +The output panel is found at the bottom of the screen. Click on **Output** to open it. |
| 7 | + |
| 8 | +.. image:: img/overview_output.webp |
| 9 | + |
| 10 | +The output panel provides several features to make viewing text printed by the |
| 11 | +project (and editor) easier. |
| 12 | + |
| 13 | +.. note:: |
| 14 | + |
| 15 | + The output panel automatically opens when running a project by default. |
| 16 | + You can control this behavior by changing the **Run > Bottom Panel > Action on Play** |
| 17 | + editor setting. |
| 18 | + |
| 19 | +Message categories |
| 20 | +------------------ |
| 21 | + |
| 22 | +Four message categories are available: |
| 23 | + |
| 24 | +- **Log:** Standard messages printed by the project. Displayed in white or black |
| 25 | + (depending on the editor theme). |
| 26 | +- **Error:** Messages printed by the project or editor that report important |
| 27 | + information, but do not indicate a failure. Displayed in yellow. |
| 28 | +- **Warning:** Messages printed by the project or editor that indicate a failure |
| 29 | + of some kind. Displayed in red. |
| 30 | +- **Editor:** Messages printed by the editor, typically intended to be traces of |
| 31 | + undo/redo actions. Displayed in gray. |
| 32 | + |
| 33 | +Filtering messages |
| 34 | +------------------ |
| 35 | + |
| 36 | +By clicking on the buttons on the right, you can hide certain message categories. |
| 37 | +This can make it easier to find specific messages you're looking for. |
| 38 | + |
| 39 | +You can also filter messages by their text content using the **Filter Messages** box |
| 40 | +at the bottom of the Output panel. |
| 41 | + |
| 42 | +Clearing messages |
| 43 | +----------------- |
| 44 | + |
| 45 | +When running the project, existing messages are automatically cleared by default. This |
| 46 | +is controlled by the **Run > Output > Always Clear Output on Play** editor setting. |
| 47 | +Additionally, you can manually clear messages by clicking the "cleaning brush" icon |
| 48 | +in the top-right corner of the Output panel. |
| 49 | + |
| 50 | +Printing messages |
| 51 | +----------------- |
| 52 | + |
| 53 | +Several methods are available to print messages: |
| 54 | + |
| 55 | +- :ref:`print() <class_@GlobalScope_method_print>`: Prints a message. |
| 56 | + This method accepts multiple arguments which are concatenated together upon printing. |
| 57 | +- :ref:`print_rich() <class_@GlobalScope_method_print_rich>`: Same as ``print()``, |
| 58 | + but BBCode can be used to format the text that is printed (see below). |
| 59 | +- :ref:`push_error() <class_@GlobalScope_method_push_error>`: Prints an error message. |
| 60 | + When an error is printed in a running project, it's displayed in the **Debugger > Errors** |
| 61 | + tab instead. |
| 62 | +- :ref:`push_warning() <class_@GlobalScope_method_push_warning>`: Prints a warning message. |
| 63 | + When a warning is printed in a running project, it's displayed in the **Debugger > Errors** |
| 64 | + tab instead. |
| 65 | + |
| 66 | +To get more advanced formatting capabilities, consider using |
| 67 | +:ref:`doc_gdscript_printf` along with the above printing functions. |
| 68 | + |
| 69 | +.. _doc_output_panel_printing_rich_text: |
| 70 | + |
| 71 | +Printing rich text |
| 72 | +^^^^^^^^^^^^^^^^^^ |
| 73 | + |
| 74 | +Using :ref:`print_rich() <class_@GlobalScope_method_print_rich>`, you can print |
| 75 | +rich text to the editor Output panel and standard output (visible when the user |
| 76 | +runs the project from a terminal). This works by converting the BBCode to |
| 77 | +`ANSI escape codes <https://en.wikipedia.org/wiki/ANSI_escape_code>`__ that the |
| 78 | +terminal understands. |
| 79 | + |
| 80 | +In the editor output, all BBCode tags are recognized as usual. In the terminal |
| 81 | +output, only a subset of BBCode tags will work, as documented in the linked |
| 82 | +``print_rich()`` method description above. In the terminal, the colors will look |
| 83 | +different depending on the user's theme, while colors in the editor will use the |
| 84 | +same colors as they would in the project. |
| 85 | + |
| 86 | +.. note:: |
| 87 | + |
| 88 | + ANSI escape code support varies across terminal emulators. On Windows, only |
| 89 | + Windows 10 and later can display ANSI escape codes in its default terminal |
| 90 | + application. |
| 91 | + |
| 92 | + The exact colors displayed in terminal output also depend on the terminal |
| 93 | + theme chosen by the user. |
0 commit comments