add method to turn logging off and on.