Foundation.Log

by sapphiremagus
Log all the activity you want, and make it easy to find too!
ID:426893
 
F_Addlog(alias, logfile, override=0)

ARGS:
alias - what to name to logfile, for easy reference
logfile - actual file to used for logging
override - if true, it will overwrite any previous entry with this alias

RETURNS

TRUE if logfile is added, FALSE if not

EXAMPLE

F_Addlog("BUGS","logs/bugs.log")

That would add the file "logs/bugs.log" to the list of logfiles
with the alias of "BUGS".


F_Log(alias, message)

ARGS:

alias - logfile alias previously defined (see above) or a file path.
message - what to write to the logfile

RETURNS

NOTHING

EXAMPLE

F_Log("BUGS","Huh?")

That would write 'Huh?' to the file '\logs\bugs.log',
based on the previous example. NOTE: is the directory
where your game is. C:\program files\byond\bin\mygame, for example.

F_Readlog(alias, tail = 0)

ARGS:

alias - logfile alias previously defined (see above) or a file path.
tail - how many lines to display. See below.

RETURNS

Contents of logfile, or the last [x] lines of it, where x equals tail.
NOTE: tail defaults to 0, which returns entire file.

EXAMPLE

var/log = F_Readlog("BUGS",0)
usr<<log

That displays the contents of the "BUGS" log file to usr.

var/log = F_Readlog("BUGS",10)
usr<<log

That displays the last 10 entries in the logfile to usr.


F_Removelog(alias)

ARGS:

alias - logfile alias already defined

RETURNS

TRUE if the alias is present, FALSE if it isn't

EXAMPLE

F_Removelog("BUGS")

That removes the alias "BUGS" and whatever association it had.