Merge pull request #6334 from Citadel-Station-13/upstream-merge-36858

[MIRROR] Use a rust DLL for logging
This commit is contained in:
LetterJay
2018-04-12 07:06:08 -05:00
committed by GitHub
14 changed files with 157 additions and 164 deletions

View File

@@ -32,14 +32,12 @@ GLOBAL_LIST_INIT(admin_verbs_admin, world.AVerbsAdmin())
/datum/admins/proc/set_admin_notice, /*announcement all clients see when joining the server.*/
/client/proc/admin_ghost, /*allows us to ghost/reenter body at will*/
/client/proc/toggle_view_range, /*changes how far we can see*/
/datum/admins/proc/view_txt_log, /*shows the server log (world_game_log) for today*/
/datum/admins/proc/view_atk_log, /*shows the server combat-log, doesn't do anything presently*/
/client/proc/getserverlogs, /*for accessing server logs*/
/client/proc/cmd_admin_subtle_message, /*send an message to somebody as a 'voice in their head'*/
/client/proc/cmd_admin_delete, /*delete an instance/object/mob/etc*/
/client/proc/cmd_admin_check_contents, /*displays the contents of an instance*/
/client/proc/check_antagonists, /*shows all antags*/
/datum/admins/proc/access_news_network, /*allows access of newscasters*/
/client/proc/getserverlog, /*allows us to fetch server logs (world_game_log) for other days*/
/client/proc/jumptocoord, /*we ghost and jump to a coordinate*/
/client/proc/Getmob, /*teleports a mob to our location*/
/client/proc/Getkey, /*teleports a mob with a certain ckey to our location*/
@@ -182,8 +180,6 @@ GLOBAL_LIST_INIT(admin_verbs_hideable, list(
/datum/admins/proc/set_admin_notice,
/client/proc/admin_ghost,
/client/proc/toggle_view_range,
/datum/admins/proc/view_txt_log,
/datum/admins/proc/view_atk_log,
/client/proc/cmd_admin_subtle_message,
/client/proc/cmd_admin_check_contents,
/datum/admins/proc/access_news_network,

View File

@@ -1,9 +1,8 @@
//This proc allows download of past server logs saved within the data/logs/ folder.
//It works similarly to show-server-log.
/client/proc/getserverlog()
set name = ".getserverlog"
set desc = "Fetch logfiles from data/logs"
set category = null
/client/proc/getserverlogs()
set name = "Get Server Logs"
set desc = "View/retrieve logfiles."
set category = "Admin"
var/path = browse_files("data/logs/")
if(!path)
@@ -13,9 +12,7 @@
return
message_admins("[key_name_admin(src)] accessed file: [path]")
//this is copypasta because making it a proc would mean locking out adminproccalls,
// and that system is buggy enough with false positives that I don't want to risk locking admins out of legit calls.
switch(alert("View (in game), Open (in your system's text editor), or Download file [path]?", "Log File Opening", "View", "Open", "Download"))
switch(alert("View (in game), Open (in your system's text editor), or Download?", path, "View", "Open", "Download"))
if ("View")
src << browse("<pre style='word-wrap: break-word;'>[html_encode(file2text(file(path)))]</pre>", list2params(list("window" = "viewfile.[path]")))
if ("Open")
@@ -24,52 +21,5 @@
src << ftp(file(path))
else
return
to_chat(src, "Attempting to send file, this may take a fair few minutes if the file is very large.")
return
//Other log stuff put here for the sake of organisation
//Shows today's server log
/datum/admins/proc/view_txt_log()
set category = "Admin"
set name = "Show Server Log"
set desc = "Shows server log for this round."
if(fexists("[GLOB.world_game_log]"))
switch(alert("View (in game), Open (in your system's text editor), or Download file [GLOB.world_game_log]?", "Log File Opening", "View", "Open", "Download"))
if ("View")
src << browse("<pre style='word-wrap: break-word;'>[html_encode(file2text(GLOB.world_game_log))]</pre>", list2params(list("window" = "viewfile.[GLOB.world_game_log]")))
if ("Open")
src << run(GLOB.world_game_log)
if ("Download")
src << ftp(GLOB.world_game_log)
else
return
else
to_chat(src, "<font color='red'>Server log not found, try using .getserverlog.</font>")
return
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Server Log") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
return
//Shows today's attack log
/datum/admins/proc/view_atk_log()
set category = "Admin"
set name = "Show Server Attack Log"
set desc = "Shows server attack log for this round."
if(fexists("[GLOB.world_attack_log]"))
switch(alert("View (in game), Open (in your system's text editor), or Download file [GLOB.world_attack_log]?", "Log File Opening", "View", "Open", "Download"))
if ("View")
src << browse("<pre style='word-wrap: break-word;'>[html_encode(file2text(GLOB.world_attack_log))]</pre>", list2params(list("window" = "viewfile.[GLOB.world_attack_log]")))
if ("Open")
src << run(GLOB.world_attack_log)
if ("Download")
src << ftp(GLOB.world_attack_log)
else
return
else
to_chat(src, "<font color='red'>Server attack log not found, try using .getserverlog.</font>")
return
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Server Attack log") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
to_chat(src, "Attempting to send [path], this may take a fair few minutes if the file is very large.")
return