QNX: Change LOGn to GT traces for consistency
authorAngela Stegmaier <angelabaker@ti.com>
Fri, 29 Jul 2016 22:09:04 +0000 (17:09 -0500)
committerAngela Stegmaier <angelabaker@ti.com>
Wed, 31 Aug 2016 18:37:21 +0000 (13:37 -0500)
The QNX IPC code has a mix of LOGn and GT traces. This patch
modifies all the LOGn traces to be GT traces for consistency,
and to give better control to trace enabling.

Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/GateMP_daemon.c
qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/MessageQ_daemon.c
qnx/src/ipc3x_dev/ti/syslink/utils/hlos/knl/NameServer_daemon.c

index c3fa5dcd3cf577f5c0ac1f301603efc54b377475..c9812e9312c406759fb28267d14121da27e05477 100644 (file)
@@ -166,7 +166,11 @@ Int GateMP_setup(Int32 * sr0ProcId)
 
     if (GateMP_module->nameServer == NULL) {
         status = GateMP_E_FAIL;
-        LOG0("GateMP_setup: NameServer_create failed\n");
+        GT_setFailureReason(curTrace,
+                            GT_4CLASS,
+                            "GateMP_setup",
+                            status,
+                            "NameServer_create failed");
     }
 
     if (status == GateMP_S_SUCCESS) {
@@ -178,8 +182,12 @@ Int GateMP_setup(Int32 * sr0ProcId)
         }
 
         if ((status < 0) && (status != GateMP_E_NOTFOUND)) {
-            LOG0("GateMP_setup: failed to open default gate\n");
             status = GateMP_E_FAIL;
+            GT_setFailureReason(curTrace,
+                                GT_4CLASS,
+                                "GateMP_setup",
+                                status,
+                                "failed to open default gate");
         }
         else if (status == GateMP_S_SUCCESS) {
             *sr0ProcId = procId;
@@ -197,8 +205,12 @@ Int GateMP_setup(Int32 * sr0ProcId)
             &nsValue, &len, NULL);
 
         if (status < 0) {
-            LOG0("GateMP_setup: failed to find info entry\n");
             status = GateMP_E_NOTFOUND;
+            GT_setFailureReason(curTrace,
+                                GT_4CLASS,
+                                "GateMP_setup",
+                                status,
+                                "failed to find info entry");
         }
         else {
             GateMP_module->numRemoteSystem = nsValue[3];
@@ -214,8 +226,12 @@ Int GateMP_setup(Int32 * sr0ProcId)
                 if (GateMP_module->remoteSystemInUse == MAP_FAILED) {
                     GateMP_module->remoteSystemInUse = NULL;
                     status = GateMP_E_MEMORY;
-                    LOG0("Failed to map remoteSystemInUse to host address" \
-                         " space!");
+                    GT_setFailureReason(curTrace,
+                                        GT_4CLASS,
+                                        "GateMP_setup",
+                                        status,
+                                        "Failed to map remoteSystemInUse to " \
+                                        "host address space!");
                 }
             }
 
@@ -228,8 +244,12 @@ Int GateMP_setup(Int32 * sr0ProcId)
                 if (GateMP_module->remoteCustom1InUse == MAP_FAILED) {
                     GateMP_module->remoteCustom1InUse = NULL;
                     status = GateMP_E_MEMORY;
-                    LOG0("Failed to map remoteCustom1InUse to host address" \
-                        " space!");
+                    GT_setFailureReason(curTrace,
+                                        GT_4CLASS,
+                                        "GateMP_setup",
+                                        status,
+                                        "Failed to map remoteCustom1InUse to " \
+                                        "host address space!");
                 }
             }
 
@@ -242,8 +262,12 @@ Int GateMP_setup(Int32 * sr0ProcId)
                 if (GateMP_module->remoteCustom2InUse == MAP_FAILED) {
                     GateMP_module->remoteCustom2InUse = NULL;
                     status = GateMP_E_MEMORY;
-                    LOG0("Failed to map remoteCustom2InUse to host address" \
-                        " space!");
+                    GT_setFailureReason(curTrace,
+                                        GT_4CLASS,
+                                        "GateMP_setup",
+                                        status,
+                                        "Failed to map remoteCustom2InUse to " \
+                                        "host address space!");
                 }
             }
         }
@@ -323,8 +347,12 @@ static Int GateMP_openDefaultGate(GateMP_Handle *handlePtr,
 
     /* assert that a valid pointer has been supplied */
     if (handlePtr == NULL) {
-        LOG0("GateMP_open: argument cannot be null\n");
         status = GateMP_E_INVALIDARG;
+        GT_setFailureReason(curTrace,
+                            GT_4CLASS,
+                            "GateMP_openDefaultGate",
+                            status,
+                            "argument cannot be null");
     }
 
     if (status == GateMP_S_SUCCESS) {
@@ -372,13 +400,21 @@ static Int GateMP_openDefaultGate(GateMP_Handle *handlePtr,
                     &systemParams);
 
             if (obj->gateHandle == NULL) {
-                LOG0("GateMP_openDefaultGate: failed to create proxy\n");
+                GT_setFailureReason(curTrace,
+                                    GT_4CLASS,
+                                    "GateMP_openDefaultGate",
+                                    GateMP_E_FAIL,
+                                    "failed to create proxy");
                 free(obj);
                 obj = NULL;
             }
         }
         else {
-            LOG0("GateMP_openDefaultGate: Memory allocation failed")
+            GT_setFailureReason(curTrace,
+                                GT_4CLASS,
+                                "GateMP_openDefaultGate",
+                                GateMP_E_FAIL,
+                                "Memory allocation failed");
         }
 
         if (obj == NULL) {
@@ -428,7 +464,11 @@ Int GateMP_getFreeResource(GateMP_RemoteProtect type)
             break;
 
         default:
-            LOG0("GateMP_getFreeResource: Invalid remote protection type\n");
+            GT_setFailureReason(curTrace,
+                                GT_4CLASS,
+                                "GateMP_getFreeResource",
+                                GateMP_E_FAIL,
+                                "Invalid remote protection type");
             break;
     }
 
@@ -482,8 +522,12 @@ Int GateMP_releaseResource(UInt id, GateMP_RemoteProtect type)
             break;
 
         default:
-            LOG0("GateMP_releaseResource: Invalid remote protection type\n");
             status = GateMP_E_FAIL;
+            GT_setFailureReason(curTrace,
+                                GT_4CLASS,
+                                "GateMP_releaseResource",
+                                status,
+                                "Invalid remote protection type");
             break;
     }
 
@@ -515,7 +559,11 @@ Int GateMP_getNumResources(GateMP_RemoteProtect type)
             break;
 
         default:
-            LOG0("GateMP_getNumResources: Invalid remote protection type\n");
+            GT_setFailureReason(curTrace,
+                                GT_4CLASS,
+                                "GateMP_getNumResources",
+                                GateMP_E_FAIL,
+                                "Invalid remote protection type");
             break;
     }
 
index e73f6bbe8ce4497ff1afdff234d290f7a8ca3e5c..752baf3c1d29e625d9f9ab11f524f421a5a12e47 100644 (file)
 #include <_MultiProc.h>
 #include <ti/ipc/MessageQ.h>
 #include <_MessageQ.h>
-#include <_IpcLog.h>
+#include <ti/syslink/utils/Trace.h>
 
 /* =============================================================================
  * Macros/Constants
@@ -266,13 +266,14 @@ Int MessageQ_setup(const MessageQ_Config * cfg)
 
     pthread_mutex_lock(&(MessageQ_module->gate));
 
-    LOG1("MessageQ_setup: entered, refCount=%d\n", MessageQ_module->refCount)
+    GT_1trace(curTrace, GT_ENTER, "MessageQ_setup",
+              MessageQ_module->refCount);
 
     MessageQ_module->refCount++;
     if (MessageQ_module->refCount > 1) {
         status = MessageQ_S_ALREADYSETUP;
-        LOG1("MessageQ module has been already setup, refCount=%d\n",
-            MessageQ_module->refCount)
+        GT_1trace(curTrace, GT_1CLASS, "MessageQ module has been already setup,"
+                  " refCount=%d", MessageQ_module->refCount);
 
         goto exitSetup;
     }
@@ -292,7 +293,7 @@ Int MessageQ_setup(const MessageQ_Config * cfg)
         calloc(1, sizeof(MessageQ_Handle) * MessageQ_module->numQueues);
 
 exitSetup:
-    LOG1("MessageQ_setup: exiting, refCount=%d\n", MessageQ_module->refCount)
+    GT_1trace(curTrace, GT_LEAVE, "MessageQ_setup", MessageQ_module->refCount);
 
     pthread_mutex_unlock(&(MessageQ_module->gate));
 
@@ -309,7 +310,8 @@ Int MessageQ_destroy(void)
 
     pthread_mutex_lock(&(MessageQ_module->gate));
 
-    LOG1("MessageQ_destroy: entered, refCount=%d\n", MessageQ_module->refCount)
+    GT_1trace(curTrace, GT_ENTER, "MessageQ_destroy",
+              MessageQ_module->refCount);
 
     /* Decrease the refCount */
     MessageQ_module->refCount--;
@@ -340,7 +342,8 @@ Int MessageQ_destroy(void)
     MessageQ_module->canFreeQueues = TRUE;
 
 exitDestroy:
-    LOG1("MessageQ_destroy: exiting, refCount=%d\n", MessageQ_module->refCount)
+    GT_1trace(curTrace, GT_LEAVE, "MessageQ_destroy",
+              MessageQ_module->refCount);
 
     pthread_mutex_unlock(&(MessageQ_module->gate));
 
@@ -362,13 +365,17 @@ MessageQ_Handle MessageQ_create(String name, const MessageQ_Params * params)
     int                 i;
     UInt                numReserved;
 
-    LOG1("MessageQ_create: creating '%s'\n", name)
+    GT_1trace(curTrace, GT_1CLASS, "MessageQ_create: creating '%s'", name);
 
     /* Create the generic obj */
     obj = (MessageQ_Object *)calloc(1, sizeof(MessageQ_Object));
 
     if (obj == NULL) {
-        LOG0("MessageQ_create: Error: no memory\n")
+        GT_setFailureReason(curTrace,
+                            GT_4CLASS,
+                            "MessageQ_create",
+                            MessageQ_E_FAIL,
+                            "Error: no memory");
         return (NULL);
     }
 
@@ -381,14 +388,16 @@ MessageQ_Handle MessageQ_create(String name, const MessageQ_Params * params)
         queueIndex = params->queueIndex;
 
         if (queueIndex > numReserved) {
-            LOG2("MessageQ_create: Error: requested queue index %d is greater "
-                    "than reserved maximum %d\n", queueIndex, numReserved - 1)
+            GT_2trace(curTrace, GT_4CLASS, "MessageQ_create: Error: requested "
+                      "queue index %d is greater than reserved maximum %d",
+                      queueIndex, numReserved - 1);
             free(obj);
             obj = NULL;
         }
         else if (MessageQ_module->queues[queueIndex] != NULL) {
-            LOG1("MessageQ_create: Error: requested queue index %d is already "
-                    "in use.\n", queueIndex);
+            GT_1trace(curTrace, GT_4CLASS, "MessageQ_create: Error: "
+                      "requested queue index %d is already in use.",
+                      queueIndex);
             free(obj);
             obj = NULL;
         }
@@ -443,7 +452,8 @@ MessageQ_Handle MessageQ_create(String name, const MessageQ_Params * params)
         MessageQ_delete((MessageQ_Handle *)&obj);
     }
 
-    LOG2("MessageQ_create: returning obj=%p, qid=0x%x\n", obj, obj->queue)
+    GT_2trace(curTrace, GT_1CLASS, "MessageQ_create: returning obj=%p, qid=0x%x",
+              obj, obj->queue);
 
     return ((MessageQ_Handle)obj);
 }
@@ -461,12 +471,13 @@ Int MessageQ_delete(MessageQ_Handle * handlePtr)
 
     obj = (MessageQ_Object *)(*handlePtr);
 
-    LOG1("MessageQ_delete: deleting %p\n", obj)
+    GT_1trace(curTrace, GT_ENTER, "MessageQ_delete", obj);
 
     queueIndex = MessageQ_getQueueIndex(obj->queue);
     queue = MessageQ_module->queues[queueIndex];
     if (queue != obj) {
-        LOG1("    ERROR: obj != MessageQ_module->queues[%d]\n", queueIndex)
+        GT_1trace(curTrace, GT_4CLASS,
+                  "    ERROR: obj != MessageQ_module->queues[%d]", queueIndex);
     }
 
     if (obj->nsKey != NULL) {
@@ -494,7 +505,7 @@ Int MessageQ_delete(MessageQ_Handle * handlePtr)
     free(obj);
     *handlePtr = NULL;
 
-    LOG1("MessageQ_delete: returning %d\n", status)
+    GT_1trace(curTrace, GT_LEAVE, "MessageQ_delete", status);
 
     return (status);
 }
@@ -550,7 +561,8 @@ static UInt16 _MessageQ_grow(MessageQ_Object * obj)
         MessageQ_module->canFreeQueues = TRUE;
     }
 
-    LOG1("_MessageQ_grow: queueIndex: 0x%x\n", queueIndex)
+    GT_1trace(curTrace, GT_1CLASS, "_MessageQ_grow: queueIndex: 0x%x",
+              queueIndex);
 
     return (queueIndex);
 }
index 3a878ba26877d11ed1b366992c1c144eef1b70ea..b94caa4e46ebb28ae38db8ee5b0f1f7c9474ce3b 100644 (file)
@@ -68,7 +68,7 @@
 #include <_NameServer.h>
 #include <_NameServer_daemon.h>
 #include <ti/ipc/namesrv/_NameServerRemoteRpmsg.h>
-#include <_IpcLog.h>
+#include <ti/syslink/utils/Trace.h>
 
 #define MESSAGEQ_RPMSG_PORT       61
 #define NAME_SERVER_RPMSG_ADDR    0
@@ -238,8 +238,9 @@ static void NameServerRemote_processMessage(NameServerRemote_Msg * msg, UInt16 p
     int               waitFd = NameServer_module->waitFdW;
 
     if (msg->request == NAMESERVER_REQUEST) {
-        LOG2("NameServer Request: instanceName: %s, name: %s\n",
-             (String)msg->instanceName, (String)msg->name)
+        GT_2trace(curTrace, GT_1CLASS, "NameServer Request: "
+                  "instanceName: %s, name: %s",
+                  (String)msg->instanceName, (String)msg->name);
 
         assert(msg->valueLen <= MAXVALUELEN);
 
@@ -252,27 +253,29 @@ static void NameServerRemote_processMessage(NameServerRemote_Msg * msg, UInt16 p
         if (handle != NULL) {
             /* Search for the NameServer entry */
             if (msg->valueLen <= sizeof (Bits32)) {
-                LOG0("Calling NameServer_getLocalUInt32...\n")
+                GT_0trace(curTrace, GT_1CLASS, "Calling NameServer_getLocalUInt32...");
                 status = NameServer_getLocalUInt32(handle,
                      (String)msg->name, &msg->value);
             }
             else {
-                LOG0("Calling NameServer_getLocal...\n")
+                GT_0trace(curTrace, GT_1CLASS, "Calling NameServer_getLocal...");
                 status = NameServer_getLocal(handle,
                      (String)msg->name, (Ptr)msg->valueBuf, &msg->valueLen);
             }
         }
 
-        LOG2("NameServer Response: instanceName: %s, name: %s,",
-             (String)msg->instanceName, (String)msg->name)
+        GT_2trace(curTrace, GT_1CLASS,
+             "NameServer Response: instanceName: %s, name: %s,",
+             (String)msg->instanceName, (String)msg->name);
         /* set the request status */
         if (status < 0) {
-            LOG1(" Value not found, status: %d\n", status)
+            GT_1trace(curTrace, GT_1CLASS, " Value not found, status: %d",
+                      status);
             msg->requestStatus = 0;
         }
         else {
             msg->requestStatus = 1;
-            LOG1(" Value: 0x%x\n", msg->value)
+            GT_1trace(curTrace, GT_1CLASS, " Value: 0x%x", msg->value);
         }
 
         /* specify message as a response */
@@ -287,8 +290,9 @@ static void NameServerRemote_processMessage(NameServerRemote_Msg * msg, UInt16 p
          * We will simply drop the request.
          */
         if (NameServer_module->mq == NULL) {
-            LOG0("NameServerRemote_processMessage: MessageQCopy not ready. Request "
-                "dropped.\n")
+            GT_0trace(curTrace, GT_3CLASS,
+                      "NameServerRemote_processMessage: MessageQCopy not ready."
+                      " Request dropped.");
         }
         else {
             /* send response message to remote processor */
@@ -296,16 +300,18 @@ static void NameServerRemote_processMessage(NameServerRemote_Msg * msg, UInt16 p
                 MESSAGEQ_RPMSG_PORT, RPMSG_RESERVED_ADDRESSES, msg,
                 sizeof(NameServerRemote_Msg), TRUE);
             if (status < 0) {
-                LOG0("NameServer: MessageQCopy_send failed\n")
+                GT_setFailureReason(curTrace, GT_4CLASS,
+                                    "NameServerRemote_processMessage",
+                                    status, "MessageQCopy_send failed");
             }
         }
 
         pthread_mutex_unlock(&NameServer_module->modGate);
     }
     else {
-        LOG2("NameServer Reply: instanceName: %s, name: %s",
-             (String)msg->instanceName, (String)msg->name)
-        LOG1(", value: 0x%x\n", msg->value)
+        GT_3trace(curTrace, GT_1CLASS, "NameServer Reply: instanceName: %s, "
+             "name: %s, value: 0x%x", (String)msg->instanceName,
+             (String)msg->name, msg->value);
 
         /* Save the response message.  */
         memcpy(&NameServer_module->nsMsg, msg, sizeof(NameServerRemote_Msg));
@@ -320,22 +326,23 @@ static Void _listener_cb(MessageQCopy_Handle handle, void * data, int len,
 {
     NameServerRemote_Msg msg;
 
-    LOG0("listener_cb: Entered Listener thread.\n")
+    GT_6trace(curTrace, GT_ENTER, "_listener_cb", handle, data, len, priv, src, srcProc);
 
-    LOG1("NameServer: Listener got NameServer message "
+    GT_1trace(curTrace, GT_1CLASS, "NameServer: Listener got NameServer message "
          "from MessageQCopy: 0x%p!\n", handle);
     /* Get NameServer message and process: */
     memcpy(&msg, data, len);
 
     if (len != sizeof(NameServerRemote_Msg)) {
-        LOG1("NameServer: got bad NameServerRemote_Msg len (%d)\n",
-            len)
+        GT_1trace(curTrace, GT_4CLASS, "NameServer: got bad "
+                  "NameServerRemote_Msg len (%d)\n", len);
     }
     else {
-        LOG1("listener_cb: read from MessageQCopy 0x%p\n", handle)
-        LOG2("\tReceived ns msg: byte count: %d, from addr: %d, ",
-             len, src)
-        LOG1("from vproc: %d\n", srcProc)
+        GT_1trace(curTrace, GT_1CLASS, "listener_cb: "
+                  "read from MessageQCopy 0x%p", handle);
+        GT_3trace(curTrace, GT_1CLASS, "\tReceived ns msg: "
+                  "byte count: %d, from addr: %d, from vproc: %d",
+                  len, src, srcProc);
         NameServerRemote_processMessage(&msg, srcProc);
     }
 }
@@ -353,19 +360,21 @@ Int NameServer_setup(Void)
 
     pthread_mutex_lock(&NameServer_module->modGate);
 
-    LOG1("NameServer_setup: entered, refCount=%d\n", NameServer_module->refCount)
+    GT_1trace(curTrace, GT_ENTER, "NameServer_setup: refCount",
+              NameServer_module->refCount);
 
     NameServer_module->refCount++;
 
     if (NameServer_module->refCount > 1) {
-        LOG0("NameServer_setup: already setup\n")
+        GT_0trace(curTrace, GT_1CLASS, "NameServer_setup: already setup");
         status = NameServer_S_ALREADYSETUP;
         goto exit;
     }
 
     if (pipe(fd) == -1) {
         status = NameServer_E_FAIL;
-        LOG0("NameServer_setup: failed to create waitFd.\n")
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_setup", status,
+                            "failed to create waitFd.");
         goto exit;
     }
     NameServer_module->waitFdW = fd[1];
@@ -377,7 +386,8 @@ Int NameServer_setup(Void)
 
     if (NameServer_module->mq == NULL) {
         status = NameServer_E_FAIL;
-        LOG0("NameServer_setup: failed to create MessageQCopy instance.\n")
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_setup", status,
+                            "failed to create MessageQCopy instance.");
         goto exit;
     }
 
@@ -385,8 +395,8 @@ Int NameServer_setup(Void)
     CIRCLEQ_INIT(&NameServer_module->objList);
 
 exit:
-    LOG1("NameServer_setup: exiting, refCount=%d\n", \
-        NameServer_module->refCount)
+    GT_1trace(curTrace, GT_LEAVE, "NameServer_setup: refCount",
+              NameServer_module->refCount);
 
     pthread_mutex_unlock(&NameServer_module->modGate);
 
@@ -400,12 +410,15 @@ Int NameServer_destroy(void)
 
     pthread_mutex_lock(&NameServer_module->modGate);
 
-    LOG1("NameServer_destroy: entered, refCount=%d\n", NameServer_module->refCount)
+    GT_1trace(curTrace, GT_ENTER, "NameServer_destroy: refCount",
+              NameServer_module->refCount);
 
     NameServer_module->refCount--;
 
     if (NameServer_module->refCount > 0) {
-        LOG1("NameServer_destroy(): refCount(%d) > 0, exiting\n", NameServer_module->refCount)
+        GT_1trace(curTrace, GT_1CLASS,
+                  "NameServer_destroy(): refCount(%d) > 0, exiting",
+                  NameServer_module->refCount);
         status = NameServer_S_SUCCESS;
 
         goto exit;
@@ -422,7 +435,8 @@ Int NameServer_destroy(void)
     close(NameServer_module->waitFdR);
 
 exit:
-    LOG1("NameServer_destroy: exiting, refCount=%d\n", NameServer_module->refCount)
+    GT_1trace(curTrace, GT_LEAVE, "NameServer_destroy: refCount",
+              NameServer_module->refCount);
 
     pthread_mutex_unlock(&NameServer_module->modGate);
 
@@ -471,7 +485,7 @@ NameServer_Handle NameServer_create(String name,
     assert(name != NULL);
     assert(NameServer_module->refCount != 0);
 
-    LOG1("NameServer_create(): '%s'\n", name)
+    GT_1trace(curTrace, GT_1CLASS, "NameServer_create(): '%s'\n", name);
 
     pthread_mutex_lock(&NameServer_module->modGate);
 
@@ -483,7 +497,8 @@ NameServer_Handle NameServer_create(String name,
             handle->refCount++;
         }
         else {
-            LOG0("NameServer_create: NameServer params mismatch\n")
+            GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_create",
+                                NameServer_E_FAIL, "NameServer params mismatch");
             handle = NULL;
         }
         goto leave;
@@ -493,14 +508,16 @@ NameServer_Handle NameServer_create(String name,
     }
 
     if (!handle) {
-        LOG0("NameServer_create: NameServer_Handle alloc failed\n")
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_create",
+                            NameServer_E_FAIL, "NameServer_Handle alloc failed");
         goto leave;
     }
 
     handle->refCount = 1;
     handle->name = (String)malloc(strlen(name) + 1u);
     if (!handle->name) {
-        LOG0("NameServer_create: instance name alloc failed\n")
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_create",
+                            NameServer_E_FAIL, "instance name alloc failed");
         goto cleanup;
     }
     strncpy(handle->name, name, strlen (name) + 1u);
@@ -603,14 +620,16 @@ Ptr NameServer_add(NameServer_Handle handle, String name, Ptr buf, UInt len)
 
     if (strlen(name) > handle->params.maxNameLen - 1) {
         status = NameServer_E_INVALIDARG;
-        LOG0("NameServer_add: name length exceeded maximum!\n")
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_add", status,
+                            "name length exceeded maximum!");
         new_node = NULL;
         goto exit;
     }
 
     if (len > handle->params.maxValueLen) {
         status = NameServer_E_INVALIDARG;
-        LOG0("NameServer_add: value length exceeded maximum!\n")
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_add", status,
+                            "value length exceeded maximum!");
         new_node = NULL;
         goto exit;
     }
@@ -623,7 +642,8 @@ Ptr NameServer_add(NameServer_Handle handle, String name, Ptr buf, UInt len)
             if (strcmp(node->name, name) == 0) {
                 if (handle->params.checkExisting == TRUE) {
                     status = NameServer_E_INVALIDARG;
-                    LOG1("NameServer_add: '%s' - duplicate entry found!\n", name)
+                    GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_add", status, "duplicate entry found!");
+                    GT_1trace(curTrace, GT_3CLASS, "\t'%s' - duplicate entry found!", name);
                     break;
                 }
             }
@@ -643,7 +663,8 @@ Ptr NameServer_add(NameServer_Handle handle, String name, Ptr buf, UInt len)
     new_node = (NameServer_TableEntry *)malloc(sizeof(NameServer_TableEntry));
     if (new_node == NULL) {
         status = NameServer_E_MEMORY;
-        LOG1("NameServer_add: %d - malloc new_node failed!\n", status)
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_add", status,
+                            "malloc new_node failed!");
 
         goto exit;
     }
@@ -671,8 +692,9 @@ Ptr NameServer_add(NameServer_Handle handle, String name, Ptr buf, UInt len)
 
     handle->count++;
 
-    LOG2("NameServer_add: Entered key: '%s', data: 0x%x\n",
-         name, *(UInt32 *)buf)
+    GT_2trace(curTrace, GT_1CLASS,
+              "NameServer_add: Entered key: '%s', data: 0x%x",
+              name, *(UInt32 *)buf);
 
 exit:
     pthread_mutex_unlock(&handle->gate);
@@ -759,7 +781,8 @@ Int NameServer_remove(NameServer_Handle handle, String name)
 
     if (done == FALSE) {
         status = NameServer_E_INVALIDARG;
-        LOG1("NameServer_remove %d Entry not found!\n", status)
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_remove", status,
+                            " Entry not found!");
     }
 
     pthread_mutex_unlock(&handle->gate);
@@ -825,12 +848,16 @@ Int NameServer_getRemote(NameServer_Handle handle,
     Bool done = FALSE;
 
     if (strlen(name) >= MAXNAMEINCHAR) {
-        LOG0("Name is too long in remote query\n");
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_getRemote",
+                            NameServer_E_NAMETOOLONG,
+                            "Name is too long in remote query");
         return NameServer_E_NAMETOOLONG;
     }
 
     if (strlen(obj->name) >= MAXNAMEINCHAR) {
-        LOG0("Instance name is too long for remote query\n");
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_getRemote",
+                            NameServer_E_NAMETOOLONG,
+                            "Instance name is too long for remote query");
         return NameServer_E_NAMETOOLONG;
     }
 
@@ -850,17 +877,18 @@ Int NameServer_getRemote(NameServer_Handle handle,
     strncpy((char *)nsMsg.instanceName, obj->name, strlen(obj->name) + 1);
     strncpy((char *)nsMsg.name, name, strlen(name) + 1);
 
-    LOG2("NameServer_getRemote: Requesting from procId %d, %s:",
-           procId, (String)nsMsg.instanceName)
-    LOG1("%s...\n", (String)nsMsg.name)
+    GT_3trace(curTrace, GT_1CLASS,
+              "NameServer_getRemote: Requesting from procId %d, %s:%s...",
+              procId, (String)nsMsg.instanceName, (String)nsMsg.name);
 
     /*
      * Check if MessageQCopy object is valid. Technically we don't need it
      * to send, but it is an indication of whether recovery is in process
      */
     if (NameServer_module->mq == NULL) {
-        LOG0("NameServer_getRemote: MessageQCopy not ready\n")
         status = NameServer_E_NOTFOUND;
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_getRemote",
+                            status, "MessageQCopy not ready");
         goto exit;
     }
 
@@ -869,8 +897,9 @@ Int NameServer_getRemote(NameServer_Handle handle,
             RPMSG_RESERVED_ADDRESSES, &nsMsg, sizeof(NameServerRemote_Msg),
             TRUE);
     if (mqcStatus < 0) {
-        LOG0("NameServer_getRemote: Can't send to remote endpoint\n")
         status = NameServer_E_NOTFOUND;
+        GT_1trace(curTrace, GT_3CLASS, "NameServer_getRemote: "
+                 "Can't send to remote endpoint on procId %d", procId);
         goto exit;
     }
 
@@ -880,16 +909,18 @@ Int NameServer_getRemote(NameServer_Handle handle,
         FD_ZERO(&rfds);
         FD_SET(waitFd, &rfds);
         maxfd = waitFd + 1;
-        LOG1("NameServer_getRemote: pending on waitFd: %d\n", waitFd)
+        GT_1trace(curTrace, GT_1CLASS, "NameServer_getRemote: pending on waitFd: %d\n", waitFd);
         ret = select(maxfd, &rfds, NULL, NULL, &tv);
         if (ret == -1) {
-            LOG0("NameServer_getRemote: select failed.")
             status = NameServer_E_FAIL;
+            GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_getRemote",
+                                status, "select failed.");
             goto exit;
         }
         else if (!ret) {
-            LOG0("NameServer_getRemote: select timed out.\n")
             status = NameServer_E_TIMEOUT;
+            GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_getRemote",
+                                status, "select timed out.");
             goto exit;
         }
 
@@ -897,8 +928,9 @@ Int NameServer_getRemote(NameServer_Handle handle,
             /* Read, just to balance the write: */
             numBytes = read(waitFd, &buf, sizeof(buf));
             if (numBytes == -1) {
-                LOG0("NameServer_getRemote: read failure\n")
                 status = NameServer_E_FAIL;
+                GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_getRemote",
+                                    status, "read failure");
                 goto exit;
             }
 
@@ -919,25 +951,28 @@ Int NameServer_getRemote(NameServer_Handle handle,
                 /* set the contents of value */
                 if (*len <= sizeof (Bits32)) {
                     *(UInt32 *)value = (UInt32)replyMsg->value;
-                    LOG2("NameServer_getRemote: Reply from: %d, %s:",
-                        procId, (String)replyMsg->instanceName)
-                    LOG2("%s, value: 0x%x...\n",
-                        (String)replyMsg->name, *(UInt32 *)value)
+                    GT_4trace(curTrace, GT_1CLASS, "NameServer_getRemote: "
+                              "Reply from: %d, %s:%s, value: 0x%x...", procId,
+                              (String)replyMsg->instanceName,
+                              (String)replyMsg->name, *(UInt32 *)value);
                 }
                 else {
                     memcpy(value, replyMsg->valueBuf, *len);
-                    LOG2("NameServer_getRemote: Reply from: %d, %s:",
-                        procId, (String)replyMsg->instanceName)
-                    LOG2("%s, value buffer at address: 0x%p...\n",
-                        (String)replyMsg->name, value)
+                    GT_4trace(curTrace, GT_1CLASS, "NameServer_getRemote: "
+                              "Reply from: %d, %s:%s, value buffer at address:"
+                              " 0x%p...", procId,
+                              (String)replyMsg->instanceName,
+                              (String)replyMsg->name, value);
                 }
 
                 goto exit;
             }
             else {
                 /* name is not found */
-                LOG2("NameServer_getRemote: value for %s:%s not found.\n",
-                     (String)replyMsg->instanceName, (String)replyMsg->name)
+                GT_2trace(curTrace, GT_3CLASS, "NameServer_getRemote: "
+                          "value for %s:%s not found.",
+                          (String)replyMsg->instanceName,
+                          (String)replyMsg->name);
 
                 /* set status to not found */
                 status = NameServer_E_NOTFOUND;
@@ -1097,11 +1132,12 @@ Int NameServer_getLocal(NameServer_Handle handle,
     pthread_mutex_unlock(&handle->gate);
 
     if (done == FALSE) {
-        LOG1("NameServer_getLocal: entry key: '%s' not found!\n", name)
+        GT_1trace(curTrace, GT_1CLASS,
+                  "NameServer_getLocal: entry key: '%s' not found!", name);
     }
     else {
-        LOG2("NameServer_getLocal: Found entry key: '%s', data: 0x%x\n",
-             node->name, (UInt32)node->value)
+        GT_2trace(curTrace, GT_1CLASS, "NameServer_getLocal: Found entry key: "
+                  "'%s', data: 0x%x", node->name, (UInt32)node->value);
         status = NameServer_S_SUCCESS;
     }
 
@@ -1131,7 +1167,8 @@ Int NameServer_getLocalUInt32(NameServer_Handle handle, String name, Ptr value)
     assert(value  != NULL);
     assert(NameServer_module->refCount != 0);
 
-    LOG0("NameServer_getLocalUInt32: calling NameServer_getLocal()...\n")
+    GT_0trace(curTrace, GT_1CLASS,
+              "NameServer_getLocalUInt32: calling NameServer_getLocal()...");
     status = NameServer_getLocal(handle, name, value, &len);
 
     return (status);
@@ -1146,7 +1183,8 @@ Void NameServer_preRecovery(Void)
     if (NameServer_module->mq != NULL) {
         status = MessageQCopy_delete(&NameServer_module->mq);
         if (status < 0) {
-            LOG0("NameServer_preRecovery: Cannot delete MessageQCopy\n");
+            GT_setFailureReason(curTrace, GT_3CLASS, "NameServer_preRecovery", status,
+                                "Cannot delete MessageQCopy");
         }
         NameServer_module->mq = NULL;
     }
@@ -1166,7 +1204,8 @@ Int NameServer_postRecovery(Void)
 
     if (NameServer_module->mq == NULL) {
         status = NameServer_E_FAIL;
-        LOG0("NameServer_postRecovery: failed to create MessageQCopy instance.\n")
+        GT_setFailureReason(curTrace, GT_4CLASS, "NameServer_postRecovery", status,
+                            "failed to create MessageQCopy instance.");
     }
 
     pthread_mutex_unlock(&NameServer_module->modGate);