Add AdminRanks prefix to logs related to adminranks

Add debug logs to API to figure out API issue with "missing" parameter
This commit is contained in:
Werner
2020-08-10 15:00:40 +02:00
parent a8bfac34ef
commit d2c886cb33
2 changed files with 23 additions and 18 deletions

View File

@@ -107,13 +107,15 @@ var/list/forum_groupids_to_ranks = list()
//find the client for a ckey if they are connected and associate them with the new admin datum
D.associate(directory[ckey])
log_debug("AdminRanks: Upaded Admins from Legacy System")
else
//The current admin system uses SQL
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
error("Failed to connect to database in load_admins(). Reverting to legacy system.")
log_misc("Failed to connect to database in load_admins(). Reverting to legacy system.")
error("AdminRanks: Failed to connect to database in load_admins(). Reverting to legacy system.")
log_misc("AdminRanks: Failed to connect to database in load_admins(). Reverting to legacy system.")
config.admin_legacy_system = 1
load_admins()
return
@@ -132,8 +134,8 @@ var/list/forum_groupids_to_ranks = list()
D.associate(directory[ckey])
if(!admin_datums)
error("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
log_misc("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
error("AdminRanks: The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
log_misc("AdminRanks: The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
config.admin_legacy_system = 1
load_admins()
return
@@ -165,7 +167,7 @@ var/list/forum_groupids_to_ranks = list()
set background = TRUE
if (!establish_db_connection(dbcon))
log_and_message_admins("Failed to connect to database in update_admins_from_api(). Carrying on with old staff lists.")
log_and_message_admins("AdminRanks: Failed to connect to database in update_admins_from_api(). Carrying on with old staff lists.")
return FALSE
var/list/admins_to_push = list()
@@ -183,7 +185,7 @@ var/list/forum_groupids_to_ranks = list()
if (resp.errored)
crash_with("Role request errored for id [rank.group_id] with: [resp.error]")
log_and_message_admins("Loading admins from forumuser API FAILED. Please alert web-service maintainers immediately!")
log_and_message_admins("AdminRanks: Loading admins from forumuser API FAILED. Please alert web-service maintainers immediately!")
return FALSE
for (var/datum/forum_user/user in resp.body)
@@ -201,6 +203,8 @@ var/list/forum_groupids_to_ranks = list()
if (reload_once_done)
load_admins()
log_debug("AdminRanks: Updated Admins from ForumUserAPI")
return TRUE
/proc/insert_user_to_admins_table(datum/forum_user/user)

View File

@@ -42,6 +42,7 @@
missing_params += param["name"]
if(errorcount)
log_debug("API: Request aborted. Required parameters missing")
log_debug("API: Received the following params: [json_encode(queryparams)]")
statuscode = 400
response = "Required params missing"
data = missing_params