Separate library that holds helper functions for the main OMF code.

Revision:
16:3b0bdbfa48ff
Parent:
15:32ada27d82b4
Child:
17:cc05a00e6ee6
diff -r 32ada27d82b4 -r 3b0bdbfa48ff osisoft-omf.cpp
--- a/osisoft-omf.cpp	Wed May 30 15:24:45 2018 +0000
+++ b/osisoft-omf.cpp	Wed May 30 18:04:26 2018 +0000
@@ -111,7 +111,7 @@
 
 void OMFLib_sendMessageToEndpoint_NoSocketReuse(NetworkInterface* network, const char* action, const char* message_type, const char* body) {
     
-    printf("\n\r----- HTTPS POST request -----\n\r");
+    if (ENABLE_PRINTOUTS) printf("\n\r----- HTTPS POST request -----\n\r");
     
     // Create the new request
     HttpsRequest* post_req = new HttpsRequest(network, SSL_CA_PEM, HTTP_POST, TARGET_URL);
@@ -130,18 +130,18 @@
     post_req->set_header("omfversion", OMF_VERSION);
         
     // Send the body
-    printf("Now sending request... ");
+    if (ENABLE_PRINTOUTS) printf("Now sending request... ");
     //printf("\n\rOutgoing message headers:\n\tmessagetype: %s\n\taction: %s", message_type, action);
     //printf("\n\rOutgoing message body:\n\t%s\n\r", body);
     HttpResponse* post_res = post_req->send(body, strlen(body));
     
     // Check the response for an error
     if (!post_res) {
-        printf("HttpRequest failed (error code %d)\n\r", post_req->get_error());
+        if (ENABLE_PRINTOUTS) printf("HttpRequest failed (error code %d)\n\r", post_req->get_error());
         //return 1;
     } else {
         // Print the response
-        printf("Success!\n\r");
+        if (ENABLE_PRINTOUTS) printf("Success!\n\r");
         //OMFLib_dump_response(post_res);
     }