Created
September 27, 2019 16:03
-
-
Save TheDuriel/1cd5415dd337e29e93ddfb1ee4b31c96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Reference | |
class_name Log | |
""" | |
Log Utility Class Script | |
""" | |
enum LEVEL {HINT, WARNING, ERROR} | |
const LOG_LEVEL: int = LEVEL.ERROR | |
static func hint(emitter: Object, message: String) -> void: | |
_log(emitter, message, LEVEL.HINT) | |
static func warning(emitter: Object, message: String) -> void: | |
_log(emitter, message, LEVEL.WARNING) | |
static func error(emitter: Object, message: String) -> void: | |
_log(emitter, message, LEVEL.ERROR) | |
static func _log(emitter: Object, message: String, level: int) -> void: | |
if LOG_LEVEL >= level: | |
match level: | |
LEVEL.HINT: | |
print("_HINT: %s: %s" % [emitter, message]) | |
LEVEL.WARNING: | |
print("_WARNING: %s: %s" % [emitter, message]) | |
LEVEL.ERROR: | |
print("_ERROR: %s: %s" % [emitter, message]) | |
assert(false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment