encode log data into protobuf & add UT code