Make log colors different when not invoked by cmd.gd

This commit is contained in:
JeremyStar™ 2024-04-07 22:06:48 +02:00
parent c04e6246a4
commit b52acbba84
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 10 additions and 3 deletions

View file

@ -2,4 +2,6 @@ extends SceneTree
var scene: Node = load("res://addons/besseretests/scenesrc/runtimescene.tscn").instantiate() var scene: Node = load("res://addons/besseretests/scenesrc/runtimescene.tscn").instantiate()
func _initialize() -> void: root.add_child(scene) func _initialize() -> void:
scene.internal_cmdline = true
root.add_child(scene)

View file

@ -1,5 +1,8 @@
extends Control extends Control
# Internal
var internal_cmdline: bool = false
# Configuration for the configuration # Configuration for the configuration
var config: Node = Node.new() var config: Node = Node.new()
const config_path: String = "res://addons/besseretests_config.gd" const config_path: String = "res://addons/besseretests_config.gd"
@ -162,10 +165,12 @@ func _log(message: String, origin: String, level: int, sanitize: bool = true, le
match(level): match(level):
0: 0:
format = format.replace("%level%", "DIAG") format = format.replace("%level%", "DIAG")
format = format.replace("%color%", "gray") if internal_cmdline: format = format.replace("%color%", "gray")
else: format = format.replace("%color%", "light_gray")
1: 1:
format = format.replace("%level%", "VERB") format = format.replace("%level%", "VERB")
format = format.replace("%color%", "gray") if internal_cmdline: format = format.replace("%color%", "gray")
else: format = format.replace("%color%", "dark_gray")
2: 2:
format = format.replace("%level%", "INFO") format = format.replace("%level%", "INFO")
format = format.replace("%color%", "white") format = format.replace("%color%", "white")