Split debug to separate log file, tidy up the API a touch..