Advanced PHP error handling and high accuracy JSON logging