Added flag to turn logging on/off (add -l argument to turn it on)