Skip to content

Commit

Permalink
fix(Logging): add trace logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowApex committed Jun 21, 2024
1 parent 1e4b01e commit f3b3bd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/systems/debug/log.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ enum LEVEL {
ERROR, ## Only log errors
WARN, ## Log warnings and errors
INFO, ## Log info, warnings, and errors
DEBUG, ## Log everything
DEBUG, ## Log debug, info, warnings, and errors
TRACE, ## Log everything
}

## Returns a named logger for logging
Expand Down
8 changes: 8 additions & 0 deletions core/systems/debug/logger.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ func set_level(level: Log.LEVEL) -> void:
_level = level


func trace(message: Variant, xtra2: Variant = null, xtra3: Variant = null, xtra4: Variant = null, xtra5: Variant = null, xtra6: Variant = null):
if self._level < Log.LEVEL.TRACE:
return
var prefix := _format_prefix("TRACE", _get_caller())
var msg := _stringify(message, xtra2, xtra3, xtra4, xtra5, xtra6)
print_rich("[color=magenta]", prefix, "[/color]", msg)


func debug(message: Variant, xtra2: Variant = null, xtra3: Variant = null, xtra4: Variant = null, xtra5: Variant = null, xtra6: Variant = null):
if self._level < Log.LEVEL.DEBUG:
return
Expand Down

0 comments on commit f3b3bd5

Please sign in to comment.