Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Logger

Hereda: RefCounted < Object

Logger personalizado para recibir mensajes del flujo interno de errores/advertencias.

Descripción

Logger personalizado para recibir mensajes del flujo interno de errores/advertencias. Los loggers se registran a través de OS.add_logger().

Tutoriales

Métodos

void

_log_error(function: String, file: String, line: int, code: String, rationale: String, editor_notify: bool, error_type: int, script_backtraces: Array[ScriptBacktrace]) virtual

void

_log_message(message: String, error: bool) virtual


Enumeraciones

enum ErrorType: 🔗

ErrorType ERROR_TYPE_ERROR = 0

El mensaje recibido es un error.

ErrorType ERROR_TYPE_WARNING = 1

El mensaje recibido es una advertencia.

ErrorType ERROR_TYPE_SCRIPT = 2

El mensaje recibido es un error de script.

ErrorType ERROR_TYPE_SHADER = 3

El mensaje recibido es un error de shader.


Descripciones de Métodos

void _log_error(function: String, file: String, line: int, code: String, rationale: String, editor_notify: bool, error_type: int, script_backtraces: Array[ScriptBacktrace]) virtual 🔗

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.

The type of error provided by error_type is described in the ErrorType enumeration.

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 ProjectSettings.debug/settings/gdscript/always_track_call_stacks.

Warning: This method will be called from threads other than the main thread, possibly at the same time, so you will need to have some kind of thread-safety in your implementation of it, like a Mutex.

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 Engine.capture_script_backtraces().

Note: Logging errors from this method using functions like @GlobalScope.push_error() or @GlobalScope.push_warning() is not supported, as it could cause infinite recursion. These errors will only show up in the console output.


void _log_message(message: String, error: bool) virtual 🔗

Llamado cuando se registra un mensaje. Si error es true, entonces este mensaje estaba destinado a ser enviado a stderr.

Advertencia: Este método será llamado desde hilos distintos al hilo principal, posiblemente al mismo tiempo, por lo que necesitarás tener algún tipo de seguridad de hilos en tu implementación, como un Mutex.

Nota: No se admite el registro de otro mensaje desde este método usando funciones como @GlobalScope.print(), ya que podría causar una recursión infinita. Estos mensajes solo aparecerán en la salida de la consola.