Chatroom logging & XML parsing

For sometime we’ve needed to implement logging of what’s going on in the chatroom so that we’re able to respond to complaints.

The chatroom software does have an option to dump an archive of the chat every 5 minutes to a method but it is provided in XML so I needed to write a basic parser to convert this to a simple log format. I thought that this would take about 20 minutes but it’s ended up taking up all of an evening and a lot of the night!

I started trying to use Python’s minidom parser but even with help from the excellent Dive Into Python I was struggling.

However after a bit of reading around the web I decided that the sax ContentHandler was a much better option in terms of performance and in coding too so I’ve written a simple handler and it seems to be working fine now.

The site has got to the size where we do need to make a bit more effort in managing the chatroom so I will try to implement video, blocking and banning too in between the work to improve performance.

Leave a Reply

You must be logged in to post a comment.