updated log function to use json