added function to enable or disable logging