From 9d042cb1636b12137ea46e6209b08407738467d4 Mon Sep 17 00:00:00 2001 From: "FunnyMan3595 (Charlie Nolan)" Date: Sun, 5 Jan 2025 03:54:00 +0000 Subject: [PATCH] Clean up some errant logging warnings. --- code/__HELPERS/_logging.dm | 6 +++--- code/__HELPERS/mob_helpers.dm | 2 +- code/controllers/subsystem/SSjobs.dm | 4 ++-- code/datums/log_record.dm | 13 ++++++++----- code/modules/mob/mob.dm | 4 ++-- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index e83d53fae57f..3a9de40c9e59 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -52,7 +52,7 @@ GLOBAL_PROTECT(log_end) rustg_log_write(GLOB.world_game_log, "VOTE: [text][GLOB.log_end]") /proc/log_if_mismatch(mob/who, message) - if(!isnull(usr) && usr != who) + if(!isnull(usr) && istype(who) && usr.last_known_ckey != who.last_known_ckey) rustg_log_write(GLOB.world_game_log, "LOG USER MISMATCH: [usr.simple_info_line()] was usr for [message][GLOB.log_end]") /proc/log_access_in(client/new_client) @@ -103,9 +103,9 @@ GLOBAL_PROTECT(log_end) rustg_log_write(GLOB.world_game_log, "[message][GLOB.log_end]") log_if_mismatch(speaker, message) -/proc/log_attack(attacker, defender, attack_message) +/proc/log_attack(mob/attacker, defender_str, attack_message) if(GLOB.configuration.logging.attack_logging) - var/message = "ATTACK: [attacker] against [defender]: [attack_message]" + var/message = "ATTACK: [attacker.simple_info_line()] against [defender_str]: [attack_message]" rustg_log_write(GLOB.world_game_log, "[message][GLOB.log_end]") log_if_mismatch(attacker, message) diff --git a/code/__HELPERS/mob_helpers.dm b/code/__HELPERS/mob_helpers.dm index 88668d23bc0e..23e6df82eedd 100644 --- a/code/__HELPERS/mob_helpers.dm +++ b/code/__HELPERS/mob_helpers.dm @@ -304,7 +304,7 @@ if(istype(MT)) MT.create_log(DEFENSE_LOG, what_done, user, get_turf(MT)) MT.create_attack_log("Attacked by [user_str]: [what_done]") - log_attack(user_str, target_str, what_done) + log_attack(user, target_str, what_done) var/loglevel = ATKLOG_MOST if(!isnull(custom_level)) diff --git a/code/controllers/subsystem/SSjobs.dm b/code/controllers/subsystem/SSjobs.dm index 304399e86790..43454e6db682 100644 --- a/code/controllers/subsystem/SSjobs.dm +++ b/code/controllers/subsystem/SSjobs.dm @@ -561,7 +561,7 @@ SUBSYSTEM_DEF(jobs) H.update_nearsighted_effects() if(joined_late || job.admin_only) - H.create_log(MISC_LOG, "Spawned as \an [H.dna?.species ? H.dna.species : "Undefined species"] named [H]. [joined_late ? "Joined during the round" : "Roundstart joined"] as job: [rank].") + H.create_log(MISC_LOG, "Spawned as \an [H.dna?.species ? H.dna.species : "Undefined species"] named [H]. [joined_late ? "Joined during the round" : "Roundstart joined"] as job: [rank].", force_no_usr_check=TRUE) addtimer(CALLBACK(src, TYPE_PROC_REF(/datum/controller/subsystem/jobs, show_location_blurb), H.client, H.mind), 1 SECONDS) //Moment for minds to boot up / people to load in return H if(late_arrivals_spawning) @@ -576,7 +576,7 @@ SUBSYSTEM_DEF(jobs) liver_multiplier = 5 H.Sleeping(5 SECONDS) H.Drunk((2 / liver_multiplier) MINUTES) - H.create_log(MISC_LOG, "Spawned as \an [H.dna?.species ? H.dna.species : "Undefined species"] named [H]. Roundstart joined as job: [rank].") + H.create_log(MISC_LOG, "Spawned as \an [H.dna?.species ? H.dna.species : "Undefined species"] named [H]. Roundstart joined as job: [rank].", force_no_usr_check=TRUE) addtimer(CALLBACK(src, TYPE_PROC_REF(/datum/controller/subsystem/jobs, show_location_blurb), H.client, H.mind), 1 SECONDS) //Moment for minds to boot up / people to load in return H diff --git a/code/datums/log_record.dm b/code/datums/log_record.dm index 5e672410aef1..20b7ea1e086e 100644 --- a/code/datums/log_record.dm +++ b/code/datums/log_record.dm @@ -7,14 +7,17 @@ var/target // Who/what was targeted var/where // Where did it happen -/datum/log_record/New(_log_type, _who, _what, _target, _where, _raw_time) +/datum/log_record/New(_log_type, _who, _what, _target, _where, _raw_time, force_no_usr_check) log_type = _log_type who = get_subject_text(_who, _log_type) - if(!isnull(usr) && usr != _who) - who_usr = "
FORCED by [get_subject_text(usr, _log_type)]" - else - who_usr = "" + who_usr = "" + if(!isnull(usr) && !force_no_usr_check) + if(log_type == DEFENSE_LOG) + if(usr != _target) + who_usr = "
FORCED by [get_subject_text(usr, _log_type)]" + else if(usr != _who) + who_usr = "
FORCED by [get_subject_text(usr, _log_type)]" what = _what target = get_subject_text(_target, _log_type) if(!istext(_where) && !isturf(_where)) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index fc64f8ba80dc..d672c2a22918 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1134,13 +1134,13 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ LAZYINITLIST(debug_log) create_log_in_list(debug_log, text, collapse, world.timeofday) -/mob/proc/create_log(log_type, what, target = null, turf/where = get_turf(src)) +/mob/proc/create_log(log_type, what, target = null, turf/where = get_turf(src), force_no_usr_check = FALSE) if(!ckey) return var/real_ckey = ckey 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) + var/datum/log_record/record = new(log_type, src, what, target, where, world.time, force_no_usr_check) 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