The start of a logging API; lots left to figure out though
Changed the logging API and added an error API.