Added buildLog(Exception) for logging exceptions

Added a new function that allows the user to log exceptions easily,
using the JSON markup language.