[Tutor] To program or not to program

alan.gauld@bt.com alan.gauld@bt.com
Tue, 27 Aug 2002 11:14:47 +0100


>  Im not only looking for the answer but also want to 
> learn for myself, I just need some kind of a guide line.

> The lines in the file that you will use look like this:

> Jul  5 18:45:31 maxigate ppp[34607]: tun0: IPCP: myaddr 155.239.150.146
> Jul  6 06:30:44 maxigate ppp[34607]: tun0: Warning: Chat script failed

Look at the file readlines() function(s)
Look at the string split method 
- suggest you split  with ':' separator.

Then extract the bits of information you want by 
accessing the fields - maybe extract the seconds 
from the 3rd field. 
Join the bits you need joined(field[0:3] and fields[6:] mebbe?)
Have a function to process each possible message type.
Check field 5 for message type and process accordingly

Keep the data in a set of variables.

If you want wrap the whole thing up in a set of 
objects - Logfile, Report, LogEntry(with subclasses) 
might be candidates?

That'd probably be how I approached it...

HTH

Alan G.