log and run code