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:
Fluffy
2023-08-05 21:53:11 +00:00
committed by GitHub
parent 40faa01587
commit b183188689
194 changed files with 1637 additions and 877 deletions
+6 -6
View File
@@ -7,7 +7,7 @@
return
if (!establish_db_connection(dbcon))
log_error("Ban database connection failure while attempting to mirror. Key passed for mirror handling: [ckey].")
log_world("ERROR: Ban database connection failure while attempting to mirror. Key passed for mirror handling: [ckey].")
log_misc("Ban database connection failure while attempting to mirror. Key passed for mirror handling: [ckey].")
return
@@ -49,7 +49,7 @@
return
else
log_error("No ban retreived while attempting to handle ban mirroring. Passed ban_id: [ban_id], ckey: [ckey].")
log_world("ERROR: No ban retreived while attempting to handle ban mirroring. Passed ban_id: [ban_id], ckey: [ckey].")
log_misc("No ban retreived while attempting to handle ban mirroring. Passed ban_id: [ban_id], ckey: [ckey].")
return
@@ -58,7 +58,7 @@
return null
if (!establish_db_connection(dbcon))
log_error("Ban database connection failure while attempting to check mirrors. Key passed for mirror checking: [ckey].")
log_world("ERROR: Ban database connection failure while attempting to check mirrors. Key passed for mirror checking: [ckey].")
log_misc("Ban database connection failure while attempting to check mirrors. Key passed for mirror checking: [ckey].")
return null
@@ -258,10 +258,10 @@
catch(var/exception/E)
data_object = list()
log_debug("CONN DATA: [E] encountered when loading data for [C.ckey].")
LOG_DEBUG("CONN DATA: [E] encountered when loading data for [C.ckey].")
if (!data_object || !data_object.len)
log_debug("CONN DATA: [C.ckey] has no connection data to showcase.")
LOG_DEBUG("CONN DATA: [C.ckey] has no connection data to showcase.")
return
if (data_object["vms"])
@@ -289,7 +289,7 @@
if (!conn_info || !conn_info.len)
return
else if (conn_info.len > 100)
log_debug("MIRROR BANS: [C.ckey] has [conn_info.len] unique sets. They were dropped and not processed.")
LOG_DEBUG("MIRROR BANS: [C.ckey] has [conn_info.len] unique sets. They were dropped and not processed.")
update_connection_data(C)
return
+1 -1
View File
@@ -52,7 +52,7 @@
if(!establish_db_connection(dbcon))
log_error("Ban database connection failure. Key [ckey] not checked")
log_world("ERROR: Ban database connection failure. Key [ckey] not checked")
log_misc("Ban database connection failure. Key [ckey] not checked")
return ..()
+3 -3
View File
@@ -39,9 +39,9 @@
src << browse(F,"window=investigate[subject];size=800x300")
if("hrefs") //persistant logs and stuff
if(config && config.log_hrefs)
if(href_logfile)
src << browse(href_logfile,"window=investigate[subject];size=800x300")
if(config && config.logsettings["log_hrefs"])
if(config.logfiles["world_href_log"])
src << browse(config.logfiles["world_href_log"], "window=investigate[subject];size=800x300")
else
to_chat(src, "<span class='warning'>Error: admin_investigate: No href logfile found.</span>")
return
+7 -7
View File
@@ -100,7 +100,7 @@ var/list/forum_groupids_to_ranks = list()
var/datum/admin_rank/rank_object = admin_ranks[rank]
if (!rank_object)
log_error("Unrecognized rank in admins.txt: \"[rank]\"")
log_world("ERROR: Unrecognized rank in admins.txt: \"[rank]\"")
continue
//create the admin datum and store it for later use
@@ -109,12 +109,12 @@ 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: Updated Admins from Legacy System")
LOG_DEBUG("AdminRanks: Updated Admins from Legacy System")
else
//The current admin system uses SQL
if(!establish_db_connection(dbcon))
log_error("AdminRanks: Failed to connect to database in load_admins(). Reverting to legacy system.")
log_world("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()
@@ -134,7 +134,7 @@ var/list/forum_groupids_to_ranks = list()
D.associate(directory[ckey])
if(!admin_datums)
log_error("AdminRanks: The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
log_world("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()
@@ -203,16 +203,16 @@ var/list/forum_groupids_to_ranks = list()
if (reload_once_done)
load_admins()
log_debug("AdminRanks: Updated Admins from ForumUserAPI")
LOG_DEBUG("AdminRanks: Updated Admins from ForumUserAPI")
return TRUE
/proc/insert_user_to_admins_table(datum/forum_user/user)
if(isnull(user.ckey))
log_debug("AdminRanks: [user.forum_name] does not have a ckey linked - Ignoring")
LOG_DEBUG("AdminRanks: [user.forum_name] does not have a ckey linked - Ignoring")
return
if(user.psync_game_disabled)
log_debug("AdminRanks: [user.forum_name] has permsync-game disabled - Ignoring")
LOG_DEBUG("AdminRanks: [user.forum_name] has permsync-game disabled - Ignoring")
return
var/rights = 0
+6 -14
View File
@@ -154,7 +154,6 @@ var/list/admin_verbs_server = list(
/datum/admins/proc/restart,
/datum/admins/proc/delay,
/datum/admins/proc/toggleaban,
/client/proc/toggle_log_hrefs,
/datum/admins/proc/immreboot,
/client/proc/everyone_random,
/datum/admins/proc/toggleAI,
@@ -179,6 +178,8 @@ var/list/admin_verbs_debug = list(
/client/proc/getruntimelog, // allows us to access runtime logs to somebody,
/client/proc/cmd_admin_list_open_jobs,
/client/proc/Debug2,
/client/proc/DebugToggle,
/client/proc/DebugToggleAll,
/client/proc/kill_air,
/client/proc/ZASSettings,
/client/proc/cmd_debug_make_powernets,
@@ -311,7 +312,6 @@ var/list/admin_verbs_hideable = list(
/client/proc/create_poll,
/client/proc/allow_stationbound_reset,
/client/proc/end_round,
/client/proc/toggle_log_hrefs,
/datum/admins/proc/immreboot,
/client/proc/cmd_dev_bst,
/client/proc/global_ao_regenerate,
@@ -359,6 +359,8 @@ var/list/admin_verbs_hideable = list(
/client/proc/cmd_admin_list_open_jobs,
/client/proc/reset_openturf,
/client/proc/Debug2,
/client/proc/DebugToggle,
/client/proc/DebugToggleAll,
/client/proc/ZASSettings,
/client/proc/cmd_debug_make_powernets,
/client/proc/debug_antagonist_template,
@@ -449,6 +451,8 @@ var/list/admin_verbs_dev = list( //will need to be altered - Ryan784
/client/proc/cmd_debug_make_powernets,
/client/proc/cmd_debug_mob_lists,
/client/proc/Debug2,
/client/proc/DebugToggle,
/client/proc/DebugToggleAll,
/client/proc/debug_controller,
/client/proc/debug_variables,
/client/proc/dsay,
@@ -800,18 +804,6 @@ var/list/admin_verbs_cciaa = list(
feedback_add_details("admin_verb","TAOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/toggle_log_hrefs()
set name = "Toggle href logging"
set category = "Server"
if(!holder) return
if(config)
if(config.log_hrefs)
config.log_hrefs = 0
to_chat(src, "<b>Stopped logging hrefs</b>")
else
config.log_hrefs = 1
to_chat(src, "<b>Started logging hrefs</b>")
/client/proc/check_ai_laws()
set name = "Check AI Laws"
set category = "Admin"
+2 -2
View File
@@ -180,7 +180,7 @@ var/list/jobban_keylist = list() // Global jobban list.
/proc/jobban_loaddatabase()
// No database. Weee.
if (!establish_db_connection(dbcon))
log_error("Database connection failed. Reverting to the legacy ban system.")
log_world("ERROR: Database connection failed. Reverting to the legacy ban system.")
log_misc("Database connection failed. Reverting to the legacy ban system.")
config.ban_legacy_system = 1
jobban_loadbanfile()
@@ -230,7 +230,7 @@ var/list/jobban_keylist = list() // Global jobban list.
CKEY_OR_MOB(ckey, player)
if (!ckey)
log_debug("JOBBAN: jobban_unban called without a mob and a backup ckey.")
LOG_DEBUG("JOBBAN: jobban_unban called without a mob and a backup ckey.")
return
// Check for a player record.
+1 -1
View File
@@ -20,7 +20,7 @@ var/list/admin_datums = list()
/datum/admins/New(initial_rank = "Temporary Admin", initial_rights = 0, ckey)
if(!ckey)
log_error("Admin datum created without a ckey argument. Datum has been deleted")
log_world("ERROR: Admin datum created without a ckey argument. Datum has been deleted")
qdel(src)
return
+1 -1
View File
@@ -126,4 +126,4 @@
/proc/log_ipintel(text)
log_game("IPINTEL: [text]")
log_debug("IPINTEL: [text]")
LOG_DEBUG("IPINTEL: [text]")
+4 -4
View File
@@ -36,7 +36,7 @@
return
if (!establish_db_connection(dbcon))
log_error("SQL connection failed while attempting to delete a note!")
log_world("ERROR: SQL connection failed while attempting to delete a note!")
return
var/count = 0 //failsafe from unban procs
@@ -52,12 +52,12 @@
if (count == 0)
to_chat(usr, "<span class='warning'>Database update failed due to a note id not being present in the database.</span>")
log_error("Database update failed due to a note id not being present in the database.")
log_world("ERROR: Database update failed due to a note id not being present in the database.")
return
if (count > 1)
to_chat(usr, "<span class='warning'>Database update failed due to multiple notes having the same ID. Contact the database admin.</span>")
log_error("Database update failed due to multiple notes having the same ID. Contact the database admin.")
log_world("ERROR: Database update failed due to multiple notes having the same ID. Contact the database admin.")
return
switch (note_edit)
@@ -92,7 +92,7 @@
admin_ckey = ckey(admin_ckey)
if (!establish_db_connection(dbcon))
log_error("SQL connection failed while attempting to view a player's notes!")
log_world("ERROR: SQL connection failed while attempting to view a player's notes!")
return
var/dat = "<div align='center'><h3>Notes Look-up Panel</h3><br>"
+3 -1
View File
@@ -122,7 +122,9 @@
bst.client.init_verbs()
log_debug("Bluespace Tech Spawned: X:[bst.x] Y:[bst.y] Z:[bst.z] User:[src]")
bst.client.init_verbs()
LOG_DEBUG("Bluespace Tech Spawned: X:[bst.x] Y:[bst.y] Z:[bst.z] User:[src]")
feedback_add_details("admin_verb","BST")
+2 -2
View File
@@ -333,7 +333,7 @@
try
templates = json_decode(return_file_text("config/templates_list.json"))
catch(var/exception/ej)
log_debug("Warning: Could not load the templates config as templates_list.json is missing - [ej]")
LOG_DEBUG("Warning: Could not load the templates config as templates_list.json is missing - [ej]")
return
if(!templates || !templates["templates_list"] || templates["templates_folder"] == "")
@@ -347,7 +347,7 @@
var/datum/map_template/maploader = new (templates["templates_folder"] + name, name)
if (!maploader)
log_debug("Error, unable to load maploader in proc load_template!")
LOG_DEBUG("Error, unable to load maploader in proc load_template!")
return
var/centered = input(user, "Do you want template to load as center or Edge?", "Load Template", null) as null|anything in list("Center", "Edge")
+26
View File
@@ -12,8 +12,34 @@
message_admins("[key_name(src)] toggled debugging on.")
log_admin("[key_name(src)] toggled debugging on.",admin_key=key_name(usr))
switch(alert("Do you want to print all logs to world? This should ONLY EVER HAPPEN IN CRISIS OR DURING DEBUGGING / DEVELOPMENT.", "All logs to world?", "No", "Yes"))
if("Yes")
config.all_logs_to_chat = 1
else
config.all_logs_to_chat = 0
feedback_add_details("admin_verb","DG2") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/DebugToggle()
set category = "Debug"
set name = "Debugs Toggle"
if(!check_rights(R_DEBUG|R_DEV)) return
var/target = input(usr, "Select which log to toggle", "Debugs Toggle", null) in sortAssoc(config.logsettings)
if(target)
config.logsettings[target] = !config.logsettings[target]
to_chat(usr, "The log category [target] is now [config.logsettings[target]]")
/client/proc/DebugToggleAll()
set category = "Debug"
set name = "Debugs Toggle ALL"
if(!check_rights(R_DEBUG|R_DEV)) return
switch(alert("Do you want to turn on ALL LOGS?.", "All logs to ON?", "No", "Yes"))
if("Yes")
for(var/k in config.logsettings)
config.logsettings[k] = TRUE
// callproc moved to code/modules/admin/callproc
+5 -5
View File
@@ -223,11 +223,11 @@
/client/proc/notifications_acknowledge(var/id)
if(!id)
log_error("Error: Argument ID for notificaton acknowledgement not supplied.")
log_world("ERROR: Error: Argument ID for notificaton acknowledgement not supplied.")
return
if (!establish_db_connection(dbcon))
log_error("Error: Unable to establish db connection during notification acknowledgement.")
log_world("ERROR: Unable to establish db connection during notification acknowledgement.")
return
var/DBQuery/query = dbcon.NewQuery({"UPDATE ss13_player_notifications
@@ -420,7 +420,7 @@
return
if (!establish_db_connection(dbcon))
log_error("Error: Unable to establish db connection while adding a notification.")
log_world("ERROR: Unable to establish db connection while adding a notification.")
return
var/ckey = ckey(input(usr, "What ckey?", "Enter a ckey"))
@@ -483,12 +483,12 @@
if (count == 0)
to_chat(usr, "<span class='warning'>Database update failed due to a warning id not being present in the database.</span>")
log_error("Database update failed due to a warning id not being present in the database.")
log_world("ERROR: Database update failed due to a warning id not being present in the database.")
return
if (count > 1)
to_chat(usr, "<span class='warning'>Database update failed due to multiple warnings having the same ID. Contact the database admin.</span>")
log_error("Database update failed due to multiple warnings having the same ID. Contact the database admin.")
log_world("ERROR: Database update failed due to multiple warnings having the same ID. Contact the database admin.")
return
switch (warning_edit)