2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
19 * @brief This is the header file for the diagnostic types.
21 * This header file defines the diagnostic types.
28 #include <FOspConfig.h>
35 * @defgroup GroupMacros Debugging Macros
37 * This page describes Tizen debugging macros.
42 #if defined(_APP_LOG) || defined(_OSP_DEBUG_) || defined(_DEBUG)
46 #define AppLog(...) AppLogInternal(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
47 #define AppLogDebug(...) AppLogDebugInternal(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
48 #define AppLogException(...) AppLogExceptionInternal(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
50 #define AppLogTag(tag, ...) AppLogTagInternal(tag, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
51 #define AppLogDebugTag(tag, ...) AppLogDebugTagInternal(tag, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
52 #define AppLogExceptionTag(tag, ...) AppLogExceptionTagInternal(tag, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
54 #define AppLogIf(expression, ...) \
56 AppLogInternal(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__); \
60 #define AppLogDebugIf(expression, ...) \
62 AppLogDebugInternal(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__); \
66 #define AppLogExceptionIf(expression, ...) \
68 AppLogExceptionInternal(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__); \
72 #define AppAssert(condition) \
74 AppassertInternal(__PRETTY_FUNCTION__, __LINE__); \
78 #define AppAssertf(condition, ...) \
80 AppassertfInternal(# condition, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__); \
83 #else // defined(_APP_LOG)
86 * @addtogroup GroupMacros
91 * This macro allows display of arbitrary messages for future examination.
95 * @param[in] ... The message to display
97 * The following example demonstrates how to use the AppLog macro.
101 * MyEngine::Init(int value)
103 * AppLog("Initialization successful.");
113 * This macro must be added in your program if you want the debug messages to be displayed in the output.
117 * @param[in] ... The message to display
119 * @image html debugging_applog_output.png
121 * The following example demonstrates how to use the AppLogDebug macro.
125 * MyEngine::Init(int value)
127 * AppLogDebug("Invoked with value: %d", value);
131 * AppLogDebug("Exit.");
138 #define AppLogDebug(...)
141 * This macro must be added in your program if you want the exception messages to be displayed in the output.
145 * @param[in] ... The message to display
147 * The following example demonstrates how to use the AppLogException macro.
151 * MyEngine::Init(int value)
153 * AppLogDebug("Invoked with value: %d", value);
155 * if (something_wrong) // The Try family macros can be used instead.
157 * AppLogException("An unexpected error occurred.");
162 * AppLog("Initialization successful.");
163 * AppLogDebug("Exit.");
170 #define AppLogException(...)
173 * This macro is used to check logical errors in a program.
174 * If the assertion fails, the current process is killed.
178 * @param[in] condition The condition that is expected to be true
181 #define AppAssert(condition)
184 * This macro is used to check logical errors in a program.
185 * If the assertion fails, a message is printed on the console and the current process is killed.
189 * @param[in] condition The condition that is expected to be true
190 * @param[in] ... The message to print, if the assertion fails
192 * @image html debugging_appassert.png
194 * The following example demonstrates how to use the Assert macro.
198 * MyClass::DoSomething(void)
200 * result r = E_SUCCESS;
201 * r = mutex.Acquire();
203 * r = mutex.Release();
205 * // If false, console prints "Mutex Release Failed."
206 * // and the process is killed.
207 * AppAssertf(r == E_SUCCESS, "Mutex Release Failed.");
214 #define AppAssertf(condition, ...)
217 * This macro is added in a program to display a message when an expression is @c true.
221 * @param[in] expression The expression to evaluate
222 * @param[in] ... The message to display
224 * The following example demonstrates how to use the AppLogIf macro.
228 * MyEngine::Init(int value)
230 * AppLogIf(value !=0, "Invoked with value: %d", value);
238 #define AppLogIf(expression, ...)
241 * This macro is added in a program to display a debug message when an expression is @c true.
245 * @param[in] expression The expression to evaluate
246 * @param[in] ... The message to display
248 * The following example demonstrates how to use the AppLogDebugIf macro.
252 * MyEngine::Init(int value)
254 * AppLogDebugIf(value !=0, "Invoked with value: %d", value);
262 #define AppLogDebugIf(expression, ...)
265 * This macro is added in a program to display an exception message when an expression is @c true.
269 * @param[in] expression The expression to evaluate
270 * @param[in] ... The message to display
272 * The following example demonstrates how to use the AppLogExceptionIf macro.
276 * MyEngine::Init(int value)
280 * AppLogExceptionIf(status != 0, "status : %d.", status);
288 #define AppLogExceptionIf(expression, ...)
291 * This macro is added in a program to display an info message with a tag.
295 * @param[in] tag Used to identify the source of a log message
296 * @param[in] ... The message to display
298 * The following example demonstrates how to use the AppLogTag macro.
302 * MyEngine::Init(int value)
306 * AppLogTag("MyTag", "Initialization successful.");
314 #define AppLogTag(tag, ...)
317 * This macro is added in a program to display a debug message with a tag.
321 * @param[in] tag Used to identify the source of a log message
322 * @param[in] ... The message to display
324 * The following example demonstrates how to use the AppLogDebugTag macro.
328 * MyEngine::Init(int value)
330 * AppLogDebugTag("MyTag", "Invoked with value: %d", value);
334 * AppLogDebugTag("MyTag", "Exit.");
341 #define AppLogDebugTag(tag, ...)
344 * This macro is added in a program to display an exception message with a tag.
348 * @param[in] tag Used to identify the source of a log message
349 * @param[in] ... The message to display
351 * The following example demonstrates how to use the AppLogExceptionTag macro.
355 * MyEngine::Init(int value)
357 * AppLogDebug("Invoked with value: %d", value);
359 * if (something_wrong) // The Try family macros can be used instead.
361 * AppLogExceptionTag("MyTag", "An unexpected error occurred.");
366 * AppLog("Initialization successful.");
367 * AppLogDebug("Exit.");
374 #define AppLogExceptionTag(tag, ...)
376 #endif // defined(_APP_LOG)
380 * @addtogroup GroupMacros
385 * If the condition is @c false, it prints a message, evaluates a cleanup expression,
386 * and goes to <tt>CATCH</tt>.
390 * @param[in] condition The condition that is expected to be true
391 * @param[in] expr Expressions that are evaluated before going to CATCH label
392 * @param[in] ... The message to display
394 * The following example demonstrates how to use the Try macro.
398 * MyClass::DoSomething(const wchar_t* pValue)
400 * result r = E_SUCCESS;
404 * // If pValue is null, print "pValue == null" to the
405 * // console and return E_INVALID_ARG.
406 * TryCatch(pValue != null, r = E_INVALID_ARG, "pValue == null");
408 * SetLastResult(E_SUCCESS);
420 #define TryCatch(condition, expr, ...) \
421 if (!(condition)) { \
422 AppLogException(__VA_ARGS__); \
429 * If the condition is @c false, it prints a message, sets the last result, evaluates a cleanup expression
430 * and goes to <tt>CATCH</tt>.
434 * @param[in] condition The condition that is expected to be true
435 * @param[in] expr Expressions that are evaluated before going to CATCH label
436 * @param[in] r The last result to set
437 * @param[in] ... The message to display
440 #define TryCatchResult(condition, expr, r, ...) \
441 if (!(condition)) { \
443 AppLogException(__VA_ARGS__); \
450 * If the condition is @c false, it prints a message, sets the last result, evaluates a cleanup expression
455 * @param[in] condition The condition that is expected to be true
456 * @param[in] expr Expressions that are evaluated before going to catchLabel
457 * @param[in] catchLabel The label for goto operation
458 * @param[in] r The last result to set
459 * @param[in] ... The message to display
462 #define TryCatchLabelResult(condition, expr, catchLabel, r, ...) \
463 if (!(condition)) { \
465 AppLogException(__VA_ARGS__); \
472 * If the condition is @c false, the message is printed and a value is returned.
476 * @param[in] condition The condition that is expected to be true
477 * @param[in] returnValue The value to return when the condition is @c false
478 * @param[in] ... The message to display
481 #define TryReturn(condition, returnValue, ...) \
482 if (!(condition)) { \
483 AppLogException(__VA_ARGS__); \
484 return returnValue; \
489 * If the condition is @c false, the message is printed, sets the last result and a value is returned.
493 * @param[in] condition The condition that is expected to be true
494 * @param[in] returnValue The value to return when the condition is @c false
495 * @param[in] r The last result to set
496 * @param[in] ... The message to display
499 #define TryReturnResult(condition, returnValue, r, ...) \
500 if (!(condition)) { \
502 AppLogException(__VA_ARGS__); \
503 return returnValue; \
508 * If the condition is @c false, the message is printed, sets the last result and no value is returned.
512 * @param[in] condition The condition that is expected to be true
513 * @param[in] r The last result to set
514 * @param[in] ... The message to display
517 #define TryReturnVoidResult(condition, r, ...) \
518 if (!(condition)) { \
520 AppLogException(__VA_ARGS__); \
526 * If the condition is @c false, the message is printed and no value is returned.
530 * @param[in] condition The condition that is expected to be true
531 * @param[in] ... The message to display
534 #define TryReturnVoid(condition, ...) \
535 if (!(condition)) { \
536 AppLogException(__VA_ARGS__); \
542 * If the condition is @c false, the message is printed.
546 * @param[in] condition The condition that is expected to be true
547 * @param[in] ... The message to display
550 #define TryLog(condition, ...) \
551 if (!(condition)) { \
552 AppLog(__VA_ARGS__); \
557 * If the condition is @c false, the informative log message is printed and a value is returned.
561 * @param[in] condition The condition that is expected to be true
562 * @param[in] returnValue The value to return when the condition is @c false
563 * @param[in] ... The message to display
566 #define TryLogReturn(condition, returnValue, ...) \
567 if (!(condition)) { \
568 AppLog(__VA_ARGS__); \
569 return returnValue; \
576 * If the condition is @c false, it prints a message with a tag, evaluates a cleanup expression
577 * and goes to <tt>CATCH</tt>.
581 * @param[in] tag Used to identify the source of a log message
582 * @param[in] condition The condition that is expected to be true
583 * @param[in] expr Expressions that are evaluated before going to CATCH label
584 * @param[in] ... The message to display
587 #define TryCatchTag(tag, condition, expr, ...) \
588 if (!(condition)) { \
589 AppLogExceptionTag(tag, __VA_ARGS__); \
596 * If the condition is @c false, it prints a message with a tag, sets the last result, evaluates a cleanup expression,
597 * and goes to <tt>CATCH</tt>.
601 * @param[in] tag Used to identify the source of a log message
602 * @param[in] condition The condition that is expected to be true
603 * @param[in] expr Expressions that are evaluated before going to CATCH label
604 * @param[in] r The last result to set
605 * @param[in] ... The message to display
608 #define TryCatchResultTag(tag, condition, expr, r, ...) \
609 if (!(condition)) { \
611 AppLogExceptionTag(tag, __VA_ARGS__); \
618 * If the condition is @c false, it prints a message with a tag, sets the last result, evaluates a cleanup expression
623 * @param[in] tag Used to identify the source of a log message
624 * @param[in] condition The condition that is expected to be true
625 * @param[in] expr Expressions that are evaluated before going to catchLabel
626 * @param[in] catchLabel The label for goto operation
627 * @param[in] r The last result to set
628 * @param[in] ... The message to display
631 #define TryCatchLabelResultTag(tag, condition, expr, catchLabel, r, ...) \
632 if (!(condition)) { \
634 AppLogExceptionTag(tag, __VA_ARGS__); \
641 * If the condition is @c false, the message is printed with a tag and a value is returned.
645 * @param[in] tag Used to identify the source of a log message
646 * @param[in] condition The condition that is expected to be true
647 * @param[in] returnValue The value to return when the condition is @c false
648 * @param[in] ... The message to display
651 #define TryReturnTag(tag, condition, returnValue, ...) \
652 if (!(condition)) { \
653 AppLogExceptionTag(tag, __VA_ARGS__); \
654 return returnValue; \
659 * If the condition is @c false, the message is printed with a tag, sets the last result and a value is returned.
663 * @param[in] tag Used to identify the source of a log message
664 * @param[in] condition The condition that is expected to be true
665 * @param[in] returnValue The value to return when the condition is @c false
666 * @param[in] r The last result to set
667 * @param[in] ... The message to display
670 #define TryReturnResultTag(tag, condition, returnValue, r, ...) \
671 if (!(condition)) { \
673 AppLogExceptionTag(tag, __VA_ARGS__); \
674 return returnValue; \
679 * If the condition is @c false, the message is printed with a tag, sets the last result and no value is returned.
683 * @param[in] tag Used to identify the source of a log message
684 * @param[in] condition The condition that is expected to be true
685 * @param[in] r The last result to set
686 * @param[in] ... The message to display
689 #define TryReturnVoidResultTag(tag, condition, r, ...) \
690 if (!(condition)) { \
692 AppLogExceptionTag(tag, __VA_ARGS__); \
698 * If the condition is @c false, the message is printed with a tag and no value is returned.
702 * @param[in] tag Used to identify the source of a log message
703 * @param[in] condition The condition that is expected to be true
704 * @param[in] ... The message to display
707 #define TryReturnVoidTag(tag, condition, ...) \
708 if (!(condition)) { \
709 AppLogExceptionTag(tag, __VA_ARGS__); \
715 * If the condition is @c false, the message is printed with a tag.
719 * @param[in] tag Used to identify the source of a log message
720 * @param[in] condition The condition that is expected to be true
721 * @param[in] ... The message to display
724 #define TryLogTag(tag, condition, ...) \
725 if (!(condition)) { \
726 AppLogTag(tag, __VA_ARGS__); \
731 * If the condition is @c false, the informative log message is printed with a tag and a value is returned.
735 * @param[in] tag Used to identify the source of a log message
736 * @param[in] condition The condition that is expected to be true
737 * @param[in] returnValue The value to return when the condition is @c false
738 * @param[in] ... The message to display
741 #define TryLogReturnTag(tag, condition, returnValue, ...) \
742 if (!(condition)) { \
743 AppLogTag(tag, __VA_ARGS__); \
744 return returnValue; \
753 * @addtogroup GroupMacros
758 #if (defined(_APP_LOG) || defined(_OSP_DEBUG_) || defined(_DEBUG)) && defined(_SECURE_LOG)
760 #define AppSecureLog(...) AppLogInternal(__PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
761 #define AppSecureLogDebug(...) AppLogDebugInternal(__PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
762 #define AppSecureLogException(...) AppLogExceptionInternal(__PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
764 #define AppSecureLogTag(tag, ...) AppLogTagInternal(tag, __PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
765 #define AppSecureLogDebugTag(tag, ...) AppLogDebugTagInternal(tag, __PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
766 #define AppSecureLogExceptionTag(tag, ...) AppLogExceptionTagInternal(tag, __PRETTY_FUNCTION__, __LINE__, "[SECURE_LOG] "__VA_ARGS__)
770 * This macro is to protect informative log messages which needs to keep security.
771 * It allows display of informative log messages if compiled with "_SECURE_LOG" definition.
772 * Otherwise, it will be removed in the compile time.
776 * @param[in] ... The message to display
778 * The following example demonstrates how to use the AppSecureLog macro.
782 * MyEngine::Init(int value)
784 * AppSecureLog("User ID : 'JoneDoe'");
791 #define AppSecureLog(...)
794 * This macro is to protect debug log messages which needs to keep security.
795 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
796 * Otherwise, it will be removed in the compile time.
800 * @param[in] ... The message to display
802 * The following example demonstrates how to use the AppSecureLogDebug macro.
806 * MyEngine::Init(int value)
809 * if (something_wrong)
811 * AppSecureLogDebug("User ID : 'JoneDoe' mismatch.");
822 #define AppSecureLogDebug(...)
825 * This macro is to protect exception log messages which needs to keep security.
826 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
827 * Otherwise, it will be removed in the compile time.
831 * @param[in] ... The message to display
833 * The following example demonstrates how to use the AppSecureLogException macro.
837 * MyEngine::Init(int value)
840 * if (something_wrong)
842 * AppSecureLogException("User ID : 'JoneDoe' mismatch.");
853 #define AppSecureLogException(...)
856 * This macro is to protect informative log messages which needs to keep security, with a tag.
857 * It allows display of informative log messages if compiled with "_SECURE_LOG" definition.
858 * Otherwise, it will be removed in the compile time.
862 * @param[in] tag The user defined tag
863 * @param[in] ... The message to display
865 * The following example demonstrates how to use the AppSecureLogTag macro.
869 * MyEngine::Init(int value)
871 * AppSecureLogTag("MyTag", "User ID : 'JoneDoe'");
878 #define AppSecureLogTag(tag, ...)
881 * This macro is to protect debug log messages which needs to keep security, with a tag.
882 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
883 * Otherwise, it will be removed in the compile time.
887 * @param[in] tag The user defined tag
888 * @param[in] ... The message to display
890 * The following example demonstrates how to use the AppSecureLogDebugTag macro.
894 * MyEngine::Init(int value)
896 * AppSecureLogDebugTag("MyTag", "User ID : 'JoneDoe' mismatch.");
903 #define AppSecureLogDebugTag(tag, ...)
906 * This macro is to protect exception log messages which needs to keep security, with a tag.
907 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
908 * Otherwise, it will be removed in the compile time.
912 * @param[in] tag The user defined tag
913 * @param[in] ... The message to display
915 * The following example demonstrates how to use the AppSecureLogExceptionTag macro.
919 * MyEngine::Init(int value)
921 * AppSecureLogExceptionTag("MyTag", "User ID : 'JoneDoe' mismatch.");
928 #define AppSecureLogExceptionTag(tag, ...)
933 * If the condition is @c false, it prints a message, evaluates a cleanup expression,
934 * and goes to <tt>CATCH</tt>.
935 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
936 * Otherwise, log printing functionality will be removed in the compile time.
940 * @param[in] condition The condition that is expected to be true
941 * @param[in] expr Expressions that are evaluated before going to CATCH label
942 * @param[in] ... The message to display
944 * The following example demonstrates how to use the SecureTry macro.
948 * MyClass::DoSomething(const String* passwd)
950 * result r = E_SUCCESS;
954 * // If password is wrong, print "[E_INVALID_ARG] The password '1234' is wrong." to the console
955 * // execute the expression "r = E_INVALID_ARG", and move to CATCH
956 * SecureTryCatch(*passwd != refPasswd, r = E_INVALID_ARG, "[E_INVALID_ARG] The password '%ls' is wrong.", passwd->GetPointer());
958 * SetLastResult(E_SUCCESS);
960 * return E_SUCCESS;// execute the expression "r = E_INVALID_ARG", and move to CATCH
971 #define SecureTryCatch(condition, expr, ...) \
972 if (!(condition)) { \
973 AppSecureLogException(__VA_ARGS__); \
980 * If the condition is @c false, it prints a message, sets the last result, evaluates a cleanup expression
981 * and goes to <tt>CATCH</tt>.
982 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
983 * Otherwise, log printing functionality will be removed in the compile time.
987 * @param[in] condition The condition that is expected to be true
988 * @param[in] expr Expressions that are evaluated before going to CATCH label
989 * @param[in] r The last result to set
990 * @param[in] ... The message to display
993 #define SecureTryCatchResult(condition, expr, r, ...) \
994 if (!(condition)) { \
996 AppSecureLogException(__VA_ARGS__); \
1003 * If the condition is @c false, it prints a message, sets the last result, evaluates a cleanup expression
1004 * and goes to label.
1005 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1006 * Otherwise, log printing functionality will be removed in the compile time.
1010 * @param[in] condition The condition that is expected to be true
1011 * @param[in] expr Expressions that are evaluated before going to catchLabel
1012 * @param[in] catchLabel The label for goto operation
1013 * @param[in] r The last result to set
1014 * @param[in] ... The message to display
1017 #define SecureTryCatchLabelResult(condition, expr, catchLabel, r, ...) \
1018 if (!(condition)) { \
1020 AppSecureLogException(__VA_ARGS__); \
1027 * If the condition is @c false, the message is printed and a value is returned.
1028 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1029 * Otherwise, log printing functionality will be removed in the compile time.
1033 * @param[in] condition The condition that is expected to be true
1034 * @param[in] returnValue The value to return when the condition is @c false
1035 * @param[in] ... The message to display
1038 #define SecureTryReturn(condition, returnValue, ...) \
1039 if (!(condition)) { \
1040 AppSecureLogException(__VA_ARGS__); \
1041 return returnValue; \
1046 * If the condition is @c false, the message is printed, sets the last result and a value is returned.
1047 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1048 * Otherwise, log printing functionality will be removed in the compile time.
1052 * @param[in] condition The condition that is expected to be true
1053 * @param[in] returnValue The value to return when the condition is @c false
1054 * @param[in] r The last result to set
1055 * @param[in] ... The message to display
1058 #define SecureTryReturnResult(condition, returnValue, r, ...) \
1059 if (!(condition)) { \
1061 AppSecureLogException(__VA_ARGS__); \
1062 return returnValue; \
1067 * If the condition is @c false, the message is printed, sets the last result and no value is returned.
1068 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1069 * Otherwise, log printing functionality will be removed in the compile time.
1073 * @param[in] condition The condition that is expected to be true
1074 * @param[in] r The last result to set
1075 * @param[in] ... The message to display
1078 #define SecureTryReturnVoidResult(condition, r, ...) \
1079 if (!(condition)) { \
1081 AppSecureLogException(__VA_ARGS__); \
1087 * If the condition is @c false, the message is printed and no value is returned.
1088 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1089 * Otherwise, log printing functionality will be removed in the compile time.
1093 * @param[in] condition The condition that is expected to be true
1094 * @param[in] ... The message to display
1097 #define SecureTryReturnVoid(condition, ...) \
1098 if (!(condition)) { \
1099 AppSecureLogException(__VA_ARGS__); \
1105 * If the condition is @c false, the message is printed.
1106 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1107 * Otherwise, log printing functionality will be removed in the compile time.
1111 * @param[in] condition The condition that is expected to be true
1112 * @param[in] ... The message to display
1115 #define SecureTryLog(condition, ...) \
1116 if (!(condition)) { \
1117 AppSecureLog(__VA_ARGS__); \
1122 * If the condition is @c false, the informative log message is printed and a value is returned.
1123 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1124 * Otherwise, log printing functionality will be removed in the compile time.
1128 * @param[in] condition The condition that is expected to be true
1129 * @param[in] returnValue The value to return when the condition is @c false
1130 * @param[in] ... The message to display
1133 #define SecureTryLogReturn(condition, returnValue, ...) \
1134 if (!(condition)) { \
1135 AppSecureLog(__VA_ARGS__); \
1136 return returnValue; \
1140 // SecureTryTag Macros
1143 * If the condition is @c false, it prints a message with a tag, evaluates a cleanup expression
1144 * and goes to <tt>CATCH</tt>.
1145 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1146 * Otherwise, log printing functionality will be removed in the compile time.
1150 * @param[in] tag Used to identify the source of a log message
1151 * @param[in] condition The condition that is expected to be true
1152 * @param[in] expr Expressions that are evaluated before going to CATCH label
1153 * @param[in] ... The message to display
1156 #define SecureTryCatchTag(tag, condition, expr, ...) \
1157 if (!(condition)) { \
1158 AppSecureLogExceptionTag(tag, __VA_ARGS__); \
1165 * If the condition is @c false, it prints a message with a tag, sets the last result, evaluates a cleanup expression,
1166 * and goes to <tt>CATCH</tt>.
1167 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1168 * Otherwise, log printing functionality will be removed in the compile time.
1172 * @param[in] tag Used to identify the source of a log message
1173 * @param[in] condition The condition that is expected to be true
1174 * @param[in] expr Expressions that are evaluated before going to CATCH label
1175 * @param[in] r The last result to set
1176 * @param[in] ... The message to display
1179 #define SecureTryCatchResultTag(tag, condition, expr, r, ...) \
1180 if (!(condition)) { \
1182 AppSecureLogExceptionTag(tag, __VA_ARGS__); \
1189 * If the condition is @c false, it prints a message with a tag, sets the last result, evaluates a cleanup expression
1190 * and goes to label.
1191 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1192 * Otherwise, log printing functionality will be removed in the compile time.
1196 * @param[in] tag Used to identify the source of a log message
1197 * @param[in] condition The condition that is expected to be true
1198 * @param[in] expr Expressions that are evaluated before going to catchLabel
1199 * @param[in] catchLabel The label for goto operation
1200 * @param[in] r The last result to set
1201 * @param[in] ... The message to display
1204 #define SecureTryCatchLabelResultTag(tag, condition, expr, catchLabel, r, ...) \
1205 if (!(condition)) { \
1207 AppSecureLogExceptionTag(tag, __VA_ARGS__); \
1214 * If the condition is @c false, the message is printed with a tag and a value is returned.
1215 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1216 * Otherwise, log printing functionality will be removed in the compile time.
1220 * @param[in] tag Used to identify the source of a log message
1221 * @param[in] condition The condition that is expected to be true
1222 * @param[in] returnValue The value to return when the condition is @c false
1223 * @param[in] ... The message to display
1226 #define SecureTryReturnTag(tag, condition, returnValue, ...) \
1227 if (!(condition)) { \
1228 AppSecureLogExceptionTag(tag, __VA_ARGS__); \
1229 return returnValue; \
1234 * If the condition is @c false, the message is printed with a tag, sets the last result and a value is returned.
1235 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1236 * Otherwise, log printing functionality will be removed in the compile time.
1240 * @param[in] tag Used to identify the source of a log message
1241 * @param[in] condition The condition that is expected to be true
1242 * @param[in] returnValue The value to return when the condition is @c false
1243 * @param[in] r The last result to set
1244 * @param[in] ... The message to display
1247 #define SecureTryReturnResultTag(tag, condition, returnValue, r, ...) \
1248 if (!(condition)) { \
1250 AppSecureLogExceptionTag(tag, __VA_ARGS__); \
1251 return returnValue; \
1256 * If the condition is @c false, the message is printed with a tag, sets the last result and no value is returned.
1257 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1258 * Otherwise, log printing functionality will be removed in the compile time.
1262 * @param[in] tag Used to identify the source of a log message
1263 * @param[in] condition The condition that is expected to be true
1264 * @param[in] r The last result to set
1265 * @param[in] ... The message to display
1268 #define SecureTryReturnVoidResultTag(tag, condition, r, ...) \
1269 if (!(condition)) { \
1271 AppSecureLogExceptionTag(tag, __VA_ARGS__); \
1277 * If the condition is @c false, the message is printed with a tag and no value is returned.
1278 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1279 * Otherwise, log printing functionality will be removed in the compile time.
1283 * @param[in] tag Used to identify the source of a log message
1284 * @param[in] condition The condition that is expected to be true
1285 * @param[in] ... The message to display
1288 #define SecureTryReturnVoidTag(tag, condition, ...) \
1289 if (!(condition)) { \
1290 AppSecureLogExceptionTag(tag, __VA_ARGS__); \
1296 * If the condition is @c false, the message is printed with a tag.
1297 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1298 * Otherwise, log printing functionality will be removed in the compile time.
1302 * @param[in] tag Used to identify the source of a log message
1303 * @param[in] condition The condition that is expected to be true
1304 * @param[in] ... The message to display
1307 #define SecureTryLogTag(tag, condition, ...) \
1308 if (!(condition)) { \
1309 AppSecureLogTag(tag, __VA_ARGS__); \
1314 * If the condition is @c false, the informative log message is printed with a tag and a value is returned.
1315 * It allows display of exception log messages if compiled with "_SECURE_LOG" definition.
1316 * Otherwise, log printing functionality will be removed in the compile time.
1320 * @param[in] tag Used to identify the source of a log message
1321 * @param[in] condition The condition that is expected to be true
1322 * @param[in] returnValue The value to return when the condition is @c false
1323 * @param[in] ... The message to display
1326 #define SecureTryLogReturnTag(tag, condition, returnValue, ...) \
1327 if (!(condition)) { \
1328 AppSecureLogTag(tag, __VA_ARGS__); \
1329 return returnValue; \
1335 _OSP_EXPORT_ void AppLogInternal(const char* pFunction, int lineNumber, const char* pFormat, ...);
1336 _OSP_EXPORT_ void AppLogDebugInternal(const char* pFunction, int lineNumber, const char* pFormat, ...);
1337 _OSP_EXPORT_ void AppLogExceptionInternal(const char* pFunction, int lineNumber, const char* pFormat, ...);
1338 _OSP_EXPORT_ void AppassertInternal(const char* pFunction, int lineNumber);
1339 _OSP_EXPORT_ void AppassertfInternal(const char* expr, const char* pFunction, int lineNumber, const char* pFormat, ...);
1341 _OSP_EXPORT_ void AppLogTagInternal(const char* pTag, const char* pFunction, int lineNumber, const char* pFormat, ...);
1342 _OSP_EXPORT_ void AppLogDebugTagInternal(const char* pTag, const char* pFunction, int lineNumber, const char* pFormat, ...);
1343 _OSP_EXPORT_ void AppLogExceptionTagInternal(const char* pTag, const char* pFunction, int lineNumber, const char* pFormat, ...);
1349 #endif // _FBASE_LOG_H_