Improve logging
* add error function to logger
* replace debug with error logging functions where appropriate