Logger/example/Example Logging.gd
david 94bda86a8c Added an example to demonstrate how to use
Just to try and help folks wrap their heads around my project.
2021-09-04 23:50:07 -04:00

22 lines
1.0 KiB
GDScript

extends Node2D
# Obtain access to my plugin
onready var Log = $Logger
# Some example calls
func _ready():
# Standard calls with no secondary parameter
Log.debug("This is a debug statement")
Log.info("Information is ready")
Log.warn("Warning thrown") # Note: I could have also used Log.warning("Warning msg is same")
# More advanced calls with a second parameter (Decides to exit/end the progam
# This is calling error and setting it's auto_exit to false (it's default for errors)
Log.error("Failed obtaining acorns from squirrel army", false)
# This is calling critical (or crit) with it's default auto_exit setting (critical/crit will automatically exit)
Log.critical("This will auto exit after called", true) # Change to false to continue the program
printerr("This only goes to the console")
# Logger also includes some assistant functions
print("Current datetime stamp: ", Log.timestamp()) # This is used internally by Logger itself
print("Position of Example Logging node: ", Log.pos2str(self.position)) # This is so you can print positions