Given the fact that the extra info can by anything we want-- and in the case of an error can even be a exception bean, I think it would be important to maintain the ability of the extra info to serialize itself where possible with some pre-defined method such as $toString(). This also makes sense from a perspective of complex objects like CFCs being responsible to serializing themselves.
I posted this a while back, but here is what I currently have as my getExtraInfoAsString method in logEvent.cfc
if( isSimpleValue(info) )
else if( IsObject(info) AND structKeyExists(info,’$toString’) )
else if( IsObject(info) )
return “”; // CFC’s don’t support .toString(). Ideas?
The last “else” statement could be made to fall back on a new extraInfoConversion setting.
Note, I started doing this because my custom exception handler started by-passing the logging plugin and an E-mail appender takes care of my bug report E-mail now. Therefore, I had to handle an exception bean being passed in as the extra info. I added a “$toString()” method to the exception bean that does the same thing as the logger plugin but its encapsulated within the object that the code pertains to.