Moved error and exception logging into a separate class so it can be used with any logger