From abcbce2dcdd145cdf6b99dfe7c6e1db0ee8da927 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Mon, 8 Apr 2024 21:37:29 +0200 Subject: [PATCH] Fix crash function crashing (lol) --- docs/docs/reference/loggerinstance.md | 5 +++++ src/classes/loggerinstance.gd | 5 ++++- src/logger.gd | 11 +++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/docs/reference/loggerinstance.md b/docs/docs/reference/loggerinstance.md index c1a87da..7a2d860 100644 --- a/docs/docs/reference/loggerinstance.md +++ b/docs/docs/reference/loggerinstance.md @@ -12,6 +12,11 @@ Pretty much a wrapper around CORE's logging implementation. CoreLoggerInstance's Reference to CORE's logger module. ### *String* origin The origin argument. +### *String* framework = *false* +:::danger[Don't modify] +Do not modify this. +::: +For internal purposes only. ## Functions ### *void* _init(*CoreBaseModule* logger_new, *String* origin_new) diff --git a/src/classes/loggerinstance.gd b/src/classes/loggerinstance.gd index 3c5479f..6bce27e 100644 --- a/src/classes/loggerinstance.gd +++ b/src/classes/loggerinstance.gd @@ -28,6 +28,9 @@ class_name CoreLoggerInstance var logger: CoreBaseModule ## The origin argument. var origin: String +## For internal purposes only. +## [b]Note: [i]Don't modify.[/i][/b] +var framework: bool = false ## The instance constructor. func _init(logger_new: CoreBaseModule, origin_new: String) -> void: @@ -46,4 +49,4 @@ func warn(message: String) -> void: logger.warn(origin, message) func error(message: String) -> void: logger.error(origin, message) ## Handles crashes. Will terminate your game/application immediately.[br] ## [b]Note: [i]Using the [code]await[/code] keyword is required for this function.[/i][/b] -func crash(message: String) -> void: await logger.crash(origin, message) +func crash(message: String) -> void: await logger.crash(origin, message, framework) diff --git a/src/logger.gd b/src/logger.gd index f1a5c88..fdcc069 100644 --- a/src/logger.gd +++ b/src/logger.gd @@ -146,6 +146,8 @@ VIDEO -> Adapter Information %video_adapter% +++ GODOT ENGINE INFORMATION +++ +ENGINE + -> Version %godot_version% BUILD -> Debug build %godot_debug% -> Sandboxed %godot_sandboxed% @@ -161,11 +163,11 @@ STACKTRACE else: crash_message = crash_message.replace("%causer%", "The running application") crash_message = crash_message.replace("%origin%", origin) crash_message = crash_message.replace("%message%", message) - crash_message = crash_message.replace("%version_release%", str(core.version_release)) - crash_message = crash_message.replace("%version_type%", await core.get_formatted_string("%type%")) + crash_message = crash_message.replace("%version_release%", str(core.version_version)) + crash_message = crash_message.replace("%version_type%", await core.get_formatted_string("%version_type%")) crash_message = crash_message.replace("%version_typerelease%", str(core.version_typerelease)) - crash_message = crash_message.replace("%version_full%", str(core.version_release) + await core.get_formatted_string("-%type_technical%") + str(core.version_typerelease)) - crash_message = crash_message.replace("%version_semantic%", await core.get_formatted_string("%release_semantic%")) + crash_message = crash_message.replace("%version_full%", str(core.version_version) + await core.get_formatted_string("-%version_type_technical%") + str(core.version_typerelease)) + crash_message = crash_message.replace("%version_semantic%", await core.get_formatted_string("%version_semantic%")) crash_message = crash_message.replace("%devmode%", str(core.is_devmode())) crash_message = crash_message.replace("%headless%", str(core.config.headless)) crash_message = crash_message.replace("%os%", OS.get_name()) @@ -181,6 +183,7 @@ STACKTRACE crash_message = crash_message.replace("%processor_name%", OS.get_processor_name()) crash_message = crash_message.replace("%processor_count%", str(OS.get_processor_count())) crash_message = crash_message.replace("%video_adapter%", str(OS.get_video_adapter_driver_info())) + crash_message = crash_message.replace("%godot_version%", str(Engine.get_version_info()["string"])) crash_message = crash_message.replace("%godot_debug%", str(OS.is_debug_build())) crash_message = crash_message.replace("%godot_sandboxed%", str(OS.is_sandboxed())) crash_message = crash_message.replace("%godot_persistance%", str(OS.is_userfs_persistent()))