Add Secure Log
authorSeokhyun Kim <swank.kim@samsung.com>
Wed, 17 Apr 2013 09:29:20 +0000 (18:29 +0900)
committerSeokhyun Kim <swank.kim@samsung.com>
Wed, 17 Apr 2013 11:36:56 +0000 (20:36 +0900)
Change-Id: I201bde3e43f344d9decbd76d21fd8931d91910b1

inc/FBaseLog.h
inc/FBaseSysLog.h

index 6426fa4..11f6711 100644 (file)
@@ -755,121 +755,582 @@ extern "C" {
  *
  * @{
  */
+
 #if (defined(_APP_LOG) || defined(_OSP_DEBUG_) || defined(_DEBUG)) && defined(_SECURE_LOG)
 
 #define AppSecureLog(...)                      AppLogInternal(__PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
+#define AppSecureLogDebug(...)                 AppLogDebugInternal(__PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
 #define AppSecureLogException(...)             AppLogExceptionInternal(__PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
 
 #define AppSecureLogTag(tag, ...)              AppLogTagInternal(tag, __PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
+#define AppSecureLogDebugTag(tag, ...)         AppLogDebugTagInternal(tag, __PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
 #define AppSecureLogExceptionTag(tag, ...)     AppLogExceptionTagInternal(tag, __PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
 
 #else
 /**
-* This macro is to protect informative log messages which needs to keep security.
-* It allows display of informative log messages if compiled with "_SECURE_LOG" definition.
-* Otherwise, it will be removed in the compile time.
-*
-* @since 2.1
-*
-* @param[in]   ...                     The message to display
-*
-* The following example demonstrates how to use the AppSecureLog macro.
-*
-* @code
-*        bool
-*        MyEngine::Init(int value)
-*        {
-*           AppSecureLog("User ID : 'JoneDoe'");
-*
-*           return true;
-*        }
-* @endcode
-* @hideinitializer
-*/
+ * This macro is to protect informative log messages which needs to keep security.
+ * It allows display of informative log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, it will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  ...                     The message to display
+ *
+ * The following example demonstrates how to use the AppSecureLog macro.
+ *
+ * @code
+ *        bool
+ *        MyEngine::Init(int value)
+ *        {
+ *           AppSecureLog("User ID : 'JoneDoe'");
+ *
+ *           return true;
+ *        }
+ * @endcode
+ * @hideinitializer
+ */
 #define AppSecureLog(...)
 
 /**
-* This macro is to protect exception log messages which needs to keep security.
-* It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
-* Otherwise, it will be removed in the compile time.
-*
-* @since 2.1
-*
-* @param[in]   ...                     The message to display
-*
-* The following example demonstrates how to use the AppSecureLogException macro.
-*
-* @code
-*        bool
-*        MyEngine::Init(int value)
-*        {
-*           //...
-*           if (something_wrong)
-*           {
-*              AppSecureLogException("User ID : 'JoneDoe' mismatch.");
-*
-*              return false;
-*           }
-*   //...
-*
-*           return true;
-*        }
-* @endcode
-* @hideinitializer
-*/
+ * This macro is to protect debug log messages which needs to keep security.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, it will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  ...                     The message to display
+ *
+ * The following example demonstrates how to use the AppSecureLogDebug macro.
+ *
+ * @code
+ *        bool
+ *        MyEngine::Init(int value)
+ *        {
+ *           //...
+ *           if (something_wrong)
+ *           {
+ *              AppSecureLogDebug("User ID : 'JoneDoe' mismatch.");
+ *
+ *              return false;
+ *           }
+ *   //...
+ *
+ *           return true;
+ *        }
+ * @endcode
+ * @hideinitializer
+ */
+#define AppSecureLogDebug(...)
+
+/**
+ * This macro is to protect exception log messages which needs to keep security.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, it will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  ...                     The message to display 
+ *
+ * The following example demonstrates how to use the AppSecureLogException macro.
+ *
+ * @code
+ *        bool
+ *        MyEngine::Init(int value)
+ *        {
+ *           //...
+ *           if (something_wrong)
+ *           {
+ *              AppSecureLogException("User ID : 'JoneDoe' mismatch.");
+ *
+ *              return false;
+ *           }
+ *   //...
+ *
+ *           return true;
+ *        }
+ * @endcode
+ * @hideinitializer
+ */
 #define AppSecureLogException(...)
 
 /**
-* This macro is to protect informative log messages which needs to keep security, with a tag.
-* It allows display of informative log messages if compiled with "_SECURE_LOG" definition.
-* Otherwise, it will be removed in the compile time.
-*
-* @since 2.1
-*
-* @param[in]   tag                     The user defined tag
-* @param[in]   ...                     The message to display
-*
-* The following example demonstrates how to use the AppSecureLogTag macro.
-*
-* @code
-*        bool
-*        MyEngine::Init(int value)
-*        {
-*           AppSecureLogTag("MyTag", "User ID : 'JoneDoe'");
-*
-*           return true;
-*        }
-* @endcode
-* @hideinitializer
-*/
+ * This macro is to protect informative log messages which needs to keep security, with a tag.
+ * It allows display of informative log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, it will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  tag                     The user defined tag
+ * @param[in]  ...                     The message to display
+ *
+ * The following example demonstrates how to use the AppSecureLogTag macro.
+ *
+ * @code
+ *        bool
+ *        MyEngine::Init(int value)
+ *        {
+ *           AppSecureLogTag("MyTag", "User ID : 'JoneDoe'");
+ *
+ *           return true;
+ *        }
+ * @endcode
+ * @hideinitializer
+ */
 #define AppSecureLogTag(tag, ...)
 
 /**
-* This macro is to protect exception log messages which needs to keep security, with a tag.
-* It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
-* Otherwise, it will be removed in the compile time.
-*
-* @since 2.1
-*
-* @param[in]   tag                     The user defined tag
-* @param[in]   ...                     The message to display
-*
-* The following example demonstrates how to use the AppSecureLogExceptionTag macro.
-*
-* @code
-*        bool
-*        MyEngine::Init(int value)
-*        {
-*           AppSecureLogExceptionTag("MyTag", "User ID : 'JoneDoe' mismatch.");
-*
-*           return true;
-*        }
-* @endcode
-* @hideinitializer
-*/
+ * This macro is to protect debug log messages which needs to keep security, with a tag.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, it will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  tag                     The user defined tag
+ * @param[in]  ...                     The message to display
+ *
+ * The following example demonstrates how to use the AppSecureLogDebugTag macro.
+ *
+ * @code
+ *        bool
+ *        MyEngine::Init(int value)
+ *        {
+ *           AppSecureLogExceptionTag("MyTag", "User ID : 'JoneDoe' mismatch.");
+ *
+ *           return true;
+ *        }
+ * @endcode
+ * @hideinitializer
+ */
+#define AppSecureLogDebugTag(tag, ...)
+
+/**
+ * This macro is to protect exception log messages which needs to keep security, with a tag.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, it will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  tag                     The user defined tag
+ * @param[in]  ...                     The message to display
+ *
+ * The following example demonstrates how to use the AppSecureLogExceptionTag macro.
+ *
+ * @code
+ *        bool
+ *        MyEngine::Init(int value)
+ *        {
+ *           AppSecureLogDebugTag("MyTag", "User ID : 'JoneDoe' mismatch.");
+ *
+ *           return true;
+ *        }
+ * @endcode
+ * @hideinitializer
+ */
 #define AppSecureLogExceptionTag(tag, ...)
 
 #endif
+
+/**
+ * If the condition is @c false, it prints a message, evaluates a cleanup expression,
+ * and goes to <tt>CATCH</tt>.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  expr                    Expressions that are evaluated before going to CATCH label
+ * @param[in]  ...                     The message to display
+ *
+ * The following example demonstrates how to use the SecureTry macro.
+ *
+ * @code
+ *     result
+ *     MyClass::DoSomething(const String* passwd)
+ *     {
+ *        result r = E_SUCCESS;
+ *
+ *        // Do something...
+ *
+ *        // If password is wrong, print "[E_INVALID_ARG] The password '1234' is wrong." to the console
+ *        // execute the expression "r = E_INVALID_ARG", and move to CATCH
+ *        SecureTryCatch(*passwd != refPasswd, r = E_INVALID_ARG, "[E_INVALID_ARG] The password '%ls' is wrong.", passwd->GetPointer());
+ *
+ *        SetLastResult(E_SUCCESS);
+ *
+ *        return E_SUCCESS;// execute the expression "r = E_INVALID_ARG", and move to CATCH
+ *
+ *        CATCH:
+ *           SetLastResult(r);
+ *            // Do something
+ *
+ *           return r;
+ *     }
+ * @endcode
+ * @hideinitializer
+ */
+#define SecureTryCatch(condition, expr, ...) \
+       if (!(condition)) { \
+               AppSecureLogException(__VA_ARGS__); \
+               expr; \
+               goto CATCH;     \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, it prints a message, sets the last result, evaluates a cleanup expression
+ * and goes to <tt>CATCH</tt>.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  expr                    Expressions that are evaluated before going to CATCH label
+ * @param[in]  r                       The last result to set
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryCatchResult(condition, expr, r, ...) \
+       if (!(condition)) { \
+               SetLastResult(r); \
+               AppSecureLogException(__VA_ARGS__); \
+               expr; \
+               goto CATCH;     \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, it prints a message, sets the last result, evaluates a cleanup expression
+ * and goes to label.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]    condition             The condition that is expected to be true
+ * @param[in]    expr                  Expressions that are evaluated before going to catchLabel
+ * @param[in]    catchLabel            The label for goto operation
+ * @param[in]    r                     The last result to set
+ * @param[in]    ...                   The message to display
+ * @hideinitializer
+ */
+#define SecureTryCatchLabelResult(condition, expr, catchLabel, r, ...) \
+       if (!(condition)) { \
+               SetLastResult(r); \
+               AppSecureLogException(__VA_ARGS__); \
+               expr; \
+               goto catchLabel;        \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the message is printed and a value is returned.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  returnValue             The value to return when the condition is @c false
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryReturn(condition, returnValue, ...)   \
+       if (!(condition)) { \
+               AppSecureLogException(__VA_ARGS__); \
+               return returnValue;     \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the message is printed, sets the last result and a value is returned.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality  will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  returnValue             The value to return when the condition is @c false
+ * @param[in]  r                       The last result to set
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryReturnResult(condition, returnValue, r, ...)  \
+       if (!(condition)) { \
+               SetLastResult(r); \
+               AppSecureLogException(__VA_ARGS__); \
+               return returnValue;     \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the message is printed, sets the last result and no value is returned.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  r                       The last result to set
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryReturnVoidResult(condition, r, ...)   \
+       if (!(condition)) { \
+               SetLastResult(r); \
+               AppSecureLogException(__VA_ARGS__); \
+               return; \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the message is printed and no value is returned.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryReturnVoid(condition, ...) \
+       if (!(condition)) { \
+               AppSecureLogException(__VA_ARGS__); \
+               return; \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the message is printed.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryLog(condition, ...)   \
+       if (!(condition)) { \
+               AppSecureLog(__VA_ARGS__); \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the informative log message is printed and a value is returned.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]    condition             The condition that is expected to be true
+ * @param[in]    returnValue           The value to return when the condition is @c false
+ * @param[in]    ...                   The message to display
+ * @hideinitializer
+ */
+#define SecureTryLogReturn(condition, returnValue, ...) \
+       if (!(condition)) { \
+               AppSecureLog(__VA_ARGS__); \
+               return returnValue;     \
+       } \
+       else {;}
+
+// SecureTryTag Macros
+
+/**
+ * If the condition is @c false, it prints a message with a tag, evaluates a cleanup expression
+ * and goes to <tt>CATCH</tt>.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  tag                     Used to identify the source of a log message
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  expr                    Expressions that are evaluated before going to CATCH label
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryCatchTag(tag, condition, expr, ...) \
+       if (!(condition)) { \
+               AppSecureLogExceptionTag(tag, __VA_ARGS__); \
+               expr; \
+               goto CATCH;     \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, it prints a message with a tag, sets the last result, evaluates a cleanup expression,
+ * and goes to <tt>CATCH</tt>.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  tag                     Used to identify the source of a log message
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  expr                    Expressions that are evaluated before going to CATCH label
+ * @param[in]  r                       The last result to set
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryCatchResultTag(tag, condition, expr, r, ...) \
+       if (!(condition)) { \
+               SetLastResult(r); \
+               AppSecureLogExceptionTag(tag, __VA_ARGS__); \
+               expr; \
+               goto CATCH;     \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, it prints a message with a tag, sets the last result, evaluates a cleanup expression
+ * and goes to label.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]    tag                   Used to identify the source of a log message
+ * @param[in]    condition             The condition that is expected to be true
+ * @param[in]    expr                  Expressions that are evaluated before going to catchLabel
+ * @param[in]    catchLabel            The label for goto operation
+ * @param[in]    r                     The last result to set
+ * @param[in]    ...                   The message to display
+ * @hideinitializer
+ */
+#define SecureTryCatchLabelResultTag(tag, condition, expr, catchLabel, r, ...) \
+       if (!(condition)) { \
+               SetLastResult(r); \
+               AppSecureLogExceptionTag(tag, __VA_ARGS__); \
+               expr; \
+               goto catchLabel;        \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the message is printed with a tag and a value is returned.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  tag                     Used to identify the source of a log message
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  returnValue             The value to return when the condition is @c false
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryReturnTag(tag, condition, returnValue, ...)   \
+       if (!(condition)) { \
+               AppSecureLogExceptionTag(tag, __VA_ARGS__); \
+               return returnValue;     \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the message is printed with a tag, sets the last result and a value is returned.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  tag                     Used to identify the source of a log message
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  returnValue             The value to return when the condition is @c false
+ * @param[in]  r                       The last result to set
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryReturnResultTag(tag, condition, returnValue, r, ...)  \
+       if (!(condition)) { \
+               SetLastResult(r); \
+               AppSecureLogExceptionTag(tag, __VA_ARGS__); \
+               return returnValue;     \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the message is printed with a tag, sets the last result and no value is returned.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  tag                     Used to identify the source of a log message
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  r                       The last result to set
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryReturnVoidResultTag(tag, condition, r, ...)   \
+       if (!(condition)) { \
+               SetLastResult(r); \
+               AppSecureLogExceptionTag(tag, __VA_ARGS__); \
+               return; \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the message is printed with a tag and no value is returned.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  tag                     Used to identify the source of a log message
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryReturnVoidTag(tag, condition, ...) \
+       if (!(condition)) { \
+               AppSecureLogExceptionTag(tag, __VA_ARGS__); \
+               return; \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the message is printed with a tag.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]  tag                     Used to identify the source of a log message
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  ...                     The message to display
+ * @hideinitializer
+ */
+#define SecureTryLogTag(tag, condition, ...)   \
+       if (!(condition)) { \
+               AppSecureLogTag(tag, __VA_ARGS__); \
+       } \
+       else {;}
+
+/**
+ * If the condition is @c false, the informative log message is printed with a tag and a value is returned.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ *
+ * @since 2.1
+ *
+ * @param[in]    tag                   Used to identify the source of a log message
+ * @param[in]    condition             The condition that is expected to be true
+ * @param[in]    returnValue           The value to return when the condition is @c false
+ * @param[in]    ...                   The message to display
+ * @hideinitializer
+ */
+#define SecureTryLogReturnTag(tag, condition, returnValue, ...) \
+       if (!(condition)) { \
+               AppSecureLogTag(tag, __VA_ARGS__); \
+               return returnValue;     \
+       } \
+       else {;}
+
 /** @} */
 
 _OSP_EXPORT_ void AppLogInternal(const char* pFunction, int lineNumber, const char* pFormat, ...);
@@ -882,7 +1343,6 @@ _OSP_EXPORT_ void AppLogTagInternal(const char* pTag, const char* pFunction, int
 _OSP_EXPORT_ void AppLogDebugTagInternal(const char* pTag, const char* pFunction, int lineNumber, const char* pFormat, ...);
 _OSP_EXPORT_ void AppLogExceptionTagInternal(const char* pTag, const char* pFunction, int lineNumber, const char* pFormat, ...);
 
-
 #ifdef __cplusplus
 }
 #endif
index 17e74e8..162fd00 100644 (file)
@@ -185,7 +185,7 @@ extern "C" {
  * The following example demonstrates how to use the SysTryLog macro.
  *
  * @code
- *     bool
+ *     void
  *     MyEngine::Init(int value)
  *     {
  *        //...
@@ -334,7 +334,7 @@ extern "C" {
  *
  * @code
  * #define E_UNKNOWN_ERROR 1
- *     bool
+ *     result
  *     MyEngine::Init(int value)
  *     {
  *        //...
@@ -342,7 +342,7 @@ extern "C" {
  *        SysTryReturnResult(NID, condition, E_UNKNOWN_ERROR, "An unexpected error has occurred.");
  *
  *        //...
- *        return true;
+ *        return E_SUCCESS;
  *     }
  * @endcode
  * @hideinitializer
@@ -370,7 +370,7 @@ extern "C" {
  * The following example demonstrates how to use the SysTryReturnVoidResult macro.
  *
  * @code
- *     bool
+ *     void
  *     MyEngine::Init(int value)
  *     {
  *        //...
@@ -378,7 +378,7 @@ extern "C" {
  *        SysTryReturnVoidResult(NID, condition,  E_INVALID_ARG, "An unexpected error has occurred.");
  *
  *        //...
- *        return true;
+ *        return;
  *     }
  * @endcode
  * @hideinitializer
@@ -606,123 +606,343 @@ case condition: \
 #else
 
 /**
-* This macro is to protect informative log messages which needs to keep security.
-* It allows display of informative log messages if compiled with "_SECURE_LOG" definition.
-* Otherwise, it will be removed in the compile time.
-* This system log macro is for the platform modules.
-*
-* @since 2.1
-*
-* @param[in]   NID                     The Tizen namespace ID
-* @param[in]   ...                     The message to display
-*
-* The following example demonstrates how to use the SysSecureLog macro.
-*
-* @code
-*        bool
-*        MyEngine::Init(int value)
-*        {
-*           SysSecureLog(NID, "User ID : 'JoneDoe'");
-*
-*           return true;
-*        }
-* @endcode
-* @hideinitializer
-*/
+ * This macro is to protect informative log messages which needs to keep security.
+ * It allows display of informative log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, it will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace ID
+ * @param[in]  ...                     The message to display
+ *
+ * The following example demonstrates how to use the SysSecureLog macro.
+ *
+ * @code
+ *        bool
+ *        MyEngine::Init(int value)
+ *        {
+ *           SysSecureLog(NID, "User ID : 'JoneDoe'");
+ *
+ *           return true;
+ *        }
+ * @endcode
+ * @hideinitializer
+ */
 #define SysSecureLog(NID, ...)
 
 /**
-* This macro is to protect exception log messages which needs to keep security, and sets the last result.
-* It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
-* Otherwise, it will be removed in the compile time.
-* This system log macro is for the platform modules.
-*
-* @since 2.1
-*
-* @param[in]   NID                     The Tizen namespace ID
-* @param[in]   r                       The last result to set
-* @param[in]   ...                     The message to display
-*
-* The following example demonstrates how to use the SysSecureLogException macro.
-*
-* @code
-*        bool
-*        MyEngine::Init(int value)
-*        {
-*           //...
-*           if (something_wrong)
-*           {
-*              SysSecureLogException(NID,  E_INVALID_ARG, "User ID : 'JoneDoe' mismatch.");
-*
-*              return false;
-*           }
-*   //...
-*
-*           return true;
-*        }
-* @endcode
-* @hideinitializer
-*/
-#define SysSecureLogException(NID, r,...)
-
-/**
-* This macro is to protect informative log messages which needs to keep security, with a tag.
-* It allows display of informative log messages if compiled with "_SECURE_LOG" definition.
-* Otherwise, it will be removed in the compile time.
-* This system log macro is for the platform modules.
-*
-* @since 2.1
-*
-* @param[in]   NID                     The Tizen namespace ID
-* @param[in]   tag                     The user defined tag
-* @param[in]   ...                     The message to display
-*
-* The following example demonstrates how to use the SysSecureLogTag macro.
-*
-* @code
-*        bool
-*        MyEngine::Init(int value)
-*        {
-*           SysSecureLogTag(NID, "MyTag", "User ID : 'JoneDoe'");
-*
-*           return true;
-*        }
-* @endcode
-* @hideinitializer
-*/
+ * This macro is to protect exception log messages which needs to keep security, and sets the last result.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace ID
+ * @param[in]  r                       The last result to set
+ * @param[in]  ...                     The message to display
+ *
+ * The following example demonstrates how to use the SysSecureLogException macro.
+ *
+ * @code
+ *        bool
+ *        MyEngine::Init(int value)
+ *        {
+ *           //...
+ *           if (something_wrong)
+ *           {
+ *              SysSecureLogException(NID,  E_INVALID_ARG, "User ID : 'JoneDoe' mismatch.");
+ *
+ *              return false;
+ *           }
+ *   //...
+ *
+ *           return true;
+ *        }
+ * @endcode
+ * @hideinitializer
+ */
+#define SysSecureLogException(NID, r,...)                      SetLastResult(r);
+
+/**
+ * This macro is to protect informative log messages which needs to keep security, with a tag.
+ * It allows display of informative log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, it will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace ID
+ * @param[in]  tag                     The user defined tag
+ * @param[in]  ...                     The message to display
+ *
+ * The following example demonstrates how to use the SysSecureLogTag macro.
+ *
+ * @code
+ *        bool
+ *        MyEngine::Init(int value)
+ *        {
+ *           SysSecureLogTag(NID, "MyTag", "User ID : 'JoneDoe'");
+ *
+ *           return true;
+ *        }
+ * @endcode
+ * @hideinitializer
+ */
 #define SysSecureLogTag(NID, tag, ...)
 
 /**
-* This macro is to protect exception log messages which needs to keep security, with a tag and sets the last result.
-* It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
-* Otherwise, it will be removed in the compile time.
-* This system log macro is for the platform modules.
-*
-* @since 2.1
-*
-* @param[in]   NID                     The Tizen namespace ID
-* @param[in]   tag                     The user defined tag
-* @param[in]   r                       The last result to set
-* @param[in]   ...                     The message to display
-*
-* The following example demonstrates how to use the SysSecureLogExceptionTag macro.
-*
-* @code
-*        bool
-*        MyEngine::Init(int value)
-*        {
-*           SysSecureLogExceptionTag(NID, "MyTag", E_INVALID_ARG, "User ID : 'JoneDoe' mismatch.");
-*
-*           return true;
-*        }
-* @endcode
-* @hideinitializer
-*/
-#define SysSecureLogExceptionTag(NID, tag, r, ...)
+ * This macro is to protect exception log messages which needs to keep security, with a tag and sets the last result.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace ID
+ * @param[in]  tag                     The user defined tag
+ * @param[in]  r                       The last result to set
+ * @param[in]  ...                     The message to display
+ *
+ * The following example demonstrates how to use the SysSecureLogExceptionTag macro.
+ *
+ * @code
+ *        bool
+ *        MyEngine::Init(int value)
+ *        {
+ *           SysSecureLogExceptionTag(NID, "MyTag", E_INVALID_ARG, "User ID : 'JoneDoe' mismatch.");
+ *
+ *           return true;
+ *        }
+ * @endcode
+ * @hideinitializer
+ */
+#define SysSecureLogExceptionTag(NID, tag, r, ...)             SetLastResult(r);
+
+#endif
+
+/**
+ * This macro allows display of informative log message with a tag, when the condition is @c false.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]          ...                     The message to display
+ *
+ * The following example demonstrates how to use the SysSecureTry macro.
+ *
+ * @code
+ *     bool
+ *     MyEngine::Init(int value)
+ *     {
+ *        //...
+ *
+ *        SysSecureTryLog(NID, condition, "Password mismatch : %s", password );
+ *
+ *        //...
+ *     }
+ * @endcode
+ * @hideinitializer
+ */
+#define SysSecureTryLog(NID, condition, ...) \
+       do \
+       { \
+               if (unlikely(!(condition))) {   \
+                       SysSecureLog(NID, __VA_ARGS__); \
+               } \
+       } while (0);
+
+/**
+ * This macro allows display of informative log message, when the condition is @c false.
+ * Executes statements and goes to label.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  expr                    Expressions that are evaluated before going to CATCH label
+ * @param[in]   ...                    The message to display
+ * @hideinitializer
+ */
+#define SysSecureTryLogCatch(NID, condition, expr, ...)        \
+       do \
+       { \
+               if (unlikely(!(condition))) { \
+                       SysSecureLog(NID, __VA_ARGS__); \
+                       expr; \
+                       goto CATCH;     \
+               } \
+       } while (0);
+
+/**
+ * This macro allows display of informative log message and returns returnValue, when the condition is @c false.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  returnValue             The value to return when the condition is @c false
+ * @param[in]   ...                    The message to display
+ * @hideinitializer
+ */
+#define SysSecureTryLogReturn(NID, condition, returnValue, ...) \
+       do \
+       { \
+               if (unlikely(!(condition))) { \
+                       SysSecureLog(NID, __VA_ARGS__); \
+                       return returnValue;     \
+               } \
+       } while (0);
 
+/**
+ * This macro allows display of exception log message with a tag and sets the last result, when the condition is @c false.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  returnValue             The value to return when the condition is @c false
+ * @param[in]  r                       The last result to set
+ * @param[in]   ...                    The message to display
+ * @hideinitializer
+ */
+#define SysSecureTryReturn(NID, condition, returnValue, r, ...) \
+       do \
+       { \
+               if (unlikely(!(condition))) {   \
+                       SysSecureLogException(NID, r, __VA_ARGS__); \
+                       return returnValue;     \
+               } \
+       } while (0);
+
+#if defined(_SECURE_LOG)
+/**
+ * This macro allows display of exception log message with a tag and sets the last result, when the condition is @c false.
+ * This is a shorthand macro for SysSecureTryReturn(NID, condition, r, r, "[" # r "] " ...).
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  r                       The last result to set
+ * @param[in]   ...                    The message to display
+ * @hideinitializer
+ */
+#define SysSecureTryReturnResult(NID, condition, r, ...) \
+       do \
+       { \
+               if (unlikely(!(condition))) {   \
+                       SysTryReturnResultInternal(NID, r, __PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__); \
+                       return r;       \
+               } \
+       } while (0);
+
+#else
+#define SysSecureTryReturnResult(NID, condition, r, ...) \
+       do \
+       { \
+               if (unlikely(!(condition))) {   \
+                       SetLastResult(r); \
+                       return r;       \
+               } \
+       } while (0);
 #endif
 
 /**
+ * This macro allows display of exception log message with a tag and sets the last result, when the condition is @c false.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  r                       The last result to set
+ * @param[in]   ...                    The message to display
+ * @hideinitializer
+ */
+#define SysSecureTryReturnVoidResult(NID, condition, r, ...)   \
+       do \
+       { \
+               if (unlikely(!(condition))) {   \
+                       SysSecureLogException(NID, r, __VA_ARGS__); \
+                       return; \
+               } \
+       } while (0);
+
+/**
+ * This macro allows display of exception log message with a tag, when the condition is @c false.
+ * Executes statements, sets the last result and goes to label.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  expr                    Expressions that are evaluated before going to CATCH label
+ * @param[in]  r                       The last result to set
+ * @param[in]   ...                    The message to display
+ * @hideinitializer
+ */
+#define SysSecureTryCatch(NID, condition, expr, r, ...) \
+       do \
+       { \
+               if (unlikely(!(condition))) {   \
+                       SysSecureLogException(NID, r, __VA_ARGS__); \
+                       expr; \
+                       goto CATCH;     \
+               } \
+       } while (0);
+
+/**
+ * This macro allows display of exception log message with a tag, when the condition is @c false.
+ * Executes statements, sets the last result and goes to label.
+ * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
+ * Otherwise, log printing functionality will be removed in the compile time.
+ * This system log macro is for the platform modules.
+ *
+ * @since 2.1
+ *
+ * @param[in]  NID                     The Tizen namespace
+ * @param[in]  condition               The condition that is expected to be true
+ * @param[in]  expr                    Expressions that are evaluated before going to catchLabel label
+ * @param[in]  catchLabel              The label for goto operation
+ * @param[in]  r                       The last result to set
+ * @param[in]   ...                    The message to display
+ * @hideinitializer
+ */
+#define SysSecureTryCatchLabel(NID, condition, expr, catchLabel, r, ...) \
+       do \
+       { \
+               if (unlikely(!(condition))) {   \
+                       SysSecureLogException(NID, r, __VA_ARGS__); \
+                       expr; \
+                       goto catchLabel; \
+               } \
+       } while (0);
+
+
+/**
  * Defines the log ID.
  */
 enum LogID