Added logging functions and support