Update sample applications to use new TLOGX macros

Bug: 119891603
Change-Id: I6f00abea5828ed879bb37f8e2181e2da7db584cf
diff --git a/app-mgmt-test/common/app_mgmt_test.c b/app-mgmt-test/common/app_mgmt_test.c
index 1f146ce..1d04beb 100644
--- a/app-mgmt-test/common/app_mgmt_test.c
+++ b/app-mgmt-test/common/app_mgmt_test.c
@@ -18,6 +18,8 @@
 
 #include <uapi/err.h>
 
+#define TLOG_TAG "app-mgmt-common"
+
 int send_rsp(handle_t channel, uint8_t rsp) {
     uint8_t tx_buffer[1];
     iovec_t tx_iov = {tx_buffer, 1};
diff --git a/app-mgmt-test/include/app_mgmt_test.h b/app-mgmt-test/include/app_mgmt_test.h
index b880067..c69b154 100644
--- a/app-mgmt-test/include/app_mgmt_test.h
+++ b/app-mgmt-test/include/app_mgmt_test.h
@@ -19,12 +19,10 @@
 
 #include <stdio.h>
 #include <trusty_ipc.h>
+#include <trusty_log.h>
 
 #define MAX_CMD_LEN 1
 
-#define TLOGI(fmt, ...) \
-    fprintf(stderr, "%s: %d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
-
 enum {
     CMD_NOP = 0,
     CMD_CLOSE_PORT = 1,
diff --git a/app-mgmt-test/srv1/app_mgmt_srv1.c b/app-mgmt-test/srv1/app_mgmt_srv1.c
index ca07aae..ae5b438 100644
--- a/app-mgmt-test/srv1/app_mgmt_srv1.c
+++ b/app-mgmt-test/srv1/app_mgmt_srv1.c
@@ -22,7 +22,7 @@
 #include <trusty_ipc.h>
 #include <uapi/err.h>
 
-#define LOG_TAG "app-mgmt-test-srv1"
+#define TLOG_TAG "app-mgmt-test-srv1"
 #define CTRL_PORT "com.android.trusty.appmgmt.srv1"
 
 /* Resources are intentionally not freed to test application cleanup on exit */
diff --git a/app-mgmt-test/srv2/app_mgmt_srv2.c b/app-mgmt-test/srv2/app_mgmt_srv2.c
index 7ca17ee..63ced5f 100644
--- a/app-mgmt-test/srv2/app_mgmt_srv2.c
+++ b/app-mgmt-test/srv2/app_mgmt_srv2.c
@@ -26,7 +26,7 @@
 #include <trusty_ipc.h>
 #include <uapi/err.h>
 
-#define LOG_TAG "app-mgmt-test-srv2"
+#define TLOG_TAG "app-mgmt-test-srv2"
 #define CTRL_PORT "com.android.trusty.appmgmt.srv2"
 
 static handle_t ctrl_port;
diff --git a/hwcrypto-unittest/main.c b/hwcrypto-unittest/main.c
index 3f26320..043709b 100644
--- a/hwcrypto-unittest/main.c
+++ b/hwcrypto-unittest/main.c
@@ -37,7 +37,7 @@
 #include <trusty_unittest.h>
 #include <uapi/err.h>
 
-#define LOG_TAG "hwcrypto_unittest"
+#define TLOG_TAG "hwcrypto_unittest"
 
 #define RPMB_STORAGE_AUTH_KEY_ID "com.android.trusty.storage_auth.rpmb"
 #define HWCRYPTO_UNITTEST_KEYBOX_ID "com.android.trusty.hwcrypto.unittest.key32"
diff --git a/hwcrypto/common.h b/hwcrypto/common.h
index 2a34c66..c5d270f 100644
--- a/hwcrypto/common.h
+++ b/hwcrypto/common.h
@@ -19,16 +19,7 @@
 #include <lk/compiler.h>
 #include <sys/types.h>
 #include <trusty_ipc.h>
-
-#define TLOGE(fmt, ...) \
-    fprintf(stderr, "%s: %d: " fmt, LOG_TAG, __LINE__, ##__VA_ARGS__)
-
-#if LOCAL_TRACE
-#define TLOGI(fmt, ...) \
-    fprintf(stderr, "%s: %d: " fmt, LOG_TAG, __LINE__, ##__VA_ARGS__)
-#else
-#define TLOGI(fmt, ...)
-#endif
+#include <trusty_log.h>
 
 typedef void (*event_handler_proc_t)(const uevent_t* ev, void* ctx);
 
diff --git a/hwcrypto/hwkey_srv.c b/hwcrypto/hwkey_srv.c
index 60726a9..fe25316 100644
--- a/hwcrypto/hwkey_srv.c
+++ b/hwcrypto/hwkey_srv.c
@@ -29,8 +29,7 @@
 #include "hwkey_srv_priv.h"
 #include "uuids.h"
 
-#define LOCAL_TRACE 1
-#define LOG_TAG "hwkey_srv"
+#define TLOG_TAG "hwkey_srv"
 
 #define HWKEY_MAX_PAYLOAD_SIZE 2048
 
diff --git a/hwcrypto/hwkey_srv_fake_provider.c b/hwcrypto/hwkey_srv_fake_provider.c
index 1175dde..5f75fbb 100644
--- a/hwcrypto/hwkey_srv_fake_provider.c
+++ b/hwcrypto/hwkey_srv_fake_provider.c
@@ -33,8 +33,7 @@
 #include "hwkey_srv_priv.h"
 #include "uuids.h"
 
-#define LOCAL_TRACE 1
-#define LOG_TAG "hwkey_fake_srv"
+#define TLOG_TAG "hwkey_fake_srv"
 
 #pragma message "Compiling FAKE HWKEY provider"
 
diff --git a/hwcrypto/hwrng_srv.c b/hwcrypto/hwrng_srv.c
index fb33c07..05da2c9 100644
--- a/hwcrypto/hwrng_srv.c
+++ b/hwcrypto/hwrng_srv.c
@@ -28,8 +28,7 @@
 #include "common.h"
 #include "hwrng_srv_priv.h"
 
-#define LOCAL_TRACE 1
-#define LOG_TAG "hwrng_srv"
+#define TLOG_TAG "hwrng_srv"
 
 #define HWRNG_SRV_NAME HWRNG_PORT
 #define MAX_HWRNG_MSG_SIZE 4096
diff --git a/hwcrypto/hwrng_srv_fake_provider.c b/hwcrypto/hwrng_srv_fake_provider.c
index 88ac8a7..321eb50 100644
--- a/hwcrypto/hwrng_srv_fake_provider.c
+++ b/hwcrypto/hwrng_srv_fake_provider.c
@@ -22,8 +22,7 @@
 #include "common.h"
 #include "hwrng_srv_priv.h"
 
-#define LOCAL_TRACE 1
-#define LOG_TAG "hwrng_fake_srv"
+#define TLOG_TAG "hwrng_fake_srv"
 
 #pragma message "Compiling FAKE HWRNG provider"
 
diff --git a/hwcrypto/main.c b/hwcrypto/main.c
index 2fcdf14..98efa43 100644
--- a/hwcrypto/main.c
+++ b/hwcrypto/main.c
@@ -21,8 +21,7 @@
 #include <trusty_ipc.h>
 #include <uapi/err.h>
 
-#define LOCAL_TRACE 1
-#define LOG_TAG "hwcrypto_srv"
+#define TLOG_TAG "hwcrypto_srv"
 
 #include "common.h"
 #include "hwkey_srv_priv.h"
diff --git a/ipc-unittest/include/app/ipc_unittest/common.h b/ipc-unittest/include/app/ipc_unittest/common.h
index 002876a..8d6d508 100644
--- a/ipc-unittest/include/app/ipc_unittest/common.h
+++ b/ipc-unittest/include/app/ipc_unittest/common.h
@@ -16,14 +16,6 @@
 
 #pragma once
 
-#ifdef USER_TASK_WITH_TRUSTY_USER_BASE_LIB_UNITTEST
-#include <lib/unittest/unittest.h>
-#else
-static inline int unittest_printf(const char* fmt, ...) {
-    return 0;
-}
-#endif
-
 /* Expected limits: should be in sync with kernel settings */
 #define MAX_USER_HANDLES 64    /* max number of user handles */
 #define MAX_PORT_PATH_LEN 64   /* max length of port path name   */
@@ -32,11 +24,7 @@
 
 #define FIRST_FREE_HANDLE (3)
 
-#define TLOGI(fmt, ...)                                                    \
-    do {                                                                   \
-        fprintf(stderr, "%s: %d: " fmt, LOG_TAG, __LINE__, ##__VA_ARGS__); \
-        unittest_printf("%s: %d: " fmt, LOG_TAG, __LINE__, ##__VA_ARGS__); \
-    } while (0)
-
 #define MSEC 1000000ULL
 #define SRV_PATH_BASE "com.android.ipc-unittest"
+
+#include <trusty_log.h>
diff --git a/ipc-unittest/main/main.c b/ipc-unittest/main/main.c
index 75d66b9..0003962 100644
--- a/ipc-unittest/main/main.c
+++ b/ipc-unittest/main/main.c
@@ -22,7 +22,7 @@
 #include <trusty_ipc.h>
 #include <uapi/err.h>
 
-#define LOG_TAG "ipc-unittest-main"
+#define TLOG_TAG "ipc-unittest-main"
 
 #include <app/ipc_unittest/common.h>
 #include <app/ipc_unittest/uuids.h>
diff --git a/ipc-unittest/srv/srv.c b/ipc-unittest/srv/srv.c
index dd3702a..ad9cdfe 100644
--- a/ipc-unittest/srv/srv.c
+++ b/ipc-unittest/srv/srv.c
@@ -24,7 +24,7 @@
 #include <trusty_ipc.h>
 #include <uapi/err.h>
 
-#define LOG_TAG "ipc-unittest-srv"
+#define TLOG_TAG "ipc-unittest-srv"
 
 #include <app/ipc_unittest/common.h>
 #include <app/ipc_unittest/uuids.h>
diff --git a/spinner/spinner.c b/spinner/spinner.c
index 9a8ecae..09218e7 100644
--- a/spinner/spinner.c
+++ b/spinner/spinner.c
@@ -19,16 +19,14 @@
 #include <string.h>
 #include <time.h>
 #include <trusty_ipc.h>
+#include <trusty_log.h>
 #include <uapi/err.h>
 
-#define LOG_TAG "spinner-app"
+#define TLOG_TAG "spinner-app"
 #define TEST_CTRL_PORT "com.android.trusty.spinner"
 
 #define MSEC 1000000ULL
 
-#define TLOGI(fmt, ...) \
-    fprintf(stderr, "%s: %d: " fmt, LOG_TAG, __LINE__, ##__VA_ARGS__)
-
 static int _delay(int64_t ns_delay) {
     int rc;
     int64_t curr;
diff --git a/storage-unittest/main.c b/storage-unittest/main.c
index fc11bfd..02255f6 100644
--- a/storage-unittest/main.c
+++ b/storage-unittest/main.c
@@ -30,9 +30,7 @@
 
 #include <trusty_unittest.h>
 
-#define LOG_TAG "ss_unittest"
-#define TLOGE(fmt, ...) \
-    fprintf(stderr, "%s: %d: " fmt, LOG_TAG, __LINE__, ##__VA_ARGS__)
+#define TLOG_TAG "ss_unittest"
 
 typedef void (*test_body)(storage_session_t ss, storage_session_t ss_aux);
 
diff --git a/timer/timer_app.c b/timer/timer_app.c
index 0ade24e..4f33b73 100644
--- a/timer/timer_app.c
+++ b/timer/timer_app.c
@@ -24,7 +24,7 @@
 #include <lib/unittest/unittest.h>
 #include <trusty_unittest.h>
 
-#define LOG_TAG "timertest"
+#define TLOG_TAG "timertest"
 
 static void __attribute__((noinline)) nop(void) {
     static int i;