Added an example to demonstrate how to use
Just to try and help folks wrap their heads around my project.
This commit is contained in:
parent
f924628acc
commit
94bda86a8c
3
.gitignore
vendored
3
.gitignore
vendored
@ -13,3 +13,6 @@ export_presets.cfg
|
||||
.mono/
|
||||
data_*/
|
||||
mono_crash.*.json
|
||||
|
||||
# Exclude .log files
|
||||
*.log
|
21
example/Example Logging.gd
Normal file
21
example/Example Logging.gd
Normal file
@ -0,0 +1,21 @@
|
||||
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
|
16
example/Example Logging.tscn
Normal file
16
example/Example Logging.tscn
Normal file
@ -0,0 +1,16 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/Logger/log_base.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/Logger/example/Example Logging.gd" type="Script" id=2]
|
||||
|
||||
[node name="Example Logging" type="Node2D"]
|
||||
position = Vector2( 250, 250 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Logger" type="Node" parent="."]
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_editor_description_": "Logger V1.0 ApolloX"
|
||||
}
|
||||
persist_debug = false
|
||||
file_dir = "res://addons/Logger/example/"
|
Loading…
x
Reference in New Issue
Block a user