Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up some errant logging warnings. #27834

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions code/__HELPERS/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/mob_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
if(istype(MT))
MT.create_log(DEFENSE_LOG, what_done, user, get_turf(MT))
MT.create_attack_log("<font color='orange'>Attacked by [user_str]: [what_done]</font>")
log_attack(user_str, target_str, what_done)
log_attack(user, target_str, what_done)

var/loglevel = ATKLOG_MOST
if(!isnull(custom_level))
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/SSjobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down
13 changes: 8 additions & 5 deletions code/datums/log_record.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<br><font color='red'>FORCED</font> 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 = "<br><font color='red'>FORCED</font> by [get_subject_text(usr, _log_type)]"
else if(usr != _who)
who_usr = "<br><font color='red'>FORCED</font> by [get_subject_text(usr, _log_type)]"
what = _what
target = get_subject_text(_target, _log_type)
if(!istext(_where) && !isturf(_where))
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading