Adding debug and error logging to local API