Pretty finished write_logs() except for its args