HEGoLog
Inherits: Object
HEGo’s logger, shared by the C++ side and GDScript.
Description
Everything HEGo logs goes through this singleton. Each entry carries a level, a category and a timestamp, and ends up in an in-memory buffer the HEGo bottom panel reads, in the Godot output if it is at or above the output level, and in a log file if file logging is enabled.
Log your own messages through the same object so they appear alongside HEGo’s:
var log = HEGoLog.get_singleton()
log.info("cook", "Cooking %s" % asset_name)
log.warning("input", "Input %s has no mesh, skipping it." % path)
Recording is safe from any thread. HEGo’s work runs on a background thread (see HEGoTask), so entries are recorded wherever they are produced and printed later on the main thread; nothing in the logging path calls into Godot from a worker thread.
Warnings and errors also go through push_warning() and push_error(), so they still reach Godot’s debugger.
Configured through the hego/logging/ project settings: store_level, output_level, enable_file_logging, log_path and max_log_files.
Tutorials
Methods
get_singleton() static |
|
|
level_name(level: |
void |
trace(category: |
void |
debug(category: |
void |
info(category: |
void |
warning(category: |
void |
error(category: |
void |
log_message(level: |
|
get_cursor() const |
|
get_entries_since(cursor: |
|
get_categories() const |
void |
clear() |
|
save_to_file(path: |
void |
flush() |
|
get_log_file_path() const |
void |
|
void |
set_store_level(level: |
|
get_store_level() const |
void |
set_output_level(level: |
|
get_output_level() const |
Enumerations
enum Level: 🔗
Level LEVEL_TRACE = 0
Per-element detail. Not recorded unless the store level is lowered to it.
Level LEVEL_DEBUG = 1
What HEGo is doing during a cook. The default store level.
Level LEVEL_INFO = 2
Milestones a user cares about. The default output level.
Level LEVEL_WARNING = 3
Something was skipped or guessed; the operation continues.
Level LEVEL_ERROR = 4
The operation failed.
Method Descriptions
HEGoLog get_singleton() static 🔗
Returns the global HEGoLog instance.
String level_name(level: int) static 🔗
Human readable name of a level, for example "WARNING" for LEVEL_WARNING.
void trace(category: String, message: String) 🔗
Records a per-element detail message. Dropped unless hego/logging/store_level is lowered to LEVEL_TRACE.
void debug(category: String, message: String) 🔗
Records what HEGo is doing during a cook. Goes to the session panel and the log file, not to the Godot output, unless the output level is lowered.
void info(category: String, message: String) 🔗
Records a milestone worth showing to the user: session started, cook finished, asset selected.
void warning(category: String, message: String) 🔗
Records that something was skipped or guessed while the operation continued. Also raises a Godot warning.
void error(category: String, message: String) 🔗
Records that an operation failed. Also raises a Godot error.
void log_message(level: int, category: String, message: String) 🔗
Records a message at an explicit level, for callers that decide the level at runtime.
int get_cursor() const 🔗
Index one past the newest entry. Pass a previously returned value to get_entries_since() to read only what arrived in between.
Array get_entries_since(cursor: int, min_level: int = 0) const 🔗
Entries recorded since cursor, as dictionaries with index, time, level, level_name, category and message.
Entries dropped from the buffer since then are simply missing, so a reader that falls behind skips ahead rather than blocking anything.
PackedStringArray get_categories() const 🔗
Categories seen since the buffer was last cleared. HEGo uses session, node, cook, input, output, attrib, parm, terrain3d and platform; your own scripts may use any string.
void clear() 🔗
Empties the buffer.
bool save_to_file(path: String) const 🔗
Writes the whole buffer to path as text. Returns false if the file could not be written.
void flush() 🔗
Prints everything recorded since the last call to the Godot output and the log file. Must run on the main thread; the editor plugin calls it every frame, so most callers never need to.
String get_log_file_path() const 🔗
Absolute path of the log file this run writes to, or an empty string when file logging is off.
void configure() 🔗
Re-reads the hego/logging/ project settings and reopens the log file. Call after changing any of them at runtime.
void set_store_level(level: int) 🔗
Lowest level kept in the buffer.
int get_store_level() const 🔗
Lowest level kept in the buffer.
void set_output_level(level: int) 🔗
Lowest level printed to the Godot output.
int get_output_level() const 🔗
Lowest level printed to the Godot output.
Class Registration
Kind: Concrete