Merge pull request #8577 from Allfd/logs

Adds log rotate command to World/Topic()
This commit is contained in:
tigercat2000
2018-01-23 06:06:09 -08:00
committed by GitHub
+17 -8
View File
@@ -7,7 +7,7 @@ var/global/datum/global_init/init = new ()
makeDatumRefLists()
load_configuration()
setLog()
del(src)
/world
@@ -23,14 +23,8 @@ var/global/datum/global_init/init = new ()
var/global/list/map_transition_config = MAP_TRANSITION_CONFIG
/world/New()
//logs
var/date_string = time2text(world.realtime, "YYYY/MM-Month/DD-Day")
href_logfile = file("data/logs/[date_string] hrefs.htm")
diary = file("data/logs/[date_string].log")
diaryofmeanpeople = file("data/logs/[date_string] Attack.log")
diary << "\n\nStarting up. [time2text(world.timeofday, "hh:mm.ss")]\n---------------------"
diaryofmeanpeople << "\n\nStarting up. [time2text(world.timeofday, "hh:mm.ss")]\n---------------------"
if(byond_version < RECOMMENDED_VERSION)
log_to_dd("Your server's byond version does not meet the recommended requirements for this code. Please update BYOND")
@@ -264,6 +258,14 @@ var/world_topic_spam_protect_time = world.timeofday
return "Kick Successful"
else if("setlog" in input)
if(!key_valid)
return keySpamProtect(addr)
setLog()
return "Logs set to current date"
/proc/keySpamProtect(var/addr)
if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50)
spawn(50)
@@ -453,6 +455,12 @@ var/world_topic_spam_protect_time = world.timeofday
var/failed_db_connections = 0
var/failed_old_db_connections = 0
/proc/setLog()
var/date_string = time2text(world.realtime, "YYYY/MM-Month/DD-Day")
href_logfile = file("data/logs/[date_string] hrefs.htm")
diary = file("data/logs/[date_string].log")
diaryofmeanpeople = file("data/logs/[date_string] Attack.log")
/hook/startup/proc/connectDB()
if(!setup_database_connection())
log_to_dd("Your server failed to establish a connection with the feedback database.")
@@ -460,7 +468,7 @@ var/failed_old_db_connections = 0
log_to_dd("Feedback database connection established.")
return 1
proc/setup_database_connection()
/proc/setup_database_connection()
if(failed_db_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to conenct anymore.
return 0
@@ -495,3 +503,4 @@ proc/establish_db_connection()
return 1
#undef FAILED_DB_CONNECTION_CUTOFF