From 5feb05eedd7d39ef624fabe007dde9db3962d539 Mon Sep 17 00:00:00 2001 From: Francinum <5572280+francinum@users.noreply.github.com> Date: Sat, 30 Mar 2024 20:12:51 -0400 Subject: [PATCH 1/4] Various debug messaging improvements --- code/__DEFINES/chat.dm | 16 ---- code/__DEFINES/debug_messaging.dm | 8 ++ code/__DEFINES/span.dm | 4 + code/__HELPERS/debug_messaging.dm | 75 +++++++++++++++++++ code/controllers/master.dm | 6 +- code/controllers/subsystem.dm | 5 +- code/controllers/subsystem/airmachines.dm | 8 +- code/controllers/subsystem/job.dm | 2 +- code/controllers/subsystem/mapping.dm | 10 +-- code/controllers/subsystem/ticker.dm | 5 +- code/modules/admin/IsBanned.dm | 2 +- code/modules/admin/admin_verbs.dm | 2 +- code/modules/admin/ipintel.dm | 6 +- code/modules/admin/verbs/adminhelp.dm | 4 +- .../kitchen_machinery/processor.dm | 4 +- code/modules/reagents/chemistry/recipes.dm | 2 +- code/modules/shuttle/shuttle.dm | 2 +- daedalus.dme | 2 + .../tgui-panel/styles/goon/chat-dark.scss | 38 ++++++++++ .../tgui-panel/styles/goon/chat-light.scss | 38 ++++++++++ 20 files changed, 194 insertions(+), 45 deletions(-) create mode 100644 code/__DEFINES/debug_messaging.dm create mode 100644 code/__HELPERS/debug_messaging.dm diff --git a/code/__DEFINES/chat.dm b/code/__DEFINES/chat.dm index 78a3c993b2c3..c96598ae7292 100644 --- a/code/__DEFINES/chat.dm +++ b/code/__DEFINES/chat.dm @@ -18,19 +18,3 @@ #define MESSAGE_TYPE_ADMINLOG "adminlog" #define MESSAGE_TYPE_ATTACKLOG "attacklog" #define MESSAGE_TYPE_DEBUG "debug" - -//debug printing macros (for development and testing) -/// Used for debug messages to the world -#define debug_world(msg) if (GLOB.Debug2) to_chat(world, \ - type = MESSAGE_TYPE_DEBUG, \ - text = "DEBUG: [msg]") -/// Used for debug messages to the player -#define debug_usr(msg) if (GLOB.Debug2&&usr) to_chat(usr, \ - type = MESSAGE_TYPE_DEBUG, \ - text = "DEBUG: [msg]") -/// Used for debug messages to the admins -#define debug_admins(msg) if (GLOB.Debug2) to_chat(GLOB.admins, \ - type = MESSAGE_TYPE_DEBUG, \ - text = "DEBUG: [msg]") -/// Used for debug messages to the server -#define debug_world_log(msg) if (GLOB.Debug2) log_world("DEBUG: [msg]") diff --git a/code/__DEFINES/debug_messaging.dm b/code/__DEFINES/debug_messaging.dm new file mode 100644 index 000000000000..dca0096bd8df --- /dev/null +++ b/code/__DEFINES/debug_messaging.dm @@ -0,0 +1,8 @@ +#define DBG_TRACE "trace" +#define DBG_INFO "info" +#define DBG_WARN "warn" +#define DBG_ERROR "error" + +#define DBG_LOG_WORLD (1 << 0) +#define DBG_STACK_TRACE (1 << 1) +#define DBG_ALWAYS (1 << 2) diff --git a/code/__DEFINES/span.dm b/code/__DEFINES/span.dm index fdda4b38fe9e..45cfd8e1938d 100644 --- a/code/__DEFINES/span.dm +++ b/code/__DEFINES/span.dm @@ -40,6 +40,10 @@ #define span_danger(str) ("" + str + "") #define span_deadsay(str) ("" + str + "") #define span_debug(str) ("" + str + "") +#define span_debug_trace(str) ("" + str + "") +#define span_debug_info(str) ("" + str + "") +#define span_debug_warn(str) ("" + str + "") +#define span_debug_error(str) ("" + str + "") #define span_deconversion_message(str) ("" + str + "") #define span_drone(str) ("" + str + "") #define span_engradio(str) ("" + str + "") diff --git a/code/__HELPERS/debug_messaging.dm b/code/__HELPERS/debug_messaging.dm new file mode 100644 index 000000000000..4af6470e8074 --- /dev/null +++ b/code/__HELPERS/debug_messaging.dm @@ -0,0 +1,75 @@ +/* Helpers for Debug Messaging + * + * Log Levels conform to standard Unix expectations. + * All have the same argument set + * + * Messages are built as follows + * $PREFIX: $MESSAGE + * + * Messages are passed to chat only when the running server is in debug (is_debug_server), or live debugging has been enabled (GLOB.Debug2) + * Messages are passed globally on debug servers, otherwise Messages are passed to admins if live debugging is enabled. + * The single exception is TRACE level messages, which REQUIRE live debugging, this is to decrease general noise. + * + * - level | Log level, controls the message border's color. Traces are only sent to chat when Live Debugging is enabled. + * - DBG_TRACE: white | Spammy stuff, raw values of a calculation, etc. + * - DBG_INFO: blue (default) | State changes, progress indications, Etc. + * - DBG_WARN: orange | An issue has been handled cleanly, or something isn't right, but not enough to cause a problem for players. + * - DBG_ERROR: red | Errors. Something has gone wrong and you're probably just about to bail out of the proc. Consider throwing a stack as well. + + * + * - prefix | Describes the sending system, Examples: Packets/IRPS, Jobs/AssignCaptain + * - default: "DEBUG" + * + * - message | The actual content of the message. + * - Required. + * + * - additional | Additional actions to take. Bitfield. + * - DBG_LOG_WORLD (default) | call log_world with message. + * - DBG_STACK_TRACE | Throw a stack trace. + * - DBG_ALWAYS | Send regardless of debug status. + * + */ + +/proc/message_debug(level = DBG_INFO, prefix = "DEBUG", message, additional = DBG_LOG_WORLD) + // If we're a trace message and debugging is not enabled, return immediately. + // or we aren't being forced to send regardless. + if(level == DBG_TRACE && !GLOB.Debug2 && !(additional & DBG_ALWAYS)) + return + // No message, No Service. + if(!message) + CRASH("Debug message without message? Wack.") + + /// Built message with prefix. + var/built_message = "[prefix]: [message]" + + /// Severity span class to use. + var/severity_class + switch(level) + if(DBG_TRACE) + severity_class = "debug_trace" + if(DBG_INFO) + severity_class = "debug_info" + if(DBG_WARN) + severity_class = "debug_warn" + if(DBG_ERROR) + severity_class = "debug_error" + else + message_debug(DBG_ERROR, "DebugMessage/Severity", "Invalid severity level [level]. Setting to error.", DBG_STACK_TRACE) + level = DBG_ERROR + severity_class = "debug_error" + + // Check if we throw a stack trace. + if(additional & DBG_STACK_TRACE) + stack_trace("[level]| [built_message]") + // Log to world. + if(additional & DBG_LOG_WORLD) + log_world("[level]| [built_message]") + + //Do we sent this, and to who? + //Trace requires Debug2 explicitly. + if((additional & DBG_ALWAYS) || GLOB.Debug2 || (GLOB.is_debug_server && (level != DBG_TRACE))) + to_chat( + target = (GLOB.is_debug_server ? world : GLOB.admins), + type = MESSAGE_TYPE_DEBUG, + html = "
[built_message]
" + ) diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 7d45061efeee..8a6f38046456 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -199,7 +199,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new current_runlevel = Master.current_runlevel StartProcessing(10) else - to_chat(world, span_boldannounce("The Master Controller is having some issues, we will need to re-initialize EVERYTHING")) + to_chat(world, span_debug_error("The Master Controller is having some issues, we will need to re-initialize EVERYTHING")) Initialize(20, TRUE) @@ -248,7 +248,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new current_initializing_subsystem = subsystem if(GLOB.is_debug_server) - to_chat(world, span_boldnotice("Initializing [subsystem.name]...")) + message_debug(DBG_INFO, "MC/Initialize","Initializing [subsystem.name]") subsystem.Initialize(REALTIMEOFDAY) CHECK_TICK @@ -293,7 +293,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new if(isnull(old_runlevel)) old_runlevel = "NULL" - testing("MC: Runlevel changed from [old_runlevel] to [new_runlevel]") + message_debug(DBG_INFO, "MC/Runlevel", "Runlevel changed from [old_runlevel] to [new_runlevel]") current_runlevel = log(2, new_runlevel) + 1 if(current_runlevel < 1) CRASH("Attempted to set invalid runlevel: [new_runlevel]") diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm index 6df943ac3f64..289a422c1270 100644 --- a/code/controllers/subsystem.dm +++ b/code/controllers/subsystem.dm @@ -277,8 +277,9 @@ var/time = (REALTIMEOFDAY - start_timeofday) / 10 var/msg = "Initialized [name] subsystem within [time] second[time == 1 ? "" : "s"]!" if(GLOB.is_debug_server) - to_chat(world, span_debug("[msg]")) - log_world(msg) + message_debug(DBG_INFO, "MC/Initialize", msg) + else + log_world(msg) return time /datum/controller/subsystem/stat_entry(msg) diff --git a/code/controllers/subsystem/airmachines.dm b/code/controllers/subsystem/airmachines.dm index 2b001286defb..2ddb2d0df0b8 100644 --- a/code/controllers/subsystem/airmachines.dm +++ b/code/controllers/subsystem/airmachines.dm @@ -25,13 +25,13 @@ SUBSYSTEM_DEF(airmachines) /datum/controller/subsystem/airmachines/Initialize(timeofday) var/starttime = REALTIMEOFDAY - to_chat(world, span_debug("Airmachines: Setting up atmospheric machinery...")) + to_chat(world, span_debug_info("Airmachines: Setting up atmospheric machinery...")) setup_atmos_machinery() - to_chat(world, span_debug("Airmachines: Airmachine setup completed in [(REALTIMEOFDAY- starttime) / 10] seconds!")) + to_chat(world, span_debug_info("Airmachines: Airmachine setup completed in [(REALTIMEOFDAY- starttime) / 10] seconds!")) starttime = REALTIMEOFDAY - to_chat(world, span_debug("Airmachines: Creating pipenets...")) + to_chat(world, span_debug_info("Airmachines: Creating pipenets...")) setup_pipenets() - to_chat(world, span_debug("Airmachines: Pipenet creation completed in [(REALTIMEOFDAY- starttime) / 10] seconds!")) + to_chat(world, span_debug_info("Airmachines: Pipenet creation completed in [(REALTIMEOFDAY- starttime) / 10] seconds!")) return ..() /datum/controller/subsystem/airmachines/stat_entry(msg) diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 4e6bf8b9d330..ebaf45ab223f 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -119,7 +119,7 @@ SUBSYSTEM_DEF(job) if(!job.config_check()) continue if(!job.map_check()) //Even though we initialize before mapping, this is fine because the config is loaded at new - testing("Removed [job.type] due to map config") + message_debug(DBG_INFO, "SSJob/SetupOccupations", "Removed [job.type] due to map config.") continue new_all_occupations += job name_occupations[job.title] = job diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 742568af6948..20572ca4aaaa 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -294,7 +294,7 @@ Used by the AI doomsday and the self-destruct nuke. z_list = SSmapping.z_list multiz_levels = SSmapping.multiz_levels -#define INIT_ANNOUNCE(X) to_chat(world, span_debug("[X]")); log_world(X) +#define INIT_ANNOUNCE(X) to_chat(world, X); log_world(X) /datum/controller/subsystem/mapping/proc/LoadGroup(list/errorList, name, path, files, list/traits, list/default_traits, silent = FALSE) . = list() var/start_time = REALTIMEOFDAY @@ -319,7 +319,7 @@ Used by the AI doomsday and the self-destruct nuke. for (var/i in 1 to total_z) traits += list(default_traits) else if (total_z != traits.len) // mismatch - INIT_ANNOUNCE("WARNING: [traits.len] trait sets specified for [total_z] z-levels in [path]!") + message_debug(DBG_WARN, "SSMapping/LoadGroup", "[traits.len] trait sets specified for [total_z] z-levels in [path]!", DBG_ALWAYS | DBG_LOG_WORLD) if (total_z < traits.len) // ignore extra traits traits.Cut(total_z + 1) while (total_z > traits.len) // fall back to defaults on extra levels @@ -342,7 +342,7 @@ Used by the AI doomsday and the self-destruct nuke. errorList |= pm.original_path if(!silent) - INIT_ANNOUNCE("Loaded [name] in [(REALTIMEOFDAY - start_time)/10]s!") + INIT_ANNOUNCE(span_debug_info("Loaded [name] in [(REALTIMEOFDAY - start_time)/10]s!")) return parsed_maps /datum/controller/subsystem/mapping/proc/loadWorld() @@ -354,7 +354,7 @@ Used by the AI doomsday and the self-destruct nuke. // load the station station_start = world.maxz + 1 - INIT_ANNOUNCE("Loading [config.map_name]...") + INIT_ANNOUNCE(span_debug_info("Loading [config.map_name]...")) LoadGroup(FailedZs, "Station", config.map_path, config.map_file, config.traits, ZTRAITS_STATION) if(SSdbcore.Connect()) @@ -377,7 +377,7 @@ Used by the AI doomsday and the self-destruct nuke. for(var/I in 2 to FailedZs.len) msg += ", [FailedZs[I]]" msg += ". Yell at your server host!" - INIT_ANNOUNCE(msg) + INIT_ANNOUNCE(span_debug_error(msg)) #undef INIT_ANNOUNCE // Custom maps are removed after station loading so the map files does not persist for no reason. diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index dd81d82d3c50..512a9f70b79a 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -229,7 +229,10 @@ SUBSYSTEM_DEF(ticker) SSjob.ResetOccupations() return FALSE else - message_admins(span_notice("DEBUG: Bypassing prestart checks...")) + if(can_continue) + message_debug(DBG_INFO, "SSTicker/setup", "Roundstart checks were skipped, but would have passed anyways.") + else + message_debug(DBG_WARN, "SSTicket/setup", "Roundstart checks failed. Bypassing due to live debugging.") CHECK_TICK diff --git a/code/modules/admin/IsBanned.dm b/code/modules/admin/IsBanned.dm index b61bcc59542c..87156ac626d7 100644 --- a/code/modules/admin/IsBanned.dm +++ b/code/modules/admin/IsBanned.dm @@ -7,7 +7,7 @@ #define STICKYBAN_MAX_ADMIN_MATCHES 1 /world/IsBanned(key, address, computer_id, type, real_bans_only=FALSE) - debug_world_log("isbanned(): '[args.Join("', '")]'") + message_debug(DBG_TRACE, "World/IsBanned", "[args.Join("', '")]", NONE) if (!key || (!real_bans_only && (!address || !computer_id))) if(real_bans_only) return FALSE diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 2322eac3cc33..8fffb7c5c144 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -845,7 +845,7 @@ GLOBAL_PROTECT(admin_verbs_hideable) if (tile) var/mob/living/carbon/human/hooman = new(tile) hooman.equipOutfit(pick(subtypesof(/datum/outfit))) - testing("Spawned test mob at [COORD(tile)]") + message_debug(DBG_TRACE, "PopulateWorld", "Spawned test mob at [COORD(tile)]") while (!area && --j > 0) /client/proc/toggle_AI_interact() diff --git a/code/modules/admin/ipintel.dm b/code/modules/admin/ipintel.dm index 71c9a11acd53..f40bc15dac97 100644 --- a/code/modules/admin/ipintel.dm +++ b/code/modules/admin/ipintel.dm @@ -129,8 +129,4 @@ SSipintel.throttle = world.timeofday + (10 * 120 * SSipintel.errors) else error += " Attempting retry on [ip]." - log_ipintel(error) - -/proc/log_ipintel(text) - log_game("IPINTEL: [text]") - debug_admins("IPINTEL: [text]") + message_debug(DBG_ERROR, "IPIntel", error) diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 17cb13dda57d..6a5ee2f32bb6 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -888,7 +888,7 @@ GLOBAL_DATUM_INIT(admin_help_ui_handler, /datum/admin_help_ui_handler, new) */ /proc/send2otherserver(source, msg, type = "Ahelp", target_servers, list/additional_data = list()) if(!CONFIG_GET(string/comms_key)) - debug_world_log("Server cross-comms message not sent for lack of configured key") + message_debug(DBG_TRACE, "WorldComms/send2otherserver", "Server cross-comms message not sent for lack of configured key") return var/our_id = CONFIG_GET(string/cross_comms_name) @@ -911,7 +911,7 @@ GLOBAL_DATUM_INIT(admin_help_ui_handler, /datum/admin_help_ui_handler, new) if (auth) var/comms_key = CONFIG_GET(string/comms_key) if(!comms_key) - debug_world_log("Server cross-comms message not sent for lack of configured key") + message_debug(DBG_TRACE, "WorldComms/send_cross_comms", "Server cross-comms message not sent for lack of configured key") return message["key"] = comms_key var/list/servers = CONFIG_GET(keyed_list/cross_server) diff --git a/code/modules/food_and_drinks/kitchen_machinery/processor.dm b/code/modules/food_and_drinks/kitchen_machinery/processor.dm index 871fa54ed9b9..c01455ea4d92 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/processor.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/processor.dm @@ -132,7 +132,7 @@ for(var/atom/movable/movable_input as anything in processor_contents) var/datum/food_processor_process/recipe = PROCESSOR_SELECT_RECIPE(movable_input) if (!recipe) - log_admin("DEBUG: [movable_input] in processor doesn't have a suitable recipe. How did it get in there? Please report it immediately!!!") + message_debug(DBG_ERROR, "FoodProcessor/interact", "[movable_input] in processor doesn't have a suitable recipe. Make a bug report.", DBG_ALWAYS | DBG_LOG_WORLD) continue total_time += recipe.time var/offset = prob(50) ? -2 : 2 @@ -141,7 +141,7 @@ for(var/atom/movable/O in processor_contents) var/datum/food_processor_process/P = PROCESSOR_SELECT_RECIPE(O) if (!P) - log_admin("DEBUG: [O] in processor doesn't have a suitable recipe. How do you put it in?") + message_debug(DBG_ERROR, "FoodProcessor/interact", "[O] in processor doesn't have a suitable recipe. Make a bug report.", DBG_ALWAYS | DBG_LOG_WORLD) continue process_food(P, O) pixel_x = base_pixel_x //return to its spot after shaking diff --git a/code/modules/reagents/chemistry/recipes.dm b/code/modules/reagents/chemistry/recipes.dm index 09a01902178b..457234c316c7 100644 --- a/code/modules/reagents/chemistry/recipes.dm +++ b/code/modules/reagents/chemistry/recipes.dm @@ -358,7 +358,7 @@ var/turf/target = locate(holder_turf.x + equilibrium.data["[id]_x"], holder_turf.y + equilibrium.data["[id]_y"], holder_turf.z) //new /obj/effect/hotspot(target) target.create_fire(1, 10) - debug_world("X: [equilibrium.data["[id]_x"]], Y: [equilibrium.data["[id]_x"]]") + message_debug(DBG_TRACE, "ChemReact/FireVortex", "X: [equilibrium.data["[id]_x"]], Y: [equilibrium.data["[id]_x"]]", NONE) /* * Creates a square of fire in a fire_range radius, diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 48ba0afa1aa6..72d32ae9e043 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -543,7 +543,7 @@ //call the shuttle to destination S /obj/docking_port/mobile/proc/request(obj/docking_port/stationary/S) if(!check_dock(S)) - testing("check_dock failed on request for [src]") + message_debug(DBG_TRACE, "DockingPort/request", "check_dock failed on request for [src]") return if(mode == SHUTTLE_IGNITING && destination == S) diff --git a/daedalus.dme b/daedalus.dme index 20a1ed09c8ea..28b25bf4d705 100644 --- a/daedalus.dme +++ b/daedalus.dme @@ -69,6 +69,7 @@ #include "code\__DEFINES\credits.dm" #include "code\__DEFINES\cult.dm" #include "code\__DEFINES\database.dm" +#include "code\__DEFINES\debug_messaging.dm" #include "code\__DEFINES\decal_defines.dm" #include "code\__DEFINES\devices.dm" #include "code\__DEFINES\direction_junctions.dm" @@ -345,6 +346,7 @@ #include "code\__HELPERS\construction.dm" #include "code\__HELPERS\dates.dm" #include "code\__HELPERS\datums.dm" +#include "code\__HELPERS\debug_messaging.dm" #include "code\__HELPERS\dna.dm" #include "code\__HELPERS\files.dm" #include "code\__HELPERS\filters.dm" diff --git a/tgui/packages/tgui-panel/styles/goon/chat-dark.scss b/tgui/packages/tgui-panel/styles/goon/chat-dark.scss index 847db519af02..c466f7341143 100644 --- a/tgui/packages/tgui-panel/styles/goon/chat-dark.scss +++ b/tgui/packages/tgui-panel/styles/goon/chat-dark.scss @@ -980,7 +980,45 @@ em { .debug { color: #5ce43d; + background-color: black; font-weight: bold; + font-family: monospace; + border: 1px groove grey; + width: 80ch; + margin-top: 1px; + margin-bottom: 1px; +} + +.debug_trace{ + border-color: grey; +} +.debug_trace::before { + content: "TRACE|"; + color:grey; +} + +.debug_info { + border-color: cyan; +} +.debug_info::before { + content: "INFO|"; + color:cyan; +} + +.debug_warn { + border-color: orange; +} +.debug_warn::before { + content: "WARN|"; + color:orange; +} + +.debug_error { + border-color: red; +} +.debug_error::before { + content: "ERROR|"; + color:red; } .adminpmbox { diff --git a/tgui/packages/tgui-panel/styles/goon/chat-light.scss b/tgui/packages/tgui-panel/styles/goon/chat-light.scss index 9b3ac66c6d5c..41b11058e058 100644 --- a/tgui/packages/tgui-panel/styles/goon/chat-light.scss +++ b/tgui/packages/tgui-panel/styles/goon/chat-light.scss @@ -980,7 +980,45 @@ h1.alert, h2.alert { .debug { color: #5ce43d; + background-color: black; font-weight: bold; + font-family: monospace; + border: 1px groove grey; + width: 80ch; + margin-top: 1px; + margin-bottom: 1px; +} + +.debug_trace{ + border-color: grey; +} +.debug_trace::before { + content: "TRACE|"; + color:grey; +} + +.debug_info { + border-color: cyan; +} +.debug_info::before { + content: "INFO|"; + color:cyan; +} + +.debug_warn { + border-color: orange; +} +.debug_warn::before { + content: "WARN|"; + color:orange; +} + +.debug_error { + border-color: red; +} +.debug_error::before { + content: "ERROR|"; + color:red; } .adminpmbox { From 34490159ec63759219eb0e85f95974f000c7dbeb Mon Sep 17 00:00:00 2001 From: Francinum <5572280+francinum@users.noreply.github.com> Date: Sat, 30 Mar 2024 20:33:25 -0400 Subject: [PATCH 2/4] Address Review --- code/__DEFINES/span.dm | 11 ++++--- code/__HELPERS/debug_messaging.dm | 14 ++++---- code/controllers/master.dm | 2 +- code/controllers/subsystem.dm | 5 ++- code/controllers/subsystem/airmachines.dm | 8 ++--- code/controllers/subsystem/mapping.dm | 8 ++--- code/controllers/subsystem/zas.dm | 10 +++--- .../tgui-panel/styles/goon/chat-dark.scss | 28 ++++++++-------- .../tgui-panel/styles/goon/chat-light.scss | 33 +++++++++++-------- 9 files changed, 62 insertions(+), 57 deletions(-) diff --git a/code/__DEFINES/span.dm b/code/__DEFINES/span.dm index 45cfd8e1938d..50124a379cbf 100644 --- a/code/__DEFINES/span.dm +++ b/code/__DEFINES/span.dm @@ -39,11 +39,12 @@ #define span_cultlarge(str) ("" + str + "") #define span_danger(str) ("" + str + "") #define span_deadsay(str) ("" + str + "") -#define span_debug(str) ("" + str + "") -#define span_debug_trace(str) ("" + str + "") -#define span_debug_info(str) ("" + str + "") -#define span_debug_warn(str) ("" + str + "") -#define span_debug_error(str) ("" + str + "") +#define span_debug_legacy(str) ("" + str + "") +#define span_debug_basic(str) ("" + str + "") +#define span_debug_trace(str) ("" + str + "") +#define span_debug_info(str) ("" + str + "") +#define span_debug_warn(str) ("" + str + "") +#define span_debug_error(str) ("" + str + "") #define span_deconversion_message(str) ("" + str + "") #define span_drone(str) ("" + str + "") #define span_engradio(str) ("" + str + "") diff --git a/code/__HELPERS/debug_messaging.dm b/code/__HELPERS/debug_messaging.dm index 4af6470e8074..eb692f01de71 100644 --- a/code/__HELPERS/debug_messaging.dm +++ b/code/__HELPERS/debug_messaging.dm @@ -46,24 +46,24 @@ var/severity_class switch(level) if(DBG_TRACE) - severity_class = "debug_trace" + severity_class = "debugTrace" if(DBG_INFO) - severity_class = "debug_info" + severity_class = "debugInfo" if(DBG_WARN) - severity_class = "debug_warn" + severity_class = "debugWarn" if(DBG_ERROR) - severity_class = "debug_error" + severity_class = "debugError" else message_debug(DBG_ERROR, "DebugMessage/Severity", "Invalid severity level [level]. Setting to error.", DBG_STACK_TRACE) level = DBG_ERROR - severity_class = "debug_error" + severity_class = "debugError" // Check if we throw a stack trace. if(additional & DBG_STACK_TRACE) - stack_trace("[level]| [built_message]") + stack_trace("[level] | [built_message]") // Log to world. if(additional & DBG_LOG_WORLD) - log_world("[level]| [built_message]") + log_world("[level] | [built_message]") //Do we sent this, and to who? //Trace requires Debug2 explicitly. diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 8a6f38046456..17ee2ce73ca6 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -248,7 +248,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new current_initializing_subsystem = subsystem if(GLOB.is_debug_server) - message_debug(DBG_INFO, "MC/Initialize","Initializing [subsystem.name]") + to_chat(world, span_boldnotice("Initializing [subsystem.name]...")) subsystem.Initialize(REALTIMEOFDAY) CHECK_TICK diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm index 289a422c1270..74c03dfa17f4 100644 --- a/code/controllers/subsystem.dm +++ b/code/controllers/subsystem.dm @@ -277,9 +277,8 @@ var/time = (REALTIMEOFDAY - start_timeofday) / 10 var/msg = "Initialized [name] subsystem within [time] second[time == 1 ? "" : "s"]!" if(GLOB.is_debug_server) - message_debug(DBG_INFO, "MC/Initialize", msg) - else - log_world(msg) + to_chat(world, span_debug_legacy("[msg]")) + log_world(msg) return time /datum/controller/subsystem/stat_entry(msg) diff --git a/code/controllers/subsystem/airmachines.dm b/code/controllers/subsystem/airmachines.dm index 2ddb2d0df0b8..0fbaaf48bbb0 100644 --- a/code/controllers/subsystem/airmachines.dm +++ b/code/controllers/subsystem/airmachines.dm @@ -25,13 +25,13 @@ SUBSYSTEM_DEF(airmachines) /datum/controller/subsystem/airmachines/Initialize(timeofday) var/starttime = REALTIMEOFDAY - to_chat(world, span_debug_info("Airmachines: Setting up atmospheric machinery...")) + to_chat(world, span_debug_legacy("Airmachines: Setting up atmospheric machinery...")) setup_atmos_machinery() - to_chat(world, span_debug_info("Airmachines: Airmachine setup completed in [(REALTIMEOFDAY- starttime) / 10] seconds!")) + to_chat(world, span_debug_legacy("Airmachines: Airmachine setup completed in [(REALTIMEOFDAY- starttime) / 10] seconds!")) starttime = REALTIMEOFDAY - to_chat(world, span_debug_info("Airmachines: Creating pipenets...")) + to_chat(world, span_debug_legacy("Airmachines: Creating pipenets...")) setup_pipenets() - to_chat(world, span_debug_info("Airmachines: Pipenet creation completed in [(REALTIMEOFDAY- starttime) / 10] seconds!")) + to_chat(world, span_debug_legacy("Airmachines: Pipenet creation completed in [(REALTIMEOFDAY- starttime) / 10] seconds!")) return ..() /datum/controller/subsystem/airmachines/stat_entry(msg) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 20572ca4aaaa..1080720c180c 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -294,7 +294,7 @@ Used by the AI doomsday and the self-destruct nuke. z_list = SSmapping.z_list multiz_levels = SSmapping.multiz_levels -#define INIT_ANNOUNCE(X) to_chat(world, X); log_world(X) +#define INIT_ANNOUNCE(X) to_chat(world, span_debug_legacy("[X]")); log_world(X) /datum/controller/subsystem/mapping/proc/LoadGroup(list/errorList, name, path, files, list/traits, list/default_traits, silent = FALSE) . = list() var/start_time = REALTIMEOFDAY @@ -342,7 +342,7 @@ Used by the AI doomsday and the self-destruct nuke. errorList |= pm.original_path if(!silent) - INIT_ANNOUNCE(span_debug_info("Loaded [name] in [(REALTIMEOFDAY - start_time)/10]s!")) + INIT_ANNOUNCE("Loaded [name] in [(REALTIMEOFDAY - start_time)/10]s!") return parsed_maps /datum/controller/subsystem/mapping/proc/loadWorld() @@ -354,7 +354,7 @@ Used by the AI doomsday and the self-destruct nuke. // load the station station_start = world.maxz + 1 - INIT_ANNOUNCE(span_debug_info("Loading [config.map_name]...")) + INIT_ANNOUNCE("Loading [config.map_name]...") LoadGroup(FailedZs, "Station", config.map_path, config.map_file, config.traits, ZTRAITS_STATION) if(SSdbcore.Connect()) @@ -377,7 +377,7 @@ Used by the AI doomsday and the self-destruct nuke. for(var/I in 2 to FailedZs.len) msg += ", [FailedZs[I]]" msg += ". Yell at your server host!" - INIT_ANNOUNCE(span_debug_error(msg)) + INIT_ANNOUNCE(msg) #undef INIT_ANNOUNCE // Custom maps are removed after station loading so the map files does not persist for no reason. diff --git a/code/controllers/subsystem/zas.dm b/code/controllers/subsystem/zas.dm index 21665efa555b..6561a2915c61 100644 --- a/code/controllers/subsystem/zas.dm +++ b/code/controllers/subsystem/zas.dm @@ -170,7 +170,7 @@ SUBSYSTEM_DEF(zas) settings = zas_settings gas_data = xgm_gas_data - to_chat(world, span_debug("ZAS: Processing Geometry...")) + to_chat(world, span_debug_legacy("ZAS: Processing Geometry...")) var/simulated_turf_count = 0 @@ -183,17 +183,17 @@ SUBSYSTEM_DEF(zas) CHECK_TICK - to_chat(world, span_debug("ZAS:\n - Total Simulated Turfs: [simulated_turf_count]\n - Total Zones: [zones.len]\n - Total Edges: [edges.len]\n - Total Active Edges: [active_edges.len ? "[active_edges.len]" : "None"]\n - Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_count]")) + to_chat(world, span_debug_legacy("ZAS:\n - Total Simulated Turfs: [simulated_turf_count]\n - Total Zones: [zones.len]\n - Total Edges: [edges.len]\n - Total Active Edges: [active_edges.len ? "[active_edges.len]" : "None"]\n - Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_count]")) - to_chat(world, span_debug("ZAS: Geometry processing completed in [(REALTIMEOFDAY - starttime)/10] seconds!")) + to_chat(world, span_debug_legacy("ZAS: Geometry processing completed in [(REALTIMEOFDAY - starttime)/10] seconds!")) if (simulate) - to_chat(world, span_debug("ZAS: Firing once...")) + to_chat(world, span_debug_legacy("ZAS: Firing once...")) starttime = REALTIMEOFDAY fire(FALSE, TRUE) - to_chat(world, span_debug("ZAS: Air settling completed in [(REALTIMEOFDAY - starttime)/10] seconds!")) + to_chat(world, span_debug_legacy("ZAS: Air settling completed in [(REALTIMEOFDAY - starttime)/10] seconds!")) ..(timeofday) diff --git a/tgui/packages/tgui-panel/styles/goon/chat-dark.scss b/tgui/packages/tgui-panel/styles/goon/chat-dark.scss index c466f7341143..2b0165fe1928 100644 --- a/tgui/packages/tgui-panel/styles/goon/chat-dark.scss +++ b/tgui/packages/tgui-panel/styles/goon/chat-dark.scss @@ -985,39 +985,39 @@ em { font-family: monospace; border: 1px groove grey; width: 80ch; - margin-top: 1px; - margin-bottom: 1px; + padding: 1px 4px 1px 4px; + margin: 0 2px 0 0; } -.debug_trace{ +.debugTrace{ border-color: grey; } -.debug_trace::before { - content: "TRACE|"; +.debugTrace::before { + content: "TRACE |"; color:grey; } -.debug_info { +.debugInfo { border-color: cyan; } -.debug_info::before { - content: "INFO|"; +.debugInfo::before { + content: "INFO |"; color:cyan; } -.debug_warn { +.debugWarn { border-color: orange; } -.debug_warn::before { - content: "WARN|"; +.debugWarn::before { + content: "WARN |"; color:orange; } -.debug_error { +.debugError { border-color: red; } -.debug_error::before { - content: "ERROR|"; +.debugError::before { + content: "ERROR |"; color:red; } diff --git a/tgui/packages/tgui-panel/styles/goon/chat-light.scss b/tgui/packages/tgui-panel/styles/goon/chat-light.scss index 41b11058e058..d47325b355ec 100644 --- a/tgui/packages/tgui-panel/styles/goon/chat-light.scss +++ b/tgui/packages/tgui-panel/styles/goon/chat-light.scss @@ -978,6 +978,11 @@ h1.alert, h2.alert { color: #2e2e2e; } +.debugLegacy { + color: #5ce43d; + font-weight: bold; +} + .debug { color: #5ce43d; background-color: black; @@ -985,39 +990,39 @@ h1.alert, h2.alert { font-family: monospace; border: 1px groove grey; width: 80ch; - margin-top: 1px; - margin-bottom: 1px; + padding: 1px 4px 1px 4px; + margin: 0 2px 0 0; } -.debug_trace{ +.debugTrace{ border-color: grey; } -.debug_trace::before { - content: "TRACE|"; +.debugTrace::before { + content: "TRACE |"; color:grey; } -.debug_info { +.debugInfo { border-color: cyan; } -.debug_info::before { - content: "INFO|"; +.debugInfo::before { + content: "INFO |"; color:cyan; } -.debug_warn { +.debugWarn { border-color: orange; } -.debug_warn::before { - content: "WARN|"; +.debugWarn::before { + content: "WARN |"; color:orange; } -.debug_error { +.debugError { border-color: red; } -.debug_error::before { - content: "ERROR|"; +.debugError::before { + content: "ERROR |"; color:red; } From cf0b25ea991837b79813e8786c8432254abe0999 Mon Sep 17 00:00:00 2001 From: Francinum <5572280+francinum@users.noreply.github.com> Date: Fri, 26 Apr 2024 00:55:00 -0400 Subject: [PATCH 3/4] fuck --- code/controllers/subsystem/ticker.dm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 69fe9e2c946f..5251acc0f32b 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -732,7 +732,7 @@ SUBSYSTEM_DEF(ticker) ///The full datum of the last song used. var/datum/media/old_login_music - if(rustg_file_exists("data/last_round_lobby_music.txt")) //The define isn't truthy + if(rustg_file_exists("data/last_round_lobby_music.txt")) old_login_music_t = rustg_file_read("data/last_round_lobby_music.txt") var/list/music_tracks = title_music_data + rare_music_data //Filter map-specific tracks @@ -802,7 +802,7 @@ SUBSYSTEM_DEF(ticker) if(!mode) var/list/datum/game_mode/runnable_modes = draft_gamemodes() if(!runnable_modes.len) - message_admins(world, "No viable gamemodes to play. Running Extended.") + message_debug(DBG_WARN, "Ticker/init_gamemode", "No valid gamemodes. Extended has been forced.", DBG_ALWAYS | DBG_LOG_WORLD) mode = new /datum/game_mode/extended else mode = pick_weight(runnable_modes) @@ -842,7 +842,10 @@ SUBSYSTEM_DEF(ticker) SSjob.ResetOccupations() return FALSE else - message_admins(span_notice("DEBUG: Bypassing prestart checks...")) + if(can_continue) + message_debug(DBG_TRACE, "Ticker/init_gamemode", "Roundstart execution and occupation division were skipped, and would have passed anyways.") + else + message_debug(DBG_ERROR, "Ticker/init_gamemode", "Roundstart execution and occupation division were skipped, and at least one failed!") log_game("Gamemode successfully initialized, chose: [mode.name]") return TRUE From fc747dc744d45491ff069a47e278e23b85e98fca Mon Sep 17 00:00:00 2001 From: Gallyus <5572280+francinum@users.noreply.github.com> Date: Fri, 10 May 2024 13:47:22 -0400 Subject: [PATCH 4/4] Update chat-dark.scss --- tgui/packages/tgui-panel/styles/goon/chat-dark.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tgui/packages/tgui-panel/styles/goon/chat-dark.scss b/tgui/packages/tgui-panel/styles/goon/chat-dark.scss index 7bd26596019e..a6fd0e358a73 100644 --- a/tgui/packages/tgui-panel/styles/goon/chat-dark.scss +++ b/tgui/packages/tgui-panel/styles/goon/chat-dark.scss @@ -978,6 +978,11 @@ em { color : #bbbbad; } +.debugLegacy { + color: #5ce43d; + font-weight: bold; +} + .debug { color: #5ce43d; background-color: black;