Merge pull request #13685 from uomo91/adminlogging

Ports: Admins can now see chronological order of events in logging tabs.
This commit is contained in:
silicons
2020-11-25 22:21:34 -07:00
committed by GitHub
4 changed files with 32 additions and 13 deletions
+15 -10
View File
@@ -5,7 +5,7 @@
var/ntype = text2num(type)
//Add client links
var/dat = ""
var/list/dat = list()
if(M.client)
dat += "<center><p>Client</p></center>"
dat += "<center>"
@@ -46,22 +46,27 @@
var/log_source = M.logging;
if(source == LOGSRC_CLIENT && M.client) //if client doesn't exist just fall back to the mob log
log_source = M.client.player_details.logging //should exist, if it doesn't that's a bug, don't check for it not existing
var/list/concatenated_logs = list()
for(var/log_type in log_source)
var/nlog_type = text2num(log_type)
if(nlog_type & ntype)
var/list/reversed = log_source[log_type]
if(islist(reversed))
reversed = reverseRange(reversed.Copy())
for(var/entry in reversed)
dat += "<font size=2px><b>[entry]</b><br>[reversed[entry]]</font><br>"
dat += "<hr>"
var/list/all_the_entrys = log_source[log_type]
for(var/entry in all_the_entrys)
concatenated_logs += "<b>[entry]</b><br>[all_the_entrys[entry]]"
if(length(concatenated_logs))
sortTim(concatenated_logs, cmp = /proc/cmp_text_dsc) //Sort by timestamp.
dat += "<font size=2px>"
dat += concatenated_logs.Join("<br>")
dat += "</font>"
usr << browse(dat, "window=invidual_logging_[key_name(M)];size=600x480")
var/datum/browser/popup = new(usr, "invidual_logging_[key_name(M)]", "Individual Logs", 600, 600)
popup.set_content(dat.Join())
popup.open()
/proc/individual_logging_panel_link(mob/M, log_type, log_src, label, selected_src, selected_type)
var/slabel = label
if(selected_type == log_type && selected_src == log_src)
slabel = "<b>\[[label]\]</b>"
//This is necessary because num2text drops digits and rounds on big numbers. If more defines get added in the future it could break again.
log_type = num2text(log_type, MAX_BITFLAG_DIGITS)
return "<a href='?_src_=holder;[HrefToken()];individuallog=[REF(M)];log_type=[log_type];log_src=[log_src]'>[slabel]</a>"
+1 -1
View File
@@ -50,7 +50,7 @@ GLOBAL_VAR_INIT(normal_looc_colour, "#6699CC")
msg = emoji_parse(msg)
mob.log_talk(msg,LOG_OOC, tag="(LOOC)")
mob.log_talk(msg,LOG_OOC, tag="LOOC")
var/list/heard = get_hearers_in_view(7, get_top_level_mob(src.mob))
for(var/mob/M in heard)
+13 -2
View File
@@ -496,8 +496,19 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
colored_message = "<font color=[color]>[message]</font>"
else
colored_message = "<font color='[color]'>[message]</font>"
var/list/timestamped_message = list("[LAZYLEN(logging[smessage_type]) + 1]\[[TIME_STAMP("hh:mm:ss", FALSE)]\] [key_name(src)] [loc_name(src)]" = colored_message)
//This makes readability a bit better for admins.
switch(message_type)
if(LOG_WHISPER)
colored_message = "(WHISPER) [colored_message]"
if(LOG_OOC)
colored_message = "(OOC) [colored_message]"
if(LOG_ASAY)
colored_message = "(ASAY) [colored_message]"
if(LOG_EMOTE)
colored_message = "(EMOTE) [colored_message]"
var/list/timestamped_message = list("\[[TIME_STAMP("hh:mm:ss", FALSE)]\] [key_name(src)] [loc_name(src)]" = colored_message)
logging[smessage_type] += timestamped_message