XML request/response logger
Currently, with debug mode, you echo any XML send request/received response and it is already a great help.
We used to log these XML requests and responses in a database. It is really useful when a command failed and we can't exactly determine why (API response sometimes are not really clear). Like that, we can find a request and its response and send it to the API support.
Maybe we should be able to configure a logger when creating a Client object.
Yes that would be a great idea, basically I would suggest to implement something via monolog and fallback to "echo" - so it would basically be a composer-suggests/recommends instead of requirement.
Ok this might be a little more complicated:
- the reason I implemented (rather shitty) the "log" method is so I can output each byte as soon as it arrives - this is so I can really see everything until to the point of a crash
- implementing a logger means I would have to call the logger after I received all bytes (which might not work on a crash) and to make it have more sense it would have to add some useful information, like "what command was actually being made" - "what was the actual received xml data"
So conclusion:
- logger will be a config option (psr-log interface)
- it is independent of the current debug
- it will additionally log the Frame class name that was sent
We used to log also the command type (the Frame class in this case) so the whole conclusion sounds perfect.