I'm working on project that connects to remote API. In case response is not ok (e.g. there is status TOO_MANY_REQUESTS) I'd like to log data. With just adding code to fetching method e.g.
logger.debug("example");
I could provide logging functionality however I may face an issue with testing it. Is creating additional support class with methods providing functionality to add logs relevant in such case or is there different approach?