*NIX Log files part 2.

CR+LF added to new lines, created a global variable log_end that can be used
on newlines

log_misc("blahblah...[log_end]\nMoreblahblah[log_end]")

put [log_end] prior to any \n and it will show up correctly in windows.

Also created log_misc() proc to log to diary, and removed a bunch of

diary << stuff all over the place.
This commit is contained in:
Ccomp5950
2014-03-26 18:51:37 -05:00
parent 38a22e880f
commit 936db263ef
14 changed files with 68 additions and 56 deletions

View File

@@ -34,8 +34,8 @@ world/IsBanned(key,address,computer_id)
var/ckeytext = ckey(key)
if(!establish_db_connection())
world.log << "Ban database connection failure. Key [ckeytext] not checked"
diary << "Ban database connection failure. Key [ckeytext] not checked"
error("Ban database connection failure. Key [ckeytext] not checked")
log_misc("Ban database connection failure. Key [ckeytext] not checked")
return
var/failedcid = 1

View File

@@ -22,7 +22,7 @@
/proc/ToRban_update()
spawn(0)
diary << "Downloading updated ToR data...[world.system_type == UNIX ? ascii2text(13) :]"
log_misc("Downloading updated ToR data...")
var/http[] = world.Export("http://exitlist.torproject.org/exit-addresses")
var/list/rawlist = file2list(http["CONTENT"])
@@ -36,10 +36,10 @@
if(!cleaned) continue
F[cleaned] << 1
F["last_update"] << world.realtime
diary << "ToR data updated![world.system_type == UNIX ? ascii2text(13) :]"
log_misc("ToR data updated!")
if(usr) usr << "ToRban updated."
return 1
diary << "ToR data update aborted: no data.[world.system_type == UNIX ? ascii2text(13) :]"
log_misc("ToR data update aborted: no data.")
return 0
/client/proc/ToRban(task in list("update","toggle","show","remove","remove all","find"))

View File

@@ -103,8 +103,8 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
establish_db_connection()
if(!dbcon.IsConnected())
world.log << "Failed to connect to database in load_admins(). Reverting to legacy system."
diary << "Failed to connect to database in load_admins(). Reverting to legacy system."
error("Failed to connect to database in load_admins(). Reverting to legacy system.")
log_misc("Failed to connect to database in load_admins(). Reverting to legacy system.")
config.admin_legacy_system = 1
load_admins()
return
@@ -123,8 +123,8 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
//find the client for a ckey if they are connected and associate them with the new admin datum
D.associate(directory[ckey])
if(!admin_datums)
world.log << "The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system."
diary << "The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system."
error("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
log_misc("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
config.admin_legacy_system = 1
load_admins()
return

View File

@@ -66,8 +66,8 @@ DEBUG
log_admin("jobban_keylist was empty")
else
if(!establish_db_connection())
world.log << "Database connection failed. Reverting to the legacy ban system.[world.system_type == UNIX ? ascii2text(13) :]"
diary << "Database connection failed. Reverting to the legacy ban system.[world.system_type == UNIX ? ascii2text(13) :]"
error("Database connection failed. Reverting to the legacy ban system.")
log_misc("Database connection failed. Reverting to the legacy ban system.")
config.ban_legacy_system = 1
jobban_loadbanfile()
return

View File

@@ -1096,7 +1096,7 @@
var/tdamage = 0
var/ticks = 0
while (germs < 2501 && ticks < 100000 && round(damage/10)*20)
diary << "VIRUS TESTING: [ticks] : germs [germs] tdamage [tdamage] prob [round(damage/10)*20]"
log_misc("VIRUS TESTING: [ticks] : germs [germs] tdamage [tdamage] prob [round(damage/10)*20]")
ticks++
if (prob(round(damage/10)*20))
germs++

View File

@@ -356,8 +356,8 @@
return
else
if(Debug)
diary <<"pulling disappeared? at [__LINE__] in mob.dm - pulling = [pulling]"
diary <<"REPORT THIS"
log_debug("pulling disappeared? at [__LINE__] in mob.dm - pulling = [pulling]")
log_debug("REPORT THIS")
/////
if(pulling && pulling.anchored)

View File

@@ -10,7 +10,7 @@ client/verb/tcssave()
var/obj/machinery/telecomms/server/Server = Machine.SelectedServer
var/tcscode=winget(src, "tcscode", "text")
var/msg="[mob.name] is adding script to server [Server]: [tcscode]"
diary << msg
log_misc(msg)
message_admins("[mob.name] has uploaded a NTLS script to [Machine.SelectedServer] ([mob.x],[mob.y],[mob.z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[mob.x];Y=[mob.y];Z=[mob.z]'>JMP</a>)",0,1)
Server.setcode( tcscode ) // this actually saves the code from input to the server
src << output(null, "tcserror") // clear the errors
@@ -208,4 +208,4 @@ client/verb/tcsclearmem()
src << output("<font color = red>Failed to clear memory: Unable to locate machine.</font color>", "tcserror")
else
src << output(null, "tcserror")
src << output("<font color = red>Failed to clear memory: Unable to locate machine.</font color>", "tcserror")
src << output("<font color = red>Failed to clear memory: Unable to locate machine.</font color>", "tcserror")

View File

@@ -257,7 +257,7 @@ proc/n_inrange(var/num, var/min=-1, var/max=1)
var/list/dat = list()
while (i < lenh)
var/found = findtext(haystack, a, i, 0)
//diary << "findtext([haystack], [a], [i], 0)=[found]"
//log_misc("findtext([haystack], [a], [i], 0)=[found]")
if (found == 0) // Not found
break
else
@@ -265,9 +265,9 @@ proc/n_inrange(var/num, var/min=-1, var/max=1)
dat+=found
count+=1
else
//diary << "Script found [a] [count] times, aborted"
//log_misc("Script found [a] [count] times, aborted")
break
//diary << "Found [a] at [found]! Moving up..."
//log_misc("Found [a] at [found]! Moving up...")
i = found + lena
if (count == 0)
return haystack
@@ -281,11 +281,11 @@ proc/n_inrange(var/num, var/min=-1, var/max=1)
//CharCopy (dest + targetIndex, src + sourceIndex, count);
//CharCopy (dest + curPos, source + lastReadPos, precopy);
buf+=copytext(haystack,lastReadPos,precopy)
diary << "buf+=copytext([haystack],[lastReadPos],[precopy])"
diary<<"[buf]"
log_misc("buf+=copytext([haystack],[lastReadPos],[precopy])")
log_misc("[buf]")
lastReadPos = dat[i] + lena
//CharCopy (dest + curPos, replace, newValue.length);
buf+=b
diary<<"[buf]"
log_misc("[buf]")
buf+=copytext(haystack,lastReadPos, 0)
return buf
return buf