Added log function and setLogLevel public method