mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 04:51:32 +01:00
Better logging (#16164)
* Initial * Cleared duplicates * More work, get rid of log_error * more * log_debug() to macro LOG_DEBUG * More work * More * Guh * Maybe better? * More work * gah * Dear lord * *inserts swears here* * gdi * More work * More * dear lord * fsdfsdafs * rsdaf * sadfasf * sdafsad * fgsd * small fuckup fix * jfsd * sdafasf * gdi * sdfa * sfdafgds * sdafasdvf * sdfasdfg * sdfsga * asdf * dsfasfsagf * ihibhbjh * fsadf * adfas * sdafsad * sdfasd * fsda * vhb * asf * for arrow * removed source file-line logging, added header for tgui
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
// We aren't loading this category. Bye.
|
||||
if (role_type && !(sql_role & role_type))
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER LOAD: Bad role_type, returned. Looking for: [role_type], had: [sql_role]. Conjunction: [sql_role & role_type].")
|
||||
LOG_DEBUG("SQL CHARACTER LOAD: Bad role_type, returned. Looking for: [role_type], had: [sql_role]. Conjunction: [sql_role & role_type].")
|
||||
#endif
|
||||
return
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
query += ";"
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER LOAD: Cached query [query] with variables [json_encode(var_names)]")
|
||||
LOG_DEBUG("SQL CHARACTER LOAD: Cached query [query] with variables [json_encode(var_names)]")
|
||||
#endif
|
||||
// Save it.
|
||||
query_cache[type][query] = var_names
|
||||
@@ -90,21 +90,21 @@
|
||||
var/list/arg_list = gather_load_parameters()
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER LOAD: Started loading with arguments: [json_encode(arg_list)]. Role type: [role_type]")
|
||||
LOG_DEBUG("SQL CHARACTER LOAD: Started loading with arguments: [json_encode(arg_list)]. Role type: [role_type]")
|
||||
#endif
|
||||
|
||||
for (var/query_text in query_cache[type])
|
||||
var/DBQuery/query = dbcon.NewQuery(query_text)
|
||||
query.Execute(arg_list)
|
||||
if (query.ErrorMsg())
|
||||
log_error("SQL CHARACTER LOAD: SQL query error: [query.ErrorMsg()]")
|
||||
log_debug("SQL CHARACTER LOAD: query args: [json_encode(arg_list)]")
|
||||
log_world("ERROR: SQL CHARACTER LOAD: SQL query error: [query.ErrorMsg()]")
|
||||
LOG_DEBUG("SQL CHARACTER LOAD: query args: [json_encode(arg_list)]")
|
||||
|
||||
continue
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
else
|
||||
log_debug("SQL CHARACTER LOAD: Successfully executed query: [query_text]")
|
||||
LOG_DEBUG("SQL CHARACTER LOAD: Successfully executed query: [query_text]")
|
||||
#endif
|
||||
|
||||
// Each query should only return exactly 1 row.
|
||||
@@ -118,8 +118,8 @@
|
||||
else
|
||||
cc.preferences.vars[layers[1]][layers[2]] = query.item[i]
|
||||
catch(var/exception/e)
|
||||
log_error("SQL CHARACTER LOAD: bad variable name: [e.name]")
|
||||
log_debug("SQL CHARACTER LOAD: var name: [var_names[i]]")
|
||||
log_world("ERROR: SQL CHARACTER LOAD: bad variable name: [e.name]")
|
||||
LOG_DEBUG("SQL CHARACTER LOAD: var name: [var_names[i]]")
|
||||
|
||||
/datum/category_group/player_setup_category/proc/gather_load_parameters()
|
||||
var/list/arg_list = list()
|
||||
@@ -140,7 +140,7 @@
|
||||
// We aren't loading this category. Bye.
|
||||
if (role_type && !(sql_role & role_type))
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Bad role_type, returned. Looking for: [role_type], had: [sql_role]. Conjunction: [sql_role & role_type].")
|
||||
LOG_DEBUG("SQL CHARACTER SAVE: Bad role_type, returned. Looking for: [role_type], had: [sql_role]. Conjunction: [sql_role & role_type].")
|
||||
#endif
|
||||
return
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
query = replacetext(query, ",", "", length(query) - 1)
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Cached query [query].")
|
||||
LOG_DEBUG("SQL CHARACTER SAVE: Cached query [query].")
|
||||
#endif
|
||||
|
||||
// Save it.
|
||||
@@ -205,7 +205,7 @@
|
||||
var/list/arg_list = gather_save_parameters()
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Started saving with arguments: [json_encode(arg_list)]. Role type: [role_type]")
|
||||
LOG_DEBUG("SQL CHARACTER SAVE: Started saving with arguments: [json_encode(arg_list)]. Role type: [role_type]")
|
||||
#endif
|
||||
|
||||
// Typecast the collection so we can access its preferences var.
|
||||
@@ -215,14 +215,14 @@
|
||||
query.Execute(arg_list)
|
||||
|
||||
if (query.ErrorMsg())
|
||||
log_error("SQL CHARACTER SAVE: SQL query error: [query.ErrorMsg()]")
|
||||
log_debug("SQL CHARACTER SAVE: query args: [json_encode(arg_list)]")
|
||||
log_world("ERROR: SQL CHARACTER SAVE: SQL query error: [query.ErrorMsg()]")
|
||||
LOG_DEBUG("SQL CHARACTER SAVE: query args: [json_encode(arg_list)]")
|
||||
|
||||
continue
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
else
|
||||
log_debug("SQL CHARACTER SAVE: Successfully executed query: [query_text]")
|
||||
LOG_DEBUG("SQL CHARACTER SAVE: Successfully executed query: [query_text]")
|
||||
#endif
|
||||
|
||||
if ((role_type & SQL_CHARACTER) && !cc.preferences.current_character)
|
||||
@@ -237,13 +237,13 @@
|
||||
cc.preferences.current_character = text2num(query.item[1])
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Successfully set character ID to [cc.preferences.current_character]")
|
||||
LOG_DEBUG("SQL CHARACTER SAVE: Successfully set character ID to [cc.preferences.current_character]")
|
||||
#endif
|
||||
|
||||
else
|
||||
log_error("SQL CHARACTER SAVE: New ID was not recovered.")
|
||||
log_world("ERROR: SQL CHARACTER SAVE: New ID was not recovered.")
|
||||
if (query.ErrorMsg())
|
||||
log_error("SQL CHARACTER SAVE: SQL query error from last_insert_id: [query.ErrorMsg()]")
|
||||
log_world("ERROR: SQL CHARACTER SAVE: SQL query error from last_insert_id: [query.ErrorMsg()]")
|
||||
|
||||
/datum/category_group/player_setup_category/proc/gather_save_parameters()
|
||||
var/list/arg_list = list()
|
||||
|
||||
Reference in New Issue
Block a user