TEEStub: Unify logging 57/154057/3
authorLukasz Kostyra <l.kostyra@samsung.com>
Thu, 5 Oct 2017 15:43:57 +0000 (17:43 +0200)
committerLukasz Kostyra <l.kostyra@samsung.com>
Fri, 6 Oct 2017 12:08:41 +0000 (14:08 +0200)
TEEStub used its own copy of libtef-simulator-log library. The copy
was removed and proper headers were used to have one common logging
platform for the entire project.

Change-Id: I34ad339ccf21b61ae2fc6754dc2332a0c320194b

18 files changed:
TEEStub/CMakeLists.txt
TEEStub/PropertyAccess/PropertyUtility.h
TEEStub/PropertyAccess/TAProperty.cpp
TEEStub/PropertyAccess/TEEProperty.cpp
TEEStub/PropertyAccess/TEEProperty.h
TEEStub/TACommands/CommandBase.h
TEEStub/TACommands/CommandCloseSession.cpp
TEEStub/TACommands/CommandCreateEntryPoint.cpp
TEEStub/TACommands/CommandDestroyEntryPoint.cpp
TEEStub/TACommands/CommandInvoke.cpp
TEEStub/TACommands/CommandOpenSession.cpp
TEEStub/TACommands/SharedMemoryMap.cpp
TEEStub/TEEStubServer/ConnectionSession.cpp
TEEStub/TEEStubServer/TADebug.cpp [deleted file]
TEEStub/TEEStubServer/TEEStubServer.cpp
TEEStub/TaskStrategy/TaskQueuedStrategy.cpp
TEEStub/teestubmain.cpp
include/include/debug.h [deleted file]

index d4d3fed..536308d 100644 (file)
@@ -43,7 +43,6 @@ SET(TEE_STUB_SOURCES
     ${TEE_STUB_PATH}/TaskStrategy/TaskStrategy.cpp
     ${TEE_STUB_PATH}/TEEStubServer/ConnectionSession.cpp
     ${TEE_STUB_PATH}/TEEStubServer/TEEStubServer.cpp
-    ${TEE_STUB_PATH}/TEEStubServer/TADebug.cpp
     )
 
 SET(TEE_STUB_HEADERS
index 34f65a8..995b3bd 100644 (file)
@@ -28,7 +28,6 @@
  *  Include files\r
  *-----------------------------------------------------------------------------*/\r
 #include "tee_internal_api.h"\r
-#include <debug.h>\r
 #include <PropertyAccess/Property.h>\r
 #include <string>\r
 #include <sstream>\r
index ad8cbd6..41a970e 100644 (file)
@@ -32,8 +32,8 @@
 #include <iostream>\r
 #include <config.h>\r
 #include <string.h>\r
-#include <debug.h>\r
 #include <permission.h>\r
+#include "log.h"\r
 \r
 using namespace rapidxml;\r
 \r
index 5901d4f..0ce5dc7 100644 (file)
@@ -30,6 +30,7 @@
 #include <PropertyAccess/rapidxml/rapidxml.hpp>\r
 #include <iostream>\r
 #include <config.h>\r
+#include "log.h"\r
 \r
 using namespace rapidxml;\r
 \r
index cf8861a..8edc4b7 100644 (file)
@@ -28,7 +28,6 @@
  *  Include files\r
  *-----------------------------------------------------------------------------*/\r
 #include <PropertyAccess/Property.h>\r
-#include <debug.h>\r
 #include <map>\r
 \r
 /*-----------------------------------------------------------------------------\r
index c750eb3..15834e7 100644 (file)
@@ -29,7 +29,6 @@
  *-----------------------------------------------------------------------------*/
 #include "tee_sim_command.h"
 #include "tee_internal_api.h"
-#include <debug.h>
 #include "boost/shared_ptr.hpp"
 #include <string>
 #include <string.h>
index 6f6d3e3..74433bc 100644 (file)
@@ -26,6 +26,7 @@
  *-----------------------------------------------------------------------------*/
 #include "CommandCloseSession.h"
 #include <sstream>
+#include "log.h"
 
 /*-----------------------------------------------------------------------------
  *  Member functions
index 559aced..15c0df9 100644 (file)
@@ -26,6 +26,7 @@
  *-----------------------------------------------------------------------------*/
 #include "CommandCreateEntryPoint.h"
 #include <sstream>
+#include "log.h"
 
 /*-----------------------------------------------------------------------------
  *  Member functions
index cf8664a..84af8c9 100644 (file)
@@ -26,6 +26,7 @@
  *-----------------------------------------------------------------------------*/
 #include "CommandDestroyEntryPoint.h"
 #include <sstream>
+#include "log.h"
 
 /*-----------------------------------------------------------------------------
  *  Member functions
index 6f5e1e4..1844bb6 100644 (file)
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <sys/shm.h>
 #include <iostream>
+#include "log.h"
 using namespace std;
 
 /*-----------------------------------------------------------------------------
index b154cf3..4d24654 100644 (file)
@@ -28,6 +28,7 @@
 #include "SharedMemoryMap.h"
 #include <stdio.h>
 #include <sstream>
+#include "log.h"
 
 using namespace std;
 
index f14f387..2093932 100644 (file)
@@ -26,7 +26,6 @@
  *-----------------------------------------------------------------------------*/
 #include "SharedMemoryMap.h"
 
-#include <debug.h>
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -38,6 +37,7 @@
 #include <sys/mman.h>
 #include <time.h>
 #include <unistd.h>
+#include "log.h"
 
 using namespace std;
 
index cc5ba2a..c970b8c 100644 (file)
@@ -29,6 +29,7 @@
 #include "TaskStrategy/TaskQueuedStrategy.h"
 #include "TACommands/MakeCommand.h"
 #include <iostream>
+#include "log.h"
 
 using namespace std;
 
diff --git a/TEEStub/TEEStubServer/TADebug.cpp b/TEEStub/TEEStubServer/TADebug.cpp
deleted file mode 100644 (file)
index 632d000..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-/**
- * @file
- * @author JungKyuen Lee (jklolo.lee@samsung.com)
- * @brief  TA debug function
- */
-
-
-/*-----------------------------------------------------------------------------
- *  Include files
- *-----------------------------------------------------------------------------*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <log_level.h>
-#include <dlog/dlog.h>
-#include <stdarg.h>
-#include <string.h>
-
-#define LOG_LABEL_SIZE 64
-#define LOG_BUFFER_SIZE 4096
-
-static int level = TA_LOG_LEVEL;
-static char log_label[LOG_LABEL_SIZE];
-static char log_one_buffer[LOG_BUFFER_SIZE];
-
-extern "C" void setDebugLogName(const char* __name);
-extern "C" int __logger_log(const char* tag, const usr_log_level lv,
-               const char* fmt, const char* function,
-               const int line,  ...)
-{
-       va_list args;
-       int len = 0;
-
-       if(fmt == NULL || function == NULL)
-               return 0;
-
-       if(tag != NULL && strlen(log_label) == 0)
-               setDebugLogName(tag);
-
-       if(level >= lv && level != LOG_SILENT) {
-                log_priority dlog_level = DLOG_DEBUG;
-                switch(lv)
-                {
-                        case LOG_DEBUG:
-                                dlog_level = DLOG_DEBUG;
-                                break;
-                        case LOG_INFO:
-                        case LOG_NOTICE:
-                                dlog_level = DLOG_INFO;
-                                break;
-                        case LOG_WARNING:
-                                dlog_level = DLOG_WARN;
-                                break;
-                        case LOG_ERR:
-                        case LOG_CRIT:
-                        case LOG_ALERT:
-                        case LOG_EMERG:
-                                dlog_level = DLOG_ERROR;
-                                break;
-                        default:
-                                break;
-                }
-
-               va_start(args, line);
-               len = vsnprintf(log_one_buffer, sizeof(log_one_buffer), fmt, args);
-               va_end(args);
-               len += strlen(log_label);
-                dlog_print(dlog_level, log_label, "%s\n", log_one_buffer);
-               printf("[%s] %s %d : %s\n",
-                       log_label, function, line, log_one_buffer);
-       }
-       return len;
-}
-
-extern "C" void initDebugLogLevel(const char* fmt, ...)
-{
-       va_list args;
-       va_start(args, fmt);
-       __logger_log("Level", LOG_DEBUG, fmt, __FILE__, __LINE__, args);
-       va_end(args);
-}
-
-extern "C" void setDebugLogLevelNum(const usr_log_level __level)
-{
-       level = __level;
-}
-
-extern "C" int getDebugLogLevelNum(void)
-{
-       return level;
-}
-
-extern "C" void setDebugLogLevel(const char* __level)
-{
-       if(__level != NULL)
-               level = atoi(__level);
-}
-
-extern "C" void setDebugLogName(const char* __name)
-{
-       if(__name == NULL)
-               return;
-
-       strncpy(log_label, __name, sizeof(log_label)-1);
-       log_label[sizeof(log_label)-1] = 0;
-}
-
-extern "C" void getDebugLogName(char* __name)
-{
-       if(__name != NULL)
-       {
-               int length = strlen(log_label);
-               strncpy(__name, log_label, length);
-               __name[length] = '\0';
-       }
-}
-
index 61350d0..3af9ffe 100644 (file)
@@ -25,6 +25,7 @@
  *  Include files
  *-----------------------------------------------------------------------------*/
 #include "TEEStubServer.h"
+#include "log.h"
 
 /*-----------------------------------------------------------------------------
  *  Member functions
index 74e59c6..b878ce0 100644 (file)
@@ -29,6 +29,7 @@
 #include "ssf_lib.h"
 #include <string>
 #include <boost/date_time/posix_time/posix_time.hpp>
+#include "log.h"
 
 /*-----------------------------------------------------------------------------
  *  Member functions
index 7ce4dd1..f522487 100644 (file)
@@ -30,6 +30,7 @@
 #include "TEEStubServer/TEEStubServer.h"
 #include <PropertyAccess/PropertyApi.h>
 #include <PropertyAccess/PropertyUtility.h>
+#include "log.h"
 
 /*-----------------------------------------------------------------------------
  *  Globals
@@ -83,8 +84,8 @@ int main(int argc, char* argv[]) {
        TEE_Result initStatus;
        char uuid[100];
        int uuidlen = strlen(argv[0]);
-       printf("TEESTUB argv[0]: %s\n", argv[0]);
-       printf("TEESTUB argv[1]: %s\n", argv[1]);
+       LOGI(TEE_STUB, "argv[0]: %s\n", argv[0]);
+       LOGI(TEE_STUB, "argv[1]: %s\n", argv[1]);
        // fetch uuid from argv[0]
        int i, j;
        for (i = uuidlen - 38, j = 0; i < uuidlen - 6; j++, i++) {
diff --git a/include/include/debug.h b/include/include/debug.h
deleted file mode 100644 (file)
index a12c142..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (c) 2011-2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-/**
- * @file
- * @author  Jaemin Ryu (jm77.ryu@samsung.com)
- */
-
-#ifndef __ALLOC_DEBUG_H__
-#define __ALLOC_DEBUG_H__
-
-#include <log_level.h>
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-#define TEE_STUB  "TEE_STUB"
-#define LOG_LABEL_SIZE 64
-
-int __logger_log(const char* tag, const usr_log_level lv, const char* fmt, const char* function, const int line, ...);
-
-#define LOGD(Tag, Fmt, ...) __logger_log(Tag, LOG_DEBUG, Fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define LOGI(Tag, Fmt, ...) __logger_log(Tag, LOG_INFO, Fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define LOGW(Tag, Fmt, ...) __logger_log(Tag, LOG_WARNING, Fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define LOGE(Tag, Fmt, ...) __logger_log(Tag, LOG_ERR, Fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define LOGC(Tag, Fmt, ...) __logger_log(Tag, LOG_CRIT, Fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-
-void setDebugLogLevelNum(const usr_log_level __level);
-int getDebugLogLevelNum(void);
-void setDebugLogLevel(const char* __level);
-void setDebugLogName(const char* __name); /* buffer(__name) size should be LOG_LABEL_SIZE(64)  */
-void getDebugLogName(char* __name);       /* buffer(__name) size should be LOG_LABEL_SIZE(64)  */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ALLOC_DEBUG_H */