I'm trying to collect debug information in my error handler function. I can analyze the stack and get the file and line number. I also have an array of arguments which I would like to print into my log as well but I don't want to bloat the log file.
I want to print all numbers, booleans, strings (for example the first 50 characters), class names for objects, size of arrays, null for nulls and whatever comes up later in a reasonable form.
It should produce no new lines so I have one line per stack entry.
Since I don't want to reinvent the wheel, is there a function out of the box exist in PHP which will behave as described?