output_panel.rst 3.6 KB

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