added flag to turn logger on/off