added code to allow writing log data to a son file. (errors with SwiftyJSON file though)