Update enableLogging method to handle invalid input