Adds TTS logging when something goes wrong (#88841) (#2837)

## https://github.com/tgstation/tgstation/pull/88841

## About The Pull Request
Logs whenever there's a HTTP error on the DM side of TTS.

## Why It's Good For The Game

Can help identify bugs and errors.

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
This commit is contained in:
LT3
2025-01-03 14:36:06 -08:00
committed by GitHub
parent d726ccc4ea
commit 05fe0f31d2
5 changed files with 25 additions and 0 deletions

View File

@@ -129,6 +129,7 @@
#define LOG_CATEGORY_DEBUG_ASSET "debug-asset"
#define LOG_CATEGORY_DEBUG_JOB "debug-job"
#define LOG_CATEGORY_DEBUG_LUA "debug-lua"
#define LOG_CATEGORY_DEBUG_TTS "debug-tts"
#define LOG_CATEGORY_DEBUG_MAPPING "debug-mapping"
#define LOG_CATEGORY_DEBUG_MOBTAG "debug-mobtag"
#define LOG_CATEGORY_DEBUG_SQL "debug-sql"

View File

@@ -15,6 +15,10 @@
/proc/log_job_debug(text, list/data)
logger.Log(LOG_CATEGORY_DEBUG_JOB, text, data)
/// Logging for TTS
/proc/log_tts(text, list/data)
logger.Log(LOG_CATEGORY_DEBUG_TTS, text, data)
/// Logging for lua scripting
/proc/log_lua(text, list/data)
logger.Log(LOG_CATEGORY_DEBUG_LUA, text, data)

View File

@@ -181,6 +181,12 @@ SUBSYSTEM_DEF(tts)
var/identifier = current_request.identifier
if(current_request.requests_errored())
current_request.timed_out = TRUE
var/datum/http_response/normal_response = current_request.request.into_response()
var/datum/http_response/blips_response = current_request.request_blips.into_response()
log_tts("TTS HTTP request errored | Normal: [normal_response.error] | Blips: [blips_response.error]", list(
"normal" = normal_response,
"blips" = blips_response
))
continue
current_request.audio_length = text2num(response.headers["audio-length"]) * 10
if(!current_request.audio_length)

View File

@@ -80,3 +80,13 @@
var/errored = FALSE
var/error
/datum/http_response/serialize_list(list/options, list/semvers)
. = ..()
.["status_code"] = status_code
.["body"] = body
.["headers"] = headers
.["errored"] = errored
.["error"] = error
return .

View File

@@ -9,6 +9,10 @@
category = LOG_CATEGORY_DEBUG_LUA
master_category = /datum/log_category/debug
/datum/log_category/debug_tts
category = LOG_CATEGORY_DEBUG_TTS
master_category = /datum/log_category/debug
// This is not in the debug master category on purpose, do not add it
/datum/log_category/debug_runtime
category = LOG_CATEGORY_RUNTIME