Please check out TwistedMUCK !

Member Discussions

terms



[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]


1. Logfiles named by Date Mon Aug 21, 2006 [3:13 PM]
topper_
Email not supplied
member since: Aug 18, 2006
Reply
I'm running ROM 2.4b4, and currently using the stock startup file, aside from a change of port.

I'm looking to name my logfiles based on the date they're started.. something like..

grun_8-21-06_00.log For the first logfile today.

For reference, this is thecurrent logfile naming section

while ( 1 )
set index = 1000
while ( 1 )
set logfile = ../log/$index.log
if ( ! -e $logfile ) break
@ index++
end


2. RE: Logfiles named by Date Mon Aug 21, 2006 [10:14 PM]
Tyche
Email not supplied
member since: Apr 4, 2000
In Reply To
Reply

while ( 1 )
set index = 0
set date = `date +%y-%m-%d`
while ( 1 )
set logfile = "grun_${date}_${index}.log"
if ( ! -e $logfile ) break
@ index++
end


(Comment added by Tyche on Mon Aug 21 23:20:15 2006)

Note those are not single quotes around `date +%y-%m-%d`, they are backquote characters.
The Sourcery - http://sourcery.dyndns.org
TeensyMud - http://teensymud.kicks-ass.org
"A man can receive nothing, except it be given him from heaven."


3. RE: Logfiles named by Date Tue Aug 22, 2006 [11:04 AM]
TDM
Email not supplied
member since: Mar 6, 2000
In Reply To
Reply
This might not be the best way to do it, but most of it was done before I got ahold of the code, and what I did might be bass ackward, but that's just how I roll.

our log_string was already just tossing strings to append_file with the logfiles name. So all I did was put in a little extra to bring in the current date and send the new filename to append_file.

So log_string gathers up the date with sprintf(buf,"%s%s",LOG_FILE,printdate());
And send it to append_file (for example today, it's ../log/logfile8-22-06)

The nice thing with this though is that it leaves a nice and neat log file for each day.
Deckeon - Shadowrun Gaming at its Finest.
deckeon.mine.nu:2065
www.deckeon.net




[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]