From 6c1c2dca4beddd219859d1a29d85f780a6d23327 Mon Sep 17 00:00:00 2001 From: "yanjie.hu" Date: Tue, 7 May 2013 17:37:58 +0800 Subject: [PATCH] change printf to LOGD in scldebug.cpp Change-Id: Idee34924cafdedd344cf91b12d629c28405e81af --- scl/include/scldebug.h | 14 +++++++++----- scl/scldebug.cpp | 8 ++++---- scl/sclresourcecache.cpp | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/scl/include/scldebug.h b/scl/include/scldebug.h index 78e9116..102c063 100644 --- a/scl/include/scldebug.h +++ b/scl/include/scldebug.h @@ -21,6 +21,10 @@ #include #include +#include +#ifndef LOG_TAG +#define LOG_TAG "LIBSCL_UI" +#endif #ifdef __cplusplus extern "C" { @@ -52,14 +56,14 @@ extern "C" /* assert macro */ #define scl_assert(_e) \ - if (!(_e)) printf(mc_red "scl assert!(%s) failed at file :%s, line %04d, func: %s" mc_normal "\n", #_e, __FILE__, __LINE__, __FUNCTION__); + if (!(_e)) LOGD(mc_red "scl assert!(%s) failed at file :%s, line %04d, func: %s" mc_normal "\n", #_e, __FILE__, __LINE__, __FUNCTION__); #define scl_assert_return(_e) \ - if (!(_e)) { printf(mc_red "scl assert!(%s) failed at file :%s, line %04d, func: %s" mc_normal "\n", #_e, __FILE__, __LINE__, __FUNCTION__); \ + if (!(_e)) { LOGD(mc_red "scl assert!(%s) failed at file :%s, line %04d, func: %s" mc_normal "\n", #_e, __FILE__, __LINE__, __FUNCTION__); \ return;} #define scl_assert_return_false(_e) \ - if (!(_e)) {printf(mc_red "scl assert!(%s) failed at file :%s, line %04d, func: %s" mc_normal "\n", #_e, __FILE__, __LINE__, __FUNCTION__); \ + if (!(_e)) {LOGD(mc_red "scl assert!(%s) failed at file :%s, line %04d, func: %s" mc_normal "\n", #_e, __FILE__, __LINE__, __FUNCTION__); \ return 0;} #define scl_assert_return_null scl_assert_return_false @@ -83,13 +87,13 @@ extern "C" static struct timeval t0;\ static struct timeval t1;\ gettimeofday(&t0, NULL);\ - printf("[%-20.20s][%04d][" mc_blue "%s" mc_normal "]\n", __FILE__, __LINE__, __FUNCTION__); + LOGD("[%-20.20s][%04d][" mc_blue "%s" mc_normal "]\n", __FILE__, __LINE__, __FUNCTION__); #define SCL_DEBUG_END() \ gettimeofday(&t1, NULL);\ float etime;\ etime = ((t1.tv_sec * 1000000 + t1.tv_usec) - (t0.tv_sec * 1000000 + t0.tv_usec))/1000000.0;\ - printf("[%-20.20s][%04d][%s] E: " mc_green "%f" mc_normal " (S:%u) \n", __FILE__, __LINE__, __FUNCTION__, etime, (t0.tv_sec * 1000000 + t0.tv_usec) ); + LOGD("[%-20.20s][%04d][%s] E: " mc_green "%f" mc_normal " (S:%u) \n", __FILE__, __LINE__, __FUNCTION__, etime, (t0.tv_sec * 1000000 + t0.tv_usec) ); #define IO_TEST diff --git a/scl/scldebug.cpp b/scl/scldebug.cpp index 7eab4ab..1f0aed1 100644 --- a/scl/scldebug.cpp +++ b/scl/scldebug.cpp @@ -44,9 +44,9 @@ float SCL_DEBUG_TIME(const char* fileStr, int line, const char* str) etime = ((t1.tv_sec * 1000000 + t1.tv_usec) - (t0.tv_sec * 1000000 + t0.tv_usec))/1000000.0; } if (strncmp(str, "get_", 4) == 0) { - //printf("[%-20.20s]%04d [T:%u][E:" mc_red "%f" mc_normal "]" mc_normal " %s" mc_normal "\n", pFileStr, line, (t1.tv_sec * 1000000 + t1.tv_usec), etime, str); + //LOGD("[%-20.20s]%04d [T:%u][E:" mc_red "%f" mc_normal "]" mc_normal " %s" mc_normal "\n", pFileStr, line, (t1.tv_sec * 1000000 + t1.tv_usec), etime, str); } else { - printf("[%-20.20s]%04d [T:%u][E:" mc_red "%f" mc_normal "]" mc_blue " %s" mc_normal "\n", pFileStr, line, (t1.tv_sec * 1000000 + t1.tv_usec), etime, str); + LOGD("[%-20.20s]%04d [T:%u][E:" mc_red "%f" mc_normal "]" mc_blue " %s" mc_normal "\n", pFileStr, line, (t1.tv_sec * 1000000 + t1.tv_usec), etime, str); } t0 = t1; } @@ -57,7 +57,7 @@ static float _SCL_DEBUG_ELAPASED_TIME(const char* str, struct timeval t0, struct { float etime; etime = ((t1.tv_sec * 1000000 + t1.tv_usec) - (t0.tv_sec * 1000000 + t0.tv_usec))/1000000.0; - printf("[%s] elap-time = " mc_green "%f" mc_normal " (%u~%u) \n", str, etime, (t0.tv_sec * 1000000 + t0.tv_usec), (t1.tv_sec * 1000000 + t1.tv_usec)); + LOGD("[%s] elap-time = " mc_green "%f" mc_normal " (%u~%u) \n", str, etime, (t0.tv_sec * 1000000 + t0.tv_usec), (t1.tv_sec * 1000000 + t1.tv_usec)); return etime; } @@ -71,7 +71,7 @@ float SCL_DEBUG_ELAPASED_TIME(const char* fileStr, int line, const char* str, in if (type == MEASURE_START) { gettimeofday(&s_tv1, NULL); s_start_line = line; - printf("[%-20.20s]%04d [T:%u]" mc_blue " %s" mc_normal "\n", fileStr, line, (s_tv1.tv_sec * 1000000 + s_tv1.tv_usec), str); + LOGD("[%-20.20s]%04d [T:%u]" mc_blue " %s" mc_normal "\n", fileStr, line, (s_tv1.tv_sec * 1000000 + s_tv1.tv_usec), str); } else if (type == MEASURE_END) { gettimeofday(&s_tv2, NULL); s_end_line = line; diff --git a/scl/sclresourcecache.cpp b/scl/sclresourcecache.cpp index 8da21ad..2b8d3d9 100644 --- a/scl/sclresourcecache.cpp +++ b/scl/sclresourcecache.cpp @@ -757,7 +757,7 @@ CSCLResourceCache::add_private_key(SclPrivateKeyProperties* privProperties, sclb #endif if (ret == NOT_USED) { - printf("Failed!. Out of private data buffer\n"); + LOGD("Failed!. Out of private data buffer\n"); } return ret; } -- 2.7.4