From 0960d8d6c1a35cb9eb25b83c9f19218147e06c67 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Fri, 3 Apr 2020 10:57:12 +0200 Subject: [PATCH] Remove the subsystem and replace it with a glob --- code/__DEFINES/subsystems.dm | 3 +-- code/_globalvars/logging.dm | 2 ++ code/datums/log_viewer.dm | 4 ++-- .../subsystem => datums}/logging.dm | 17 +++++++---------- code/modules/mob/mob.dm | 2 +- paradise.dme | 2 +- 6 files changed, 14 insertions(+), 16 deletions(-) rename code/{controllers/subsystem => datums}/logging.dm (63%) diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index e9dee4a149a..300d3a41fc0 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -45,8 +45,7 @@ // Subsystems shutdown in the reverse of the order they initialize in // The numbers just define the ordering, they are meaningless otherwise. -#define INIT_ORDER_GARBAGE 20 -#define INIT_ORDER_LOGGING 19 +#define INIT_ORDER_GARBAGE 19 #define INIT_ORDER_DBCORE 18 #define INIT_ORDER_BLACKBOX 17 #define INIT_ORDER_SERVER_MAINT 16 diff --git a/code/_globalvars/logging.dm b/code/_globalvars/logging.dm index 0ea513708a1..631d356af0b 100644 --- a/code/_globalvars/logging.dm +++ b/code/_globalvars/logging.dm @@ -32,4 +32,6 @@ GLOBAL_PROTECT(IClog) GLOBAL_LIST_EMPTY(OOClog) GLOBAL_PROTECT(OOClog) +GLOBAL_DATUM_INIT(logging, /datum/logging, new /datum/logging()) + GLOBAL_LIST_INIT(investigate_log_subjects, list("notes", "watchlist", "hrefs")) diff --git a/code/datums/log_viewer.dm b/code/datums/log_viewer.dm index 5084feb1a9f..aafaccf0f14 100644 --- a/code/datums/log_viewer.dm +++ b/code/datums/log_viewer.dm @@ -36,7 +36,7 @@ if(!result || result.ckey != __ckey){\ for(var/ckey in ckeys) for(var/log_type in selected_log_types) - var/list/logs = SSlogging.get_logs_by_type(ckey, log_type) + var/list/logs = GLOB.logging.get_logs_by_type(ckey, log_type) var/len_logs = length(logs) if(len_logs) var/start_index = get_earliest_log_index(logs) @@ -237,7 +237,7 @@ if(!result || result.ckey != __ckey){\ A.on_close(CALLBACK(src, .proc/add_mob, usr)) return if(href_list["add_ckey"]) - var/list/ckeys = SSlogging.get_ckeys_logged() + var/list/ckeys = GLOB.logging.get_ckeys_logged() var/datum/async_input/A = input_autocomplete_async(usr, "Please, select a ckey: ", ckeys) A.on_close(CALLBACK(src, .proc/add_ckey, usr)) return diff --git a/code/controllers/subsystem/logging.dm b/code/datums/logging.dm similarity index 63% rename from code/controllers/subsystem/logging.dm rename to code/datums/logging.dm index 916cc509629..3c6a6a8e9e0 100644 --- a/code/controllers/subsystem/logging.dm +++ b/code/datums/logging.dm @@ -1,12 +1,9 @@ -SUBSYSTEM_DEF(logging) - name = "Logging" - priority = INIT_ORDER_LOGGING - flags = SS_NO_FIRE +/datum/logging var/list/datum/log_record/logs = list() // Assoc list of assoc lists (ckey, (log_type, list/logs)) -/datum/controller/subsystem/logging/proc/add_log(ckey, datum/log_record/log) +/datum/logging/proc/add_log(ckey, datum/log_record/log) if(!ckey) - log_debug("SSLogging.add_log called with an invalid ckey") + log_debug("GLOB.logging.add_log called with an invalid ckey") return if(!logs[ckey]) @@ -20,7 +17,7 @@ SUBSYSTEM_DEF(logging) var/list/datum/log_record/log_records = log_types_list[log.log_type] log_records.Add(log) -/datum/controller/subsystem/logging/proc/get_ckeys_logged() +/datum/logging/proc/get_ckeys_logged() var/list/ckeys = list() for(var/ckey in logs) ckeys.Add(ckey) @@ -29,12 +26,12 @@ SUBSYSTEM_DEF(logging) /* Returns the logs of a given ckey and log_type * If no logs exist it will return an empty list */ -/datum/controller/subsystem/logging/proc/get_logs_by_type(ckey, log_type) +/datum/logging/proc/get_logs_by_type(ckey, log_type) if(!ckey) - log_debug("SSLogging.get_logs_by_type called with an invalid ckey") + log_debug("GLOB.logging.get_logs_by_type called with an invalid ckey") return if(!log_type || !(log_type in ALL_LOGS)) - log_debug("SSLogging.get_logs_by_type called with an invalid log_type '[log_type]'") + log_debug("GLOB.logging.get_logs_by_type called with an invalid log_type '[log_type]'") return var/list/log_types_list = logs[ckey] diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 33bef79fba1..49a4351d6cf 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1272,7 +1272,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ if(ckey[1] == "@") // Admin aghosting will do this real_ckey = copytext(ckey, 2) var/datum/log_record/record = new(log_type, src, what, target, where, world.time) - SSlogging.add_log(real_ckey, record) + GLOB.logging.add_log(real_ckey, record) /proc/create_log_in_list(list/target, text, collapse = TRUE, last_log)//forgive me code gods for this shitcode proc //this proc enables lovely stuff like an attack log that looks like this: "[18:20:29-18:20:45]21x John Smith attacked Andrew Jackson with a crowbar." diff --git a/paradise.dme b/paradise.dme index 9ce3187a1d9..f07289a2a42 100644 --- a/paradise.dme +++ b/paradise.dme @@ -226,7 +226,6 @@ #include "code\controllers\subsystem\ipintel.dm" #include "code\controllers\subsystem\jobs.dm" #include "code\controllers\subsystem\lighting.dm" -#include "code\controllers\subsystem\logging.dm" #include "code\controllers\subsystem\machinery.dm" #include "code\controllers\subsystem\mapping.dm" #include "code\controllers\subsystem\medals.dm" @@ -267,6 +266,7 @@ #include "code\datums\hud.dm" #include "code\datums\log_record.dm" #include "code\datums\log_viewer.dm" +#include "code\datums\logging.dm" #include "code\datums\mind.dm" #include "code\datums\mixed.dm" #include "code\datums\mutable_appearance.dm"