Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazhvera committed Jul 1, 2024
1 parent b061e9c commit d1e0573
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions samples/fleet_provisioning/fleet_provisioning/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ int main(int argc, char *argv[])

// Do the global initialization for the API
ApiHandle apiHandle;
apiHandle.InitializeLogging(Aws::Crt::LogLevel::Trace, "fleet_provisioning_file.log");
// Variables for the sample
String csrFile;
String token;
Expand Down Expand Up @@ -263,6 +264,21 @@ int main(int argc, char *argv[])
fprintf(
stdout, "CreateKeysAndCertificateResponse certificateId: %s.\n", response->CertificateId->c_str());
token = *response->CertificateOwnershipToken;
AWS_LOGF_WARN(
AWS_LS_MQTT_CLIENT,
"TODO: Check if the created certificate is correct: \n %s \n -- End of created certificate -- ",
response->CertificatePem->c_str());

AWS_LOGF_WARN(
AWS_LS_MQTT_CLIENT,
"TODO: Check if the created key value is correct: \n %s \n -- End of created key file -- ",
response->PrivateKey->c_str());

AWS_LOGF_WARN(
AWS_LS_MQTT_CLIENT,
"TODO: Check if the created ownership token is correct: \n %s \n -- End of created token value -- ",
response->CertificateOwnershipToken->c_str());

}
else
{
Expand Down Expand Up @@ -393,6 +409,12 @@ int main(int argc, char *argv[])
registerThingRequest.Parameters = params;
registerThingRequest.CertificateOwnershipToken = token;

AWS_LOGF_WARN(
AWS_LS_MQTT_CLIENT,
"TODO: Log CertificateOwnershipToken before send registerThingRequest: \n %s \n -- End of created certificate -- ",
registerThingRequest.CertificateOwnershipToken->c_str());


identityClient.PublishRegisterThing(
registerThingRequest, AWS_MQTT_QOS_AT_LEAST_ONCE, onRegisterPublishSubAck);
sleep(1);
Expand Down

0 comments on commit d1e0573

Please sign in to comment.