Server logs (#17264)

* Ports TGs server log verb

* .

* those never worked

* we have tht just not as glob

* Update admin.dm

---------

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
Kashargul
2025-03-20 18:52:06 +01:00
committed by GitHub
parent 7fb4fc1338
commit ac99b78fc4
9 changed files with 153 additions and 137 deletions
@@ -45,8 +45,6 @@ var/list/admin_verbs_admin = list(
/client/proc/mark_datum_mapview, //VOREStation Add,
/client/proc/cmd_check_new_players, //allows us to see every new player, //VOREStation Add,
/client/proc/toggle_view_range, //changes how far we can see,
/datum/admins/proc/view_txt_log, //shows the server log (diary) for today,
/datum/admins/proc/view_atk_log, //shows the server combat-log, doesn't do anything presently,
/client/proc/cmd_admin_pm_context, //right-click adminPM interface,
/client/proc/cmd_admin_pm_panel, //admin-pm list,
/client/proc/cmd_admin_subtle_message, //send an message to somebody as a 'voice in their head',
@@ -55,7 +53,6 @@ var/list/admin_verbs_admin = list(
/client/proc/cmd_admin_check_player_logs, //checks a player's attack logs,
/client/proc/cmd_admin_check_dialogue_logs, //checks a player's dialogue logs,
/datum/admins/proc/access_news_network, //allows access of newscasters,
/client/proc/giveruntimelog, //allows us to give access to runtime logs to somebody,
/client/proc/getserverlog, //allows us to fetch server logs (diary) for other days,
/client/proc/jumptocoord, //we ghost and jump to a coordinate,
/client/proc/Getmob, //teleports a mob to our location,
@@ -232,7 +229,6 @@ var/list/admin_verbs_server = list(
)
var/list/admin_verbs_debug = list(
/client/proc/getruntimelog, //allows us to access runtime logs to somebody,
/client/proc/cmd_admin_list_open_jobs,
/client/proc/Debug2,
/client/proc/kill_air,
@@ -319,8 +315,6 @@ var/list/admin_verbs_hideable = list(
/datum/admins/proc/announce,
/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,
/client/proc/cmd_admin_check_player_logs,
@@ -420,8 +414,6 @@ var/list/admin_verbs_mod = list(
/datum/admins/proc/sendFax,
/client/proc/getserverlog, //allows us to fetch server logs (diary) for other days,
/datum/admins/proc/view_persistent_data,
/datum/admins/proc/view_txt_log, //shows the server log (diary) for today,
/datum/admins/proc/view_atk_log, //shows the server combat-log, doesn't do anything presently,
/client/proc/start_vote
)
+22 -103
View File
@@ -1,70 +1,20 @@
/*
HOW DO I LOG RUNTIMES?
Firstly, start dreamdeamon if it isn't already running. Then select "world>Log Session" (or press the F3 key)
navigate the popup window to the data/logs/runtime/ folder from where your tgstation .dmb is located.
(you may have to make this folder yourself)
OPTIONAL: you can select the little checkbox down the bottom to make dreamdeamon save the log everytime you
start a world. Just remember to repeat these steps with a new name when you update to a new revision!
Save it with the name of the revision your server uses (e.g. r3459.txt).
Game Masters will now be able to grant access any runtime logs you have archived this way!
This will allow us to gather information on bugs across multiple servers and make maintaining the TG
codebase for the entire /TG/station commuity a TONNE easier :3 Thanks for your help!
*/
//This proc allows Game Masters to grant a client access to the .getruntimelog verb
//Permissions expire at the end of each round.
//Runtimes can be used to meta or spot game-crashing exploits so it's advised to only grant coders that
//you trust access. Also, it may be wise to ensure that they are not going to play in the current round.
/client/proc/giveruntimelog()
set name = ".giveruntimelog"
set desc = "Give somebody access to any session logfiles saved to the /log/runtime/ folder."
set category = null
if(!src.holder)
to_chat(src, span_red("Only Admins may use this command."))
return
var/client/target = tgui_input_list(src,"Choose somebody to grant access to the server's runtime logs (permissions expire at the end of each round):","Grant Permissions", GLOB.clients)
if(!istype(target,/client))
to_chat(src, span_red("Error: giveruntimelog(): Client not found."))
return
add_verb(target, /client/proc/getruntimelog)
to_chat(target, span_red("You have been granted access to runtime logs. Please use them responsibly or risk being banned."))
return
//This proc allows download of runtime logs saved within the data/logs/ folder by dreamdeamon.
//It works similarly to show-server-log.
/client/proc/getruntimelog()
set name = ".getruntimelog"
set desc = "Retrieve any session logfiles saved by dreamdeamon."
set category = null
var/path = browse_files("data/logs/runtime/")
if(!path)
return
if(file_spam_check())
return
message_admins("[key_name_admin(src)] accessed file: [path]")
src << run( file(path) )
to_chat(src, "Attempting to send file, this may take a fair few minutes if the file is very large.")
return
//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 name = "Get Server Logs"
set desc = "Fetch logfiles from data/logs"
set category = null
set category = "Admin.Logs"
browseserverlogs()
var/path = browse_files("data/logs/")
/client/proc/browseserverlogs(current=FALSE, runtimes=FALSE)
var/log_choice = BROWSE_ROOT_ALL_LOGS
if(current)
log_choice = BROWSE_ROOT_CURRENT_LOGS
else if (runtimes)
log_choice = BROWSE_ROOT_RUNTIME_LOGS
var/path = browse_files(log_choice)
feedback_add_details("admin_verb","VTL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
if(!path)
return
@@ -72,44 +22,13 @@
return
message_admins("[key_name_admin(src)] accessed file: [path]")
src << run( file(path) )
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.Logs"
set name = "Show Server Log"
set desc = "Shows today's server log."
var/path = "[log_path].log"
if( fexists(path) )
src << run( file(path) )
else
to_chat(src, span_red("Error: view_txt_log(): File not found/Invalid path([path])."))
return
feedback_add_details("admin_verb","VTL") //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.Logs"
set name = "Show Server Attack Log"
set desc = "Shows today's server attack log."
to_chat(usr, "This verb doesn't actually do anything.")
/*
var/path = "data/logs/[time2text(world.realtime,"YYYY/MM-Month/DD-Day")] Attack.log"
if( fexists(path) )
src << run( file(path) )
else
to_chat(src, span_red("<Error: view_atk_log(): File not found/Invalid path([path])."))
return
usr << run( file(path) )
feedback_add_details("admin_verb","SSAL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
return
*/
switch(tgui_alert(src,"View (in game), Open (in your system's text editor), or Download?", path, list("View", "Open", "Download")))
if ("View")
src << browse("<html><pre style='word-wrap: break-word;'>[html_encode(file2text(file(path)))]</pre></html>", list2params(list("window" = "viewfile.[path]")))
if ("Open")
src << run(file(path))
if ("Download")
src << ftp(file(path))
else
return
to_chat(src, "Attempting to send [path], this may take a fair few minutes if the file is very large.", confidential = TRUE)