Logger

package
v0.0.0-...-5e8c587 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Custom logger to receive messages from the internal error/warning stream. Loggers are registered via OS.AddLogger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsLogger() Instance
}

type ErrorType

type ErrorType int //gd:Logger.ErrorType
const (
	// The message received is an error.
	ErrorTypeError ErrorType = 0
	// The message received is a warning.
	ErrorTypeWarning ErrorType = 1
	// The message received is a script error.
	ErrorTypeScript ErrorType = 2
	// The message received is a shader error.
	ErrorTypeShader ErrorType = 3
)

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsLogger

func (self *Extension[T]) AsLogger() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.Logger

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsLogger

func (self Instance) AsLogger() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) ID

func (self Instance) ID() ID

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	// 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 function may be called from multiple different threads, so you may need to do your own locking.
	//
	// 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.CaptureScriptBacktraces].
	//
	// [Engine.CaptureScriptBacktraces]: https://pkg.go.dev/graphics.gd/classdb/Engine#CaptureScriptBacktraces
	// [Logger]: https://pkg.go.dev/graphics.gd/classdb/Logger
	// [ProjectSettings]: https://pkg.go.dev/graphics.gd/classdb/ProjectSettings
	LogError(function string, file string, line int, code string, rationale string, editor_notify bool, error_type int, script_backtraces []ScriptBacktrace.Instance)
	// Called when a message is logged. If 'error' is true, then this message was meant to be sent to stderr.
	//
	// Warning: This function may be called from multiple different threads, so you may need to do your own locking.
	LogMessage(message string, error bool)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL