mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 17:17:31 -04:00
better logs and event names
This commit is contained in:
parent
6528dffe57
commit
83406350c0
6 changed files with 22 additions and 19 deletions
|
@ -43,17 +43,17 @@ func gate_open(url: String) -> Dictionary:
|
|||
return event
|
||||
|
||||
|
||||
func gate_enter(url: String, download_time: float) -> Dictionary:
|
||||
var event = base("gate_enter")
|
||||
func gate_load(url: String, download_time: float) -> Dictionary:
|
||||
var event = base("gate_load")
|
||||
event.gate_url = url
|
||||
event.download_time = download_time
|
||||
return event
|
||||
|
||||
|
||||
func first_frame(url: String, loading_time: float) -> Dictionary:
|
||||
var event = base("first_frame")
|
||||
func gate_start(url: String, bootup_time: float) -> Dictionary:
|
||||
var event = base("gate_start")
|
||||
event.gate_url = url
|
||||
event.loading_time = loading_time
|
||||
event.bootup_time = bootup_time
|
||||
return event
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ class_name AnalyticsSenderGate
|
|||
@export var gate_events: GateEvents
|
||||
|
||||
var gate_open_tick: int
|
||||
var gate_enter_tick: int
|
||||
var gate_load_tick: int
|
||||
var gate_url: String
|
||||
|
||||
|
||||
|
@ -13,8 +13,8 @@ func start() -> void:
|
|||
|
||||
gate_events.search.connect(send_search)
|
||||
gate_events.open_gate.connect(send_gate_open)
|
||||
gate_events.gate_entered.connect(send_gate_enter)
|
||||
gate_events.first_frame.connect(send_first_frame)
|
||||
gate_events.gate_loaded.connect(func(_gate): send_gate_load())
|
||||
gate_events.first_frame.connect(send_gate_start)
|
||||
gate_events.exit_gate.connect(send_gate_exit)
|
||||
|
||||
# Send latest exit event
|
||||
|
@ -38,15 +38,17 @@ func send_gate_open(url: String) -> void:
|
|||
analytics.send_event(AnalyticsEvents.gate_open(url))
|
||||
|
||||
|
||||
func send_gate_enter() -> void:
|
||||
func send_gate_load() -> void:
|
||||
var download_time = get_delta_sec(gate_open_tick)
|
||||
gate_enter_tick = Time.get_ticks_msec()
|
||||
analytics.send_event(AnalyticsEvents.gate_enter(gate_url, download_time))
|
||||
gate_load_tick = Time.get_ticks_msec()
|
||||
analytics.send_event(AnalyticsEvents.gate_load(gate_url, download_time))
|
||||
Debug.logclr("Download time: %.3f" % [download_time], Color.AQUAMARINE)
|
||||
|
||||
|
||||
func send_first_frame() -> void:
|
||||
var loading_time = get_delta_sec(gate_enter_tick)
|
||||
analytics.send_event(AnalyticsEvents.first_frame(gate_url, loading_time))
|
||||
func send_gate_start() -> void:
|
||||
var bootup_time = get_delta_sec(gate_load_tick)
|
||||
analytics.send_event(AnalyticsEvents.gate_start(gate_url, bootup_time))
|
||||
Debug.logclr("Bootup time: %.3f" % [bootup_time], Color.AQUAMARINE)
|
||||
|
||||
|
||||
func send_gate_exit() -> void:
|
||||
|
|
|
@ -92,6 +92,7 @@ func create_request(url: String, save_path: String, timeout: float = 0) -> int:
|
|||
var download_request = DownloadRequest.new(save_path, http, timer)
|
||||
download_requests.append(download_request)
|
||||
|
||||
Debug.logclr("Downloading " + url, Color.GRAY)
|
||||
var err = http.request(url)
|
||||
if err != OK: return err
|
||||
var code = (await http.request_completed)[1]
|
||||
|
|
|
@ -28,7 +28,7 @@ func load_gate(config_url: String) -> void:
|
|||
gate.resource_pack = await FileDownloader.download(c_gate.resource_pack_url)
|
||||
if gate.resource_pack.is_empty(): return error(GateEvents.GateError.MISSING_PACK)
|
||||
|
||||
Debug.logclr("Downloading GDExtension libraries: " + str(c_gate.libraries), Color.DIM_GRAY)
|
||||
Debug.logclr("GDExtension libraries: " + str(c_gate.libraries), Color.DIM_GRAY)
|
||||
for lib in c_gate.libraries:
|
||||
gate.shared_libs_dir = await FileDownloader.download_shared_lib(lib, config_url)
|
||||
if gate.shared_libs_dir.is_empty(): return error(GateEvents.GateError.MISSING_LIBS)
|
||||
|
|
|
@ -45,7 +45,7 @@ func create_external_texture() -> void:
|
|||
ext_texure = ExternalTexture.new()
|
||||
var err = ext_texure.create(t_format, t_view)
|
||||
if err: Debug.logerr("Cannot create external texture")
|
||||
else: Debug.logclr("External texture created", Color.AQUAMARINE)
|
||||
else: Debug.logclr("External texture created", Color.DIM_GRAY)
|
||||
|
||||
|
||||
func send_filehandle(filehandle_path: String) -> void:
|
||||
|
|
|
@ -42,7 +42,7 @@ func start_sandbox_linux(gate: Gate) -> void:
|
|||
]
|
||||
if OS.is_stdout_verbose(): args += ["--verbose"]
|
||||
|
||||
Debug.logclr(snbx_env.start + " " + " ".join(args), Color.DARK_VIOLET)
|
||||
Debug.logclr(snbx_env.start + " " + " ".join(args), Color.DIM_GRAY)
|
||||
sandbox_pid = OS.create_process(snbx_env.start, args)
|
||||
|
||||
gate_events.gate_entered_emit()
|
||||
|
@ -63,7 +63,7 @@ func start_sandbox_windows(gate: Gate) -> void:
|
|||
if not shared_libs.is_empty(): args += ["--gdext-libs-dir", shared_libs]
|
||||
if OS.is_stdout_verbose(): args += ["--verbose"]
|
||||
|
||||
Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DARK_VIOLET)
|
||||
Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DIM_GRAY)
|
||||
sandbox_pid = OS.create_process(snbx_executable.path, args)
|
||||
|
||||
gate_events.gate_entered_emit()
|
||||
|
@ -82,7 +82,7 @@ func start_sandbox_macos(gate: Gate) -> void:
|
|||
if not shared_libs.is_empty(): args += ["--gdext-libs-dir", shared_libs]
|
||||
if OS.is_stdout_verbose(): args += ["--verbose"]
|
||||
|
||||
Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DARK_VIOLET)
|
||||
Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DIM_GRAY)
|
||||
sandbox_pid = OS.create_process(snbx_executable.path, args)
|
||||
|
||||
gate_events.gate_entered_emit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue