More flexible log system (plugins can add their own fields). Also apply it to newthread.php as a test.