Allow for a custom log callback to be used with options.debug

Modified rai code to enable a custom logger function