The logging part I wrote when drunk didn't work. Fixed.