Skip to content

Commit

Permalink
Ref count loggers to prevent leaks.
Browse files Browse the repository at this point in the history
Add restart notice to readme.
Remove preload from main.
  • Loading branch information
raldone01 committed Jan 18, 2024
1 parent 983b4e3 commit 241e4d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ git checkout v1.0.0

`Project -> Project Settings -> Plugins -> gdlogging -> Activate`

Autoloads are a bit janky so you may need to restart the editor for errors to go away.

## Licensing

Marked parts are licensed under the `LICENSE-godot-logger.md` (MIT) license.
Expand Down
2 changes: 1 addition & 1 deletion funcs/logger.gd
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static func format_time_default_for_filename(p_unix_time: float) -> String:

## Base class to be inherited by sinks.
## All message formatting has already been done by the logger.
class LogSink:
class LogSink extends RefCounted:
## Write many log records to the sink
func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void:
Log._logger_direct_console.warning("LogSink: write_bulks() not implemented.")
Expand Down
6 changes: 3 additions & 3 deletions main_gdlogging.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ var addons_panel_manager: Variant
func _enter_tree() -> void:
add_autoload_singleton("Log", "res://addons/gdlogging/funcs/logger.gd")
addons_panel_manager = load("res://addons/gdlogging/addons_shared_gen/addons_panel_manager.gd").AddonsPanelManager.new(self)
main_panel = preload("res://addons/gdlogging/scenes_editor/ui_addon_panel.tscn").instantiate()
main_panel = load("res://addons/gdlogging/scenes_editor/ui_addon_panel.tscn").instantiate()
addons_panel_manager.add_main_panel(main_panel)

func _exit_tree() -> void:
remove_autoload_singleton("Log")
addons_panel_manager.remove_main_panel()

func _get_plugin_icon():
func _get_plugin_icon() -> Texture2D:
return preload("res://addons/gdlogging/assets/icons_editor/plugin_icon_white.svg")

func _get_plugin_name():
func _get_plugin_name() -> String:
return "gdlogging"

0 comments on commit 241e4d6

Please sign in to comment.