Logging
Warning
Prerequisites:
Any code from the prerequisites can be omitted to make it easier to read. If you do want the complete code, look at the repository examples.
One of the first things you should do is add a log callback, otherwise you will never know when something goes wrong with your client.
| GDScript |
|---|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 | extends Node
var application_id: int = 123456789012345678
var client := DiscordClient.new()
func _ready() -> void:
client.set_application_id(application_id)
client.add_log_callback(_on_log, DiscordLoggingSeverity.INFO)
func _process(_delta: float) -> void:
Discord.run_callbacks()
func _on_log(message: String, severity: DiscordLoggingSeverity.Enum) -> void:
var enum_str: String = Discord.enum_to_string(severity, DiscordLoggingSeverity.id)
print("[%s] %s" % [enum_str, message])
|
References