Added a write_log method