made logging optional