CRM, How to customize JSON sent back from REST API webhook

CRM, How to customize JSON sent back from REST API webhook

Hi,

In CRM, I've created a function with a API REST access.
For debug and log purposes, I have a lot of info statements. That way I can trace any problem that might occur.

However the external service calling this webhook, requires that the function returns a maximum of 1kB of data.

I see that the JSON sent in response to the service contains the key "userMessage" with all info statements. the "output" key is empty. The resulting JSON is way above the 1kB required limit.

How can get rid of the userMessage value in the JSON, but keep the value in CRM ?

Or, what would be the best way to trace this function without using info statements (and so the returned JSON is minimal) ?

Thank you for your suggestions, regards

Olivier