Create a logging decorator that uniformly handles logging and error handling throughout all the endpoints.