If you have joins or parts, why not log quits or nick changes too? Or was your intention solely based on joins and parts?
Because this is a multi-channel script, maybe instead of a .txt file, use an .ini file and make separate sections for each channel?
Overall, this script can be handy.