Log the command if -l is given as a flag.