class_logger.rst 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Logger.xml.
  6. .. _class_Logger:
  7. Logger
  8. ======
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Custom logger to receive messages from the internal error/warning stream.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Custom logger to receive messages from the internal error/warning stream. Loggers are registered via :ref:`OS.add_logger()<class_OS_method_add_logger>`.
  15. .. rst-class:: classref-reftable-group
  16. Methods
  17. -------
  18. .. table::
  19. :widths: auto
  20. +--------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | |void| | :ref:`_log_error<class_Logger_private_method__log_error>`\ (\ function\: :ref:`String<class_String>`, file\: :ref:`String<class_String>`, line\: :ref:`int<class_int>`, code\: :ref:`String<class_String>`, rationale\: :ref:`String<class_String>`, editor_notify\: :ref:`bool<class_bool>`, error_type\: :ref:`int<class_int>`, script_backtraces\: :ref:`Array<class_Array>`\[:ref:`ScriptBacktrace<class_ScriptBacktrace>`\]\ ) |virtual| |
  22. +--------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | |void| | :ref:`_log_message<class_Logger_private_method__log_message>`\ (\ message\: :ref:`String<class_String>`, error\: :ref:`bool<class_bool>`\ ) |virtual| |
  24. +--------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. .. rst-class:: classref-section-separator
  26. ----
  27. .. rst-class:: classref-descriptions-group
  28. Enumerations
  29. ------------
  30. .. _enum_Logger_ErrorType:
  31. .. rst-class:: classref-enumeration
  32. enum **ErrorType**: :ref:`🔗<enum_Logger_ErrorType>`
  33. .. _class_Logger_constant_ERROR_TYPE_ERROR:
  34. .. rst-class:: classref-enumeration-constant
  35. :ref:`ErrorType<enum_Logger_ErrorType>` **ERROR_TYPE_ERROR** = ``0``
  36. The message received is an error.
  37. .. _class_Logger_constant_ERROR_TYPE_WARNING:
  38. .. rst-class:: classref-enumeration-constant
  39. :ref:`ErrorType<enum_Logger_ErrorType>` **ERROR_TYPE_WARNING** = ``1``
  40. The message received is a warning.
  41. .. _class_Logger_constant_ERROR_TYPE_SCRIPT:
  42. .. rst-class:: classref-enumeration-constant
  43. :ref:`ErrorType<enum_Logger_ErrorType>` **ERROR_TYPE_SCRIPT** = ``2``
  44. The message received is a script error.
  45. .. _class_Logger_constant_ERROR_TYPE_SHADER:
  46. .. rst-class:: classref-enumeration-constant
  47. :ref:`ErrorType<enum_Logger_ErrorType>` **ERROR_TYPE_SHADER** = ``3``
  48. The message received is a shader error.
  49. .. rst-class:: classref-section-separator
  50. ----
  51. .. rst-class:: classref-descriptions-group
  52. Method Descriptions
  53. -------------------
  54. .. _class_Logger_private_method__log_error:
  55. .. rst-class:: classref-method
  56. |void| **_log_error**\ (\ function\: :ref:`String<class_String>`, file\: :ref:`String<class_String>`, line\: :ref:`int<class_int>`, code\: :ref:`String<class_String>`, rationale\: :ref:`String<class_String>`, editor_notify\: :ref:`bool<class_bool>`, error_type\: :ref:`int<class_int>`, script_backtraces\: :ref:`Array<class_Array>`\[:ref:`ScriptBacktrace<class_ScriptBacktrace>`\]\ ) |virtual| :ref:`🔗<class_Logger_private_method__log_error>`
  57. Called when an error is logged. The error provides the ``function``, ``file``, and ``line`` that it originated from, as well as either the ``code`` that generated the error or a ``rationale``.
  58. The type of error provided by ``error_type`` is described in the :ref:`ErrorType<enum_Logger_ErrorType>` enumeration.
  59. Additionally, ``script_backtraces`` provides backtraces for each of the script languages. These will only contain stack frames in editor builds and debug builds by default. To enable them for release builds as well, you need to enable :ref:`ProjectSettings.debug/settings/gdscript/always_track_call_stacks<class_ProjectSettings_property_debug/settings/gdscript/always_track_call_stacks>`.
  60. \ **Warning:** This function may be called from multiple different threads, so you may need to do your own locking.
  61. \ **Note:** ``script_backtraces`` will not contain any captured variables, due to its prohibitively high cost. To get those you will need to capture the backtraces yourself, from within the **Logger** virtual methods, using :ref:`Engine.capture_script_backtraces()<class_Engine_method_capture_script_backtraces>`.
  62. .. rst-class:: classref-item-separator
  63. ----
  64. .. _class_Logger_private_method__log_message:
  65. .. rst-class:: classref-method
  66. |void| **_log_message**\ (\ message\: :ref:`String<class_String>`, error\: :ref:`bool<class_bool>`\ ) |virtual| :ref:`🔗<class_Logger_private_method__log_message>`
  67. Called when a message is logged. If ``error`` is ``true``, then this message was meant to be sent to ``stderr``.
  68. \ **Warning:** This function may be called from multiple different threads, so you may need to do your own locking.
  69. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  70. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  71. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  72. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  73. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  74. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  75. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  76. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  77. .. |void| replace:: :abbr:`void (No return value.)`