- #define OC_LOG(level,tag,mes) LOG_(LOG_ID_MAIN, OCGetTizenLogLevel(level), tag, mes)
- #define OC_LOG_V(level,tag,fmt,args...) LOG_(LOG_ID_MAIN, OCGetTizenLogLevel(level), tag, fmt,##args)
- #define OC_LOG_BUFFER(level, tag, buffer, bufferSize)
-#else // These macros are defined for Linux, Android, and Arduino
- #define OC_LOG_INIT() OCLogInit()
- #define OC_LOG_BUFFER(level, tag, buffer, bufferSize) OCLogBuffer((level), PCF(tag), (buffer), (bufferSize))
-
- #ifdef ARDUINO
- #define OC_LOG_CONFIG(ctx)
- #define OC_LOG_SHUTDOWN()
- #define OC_LOG(level, tag, logStr) OCLog((level), PCF(tag), PCF(logStr))
- // Use full namespace for logInit to avoid function name collision
- #define OC_LOG_INIT() OCLogInit()
- // Don't define variable argument log function for Arduino
- #define OC_LOG_V(level, tag, format, ...) OCLogv((level), PCF(tag), PCF(format), __VA_ARGS__)
- #else
- #define OC_LOG_CONFIG(ctx) OCLogConfig((ctx))
- #define OC_LOG(level, tag, logStr) OCLog((level), (tag), (logStr))
- #define OC_LOG_SHUTDOWN() OCLogShutdown()
- // Define variable argument log function for Linux and Android
- #define OC_LOG_V(level, tag, ...) OCLogv((level), (tag), __VA_ARGS__)
- #endif
-#endif
-#else
- #define OC_LOG_CONFIG(ctx)
- #define OC_LOG_SHUTDOWN()
- #define OC_LOG(level, tag, logStr)
- #define OC_LOG_V(level, tag, ...)
- #define OC_LOG_BUFFER(level, tag, buffer, bufferSize)
- #define OC_LOG_INIT()
-#endif
+#define OIC_LOG(level,tag,mes) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ IF_OC_PRINT_PRIVATE_LOG_LEVEL((level)) \
+ { \
+ if ((level) == INFO_PRIVATE) \
+ LOG_(LOG_ID_MAIN, DLOG_INFO, (tag), mes); \
+ else \
+ LOG_(LOG_ID_MAIN, (level), (tag), mes); \
+ } \
+ } while(0)
+
+#define OIC_LOG_V(level,tag,fmt,args...) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ IF_OC_PRINT_PRIVATE_LOG_LEVEL((level)) \
+ { \
+ if ((level) == INFO_PRIVATE) \
+ LOG_(LOG_ID_MAIN, DLOG_INFO, (tag), fmt, ##args); \
+ else \
+ LOG_(LOG_ID_MAIN, (level), (tag), fmt, ##args); \
+ } \
+ } while(0)
+
+#define OIC_LOG_BUFFER(level, tag, buffer, bufferSize) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ OCLogBuffer((level), (tag), (buffer), (bufferSize)); \
+ } while(0)
+
+#define OIC_LOG_CA_BUFFER(level, tag, buffer, bufferSize, isHeader) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ OCPrintCALogBuffer((level), (tag), (buffer), (bufferSize), (isHeader)); \
+ } while(0)
+
+#else // NO __TIZEN__ - These macros are defined for Linux, Android, Win32, and Arduino
+#define OIC_LOG_INIT() OCLogInit()
+
+#ifdef ARDUINO
+#define OIC_LOG_BUFFER(level, tag, buffer, bufferSize) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ OCLogBuffer((level), PCF(tag), (buffer), (bufferSize)); \
+ } while(0)
+
+// Don't define variable argument log function for Arduino
+#define OIC_LOG_V(level, tag, format, ...) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ OCLogv((level), PCF(tag), __LINE__, PCF(format),__VA_ARGS__); \
+ } while(0)
+
+#define OIC_LOG_CONFIG(ctx)
+#define OIC_LOG_SHUTDOWN()
+#define OIC_LOG(level, tag, logStr) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ OCLog((level), PCF(tag), __LINE__, PCF(logStr)); \
+ } while(0)
+
+#define OIC_LOG_V(level, tag, ...)
+
+#else // NO ARDUINO
+#define OIC_LOG_BUFFER(level, tag, buffer, bufferSize) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ OCLogBuffer((level), (tag), (buffer), (bufferSize)); \
+ } while(0)
+
+#define OIC_LOG_CA_BUFFER(level, tag, buffer, bufferSize, isHeader) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ OCPrintCALogBuffer((level), (tag), (buffer), (bufferSize), (isHeader)); \
+ } while(0)
+
+#define OIC_LOG_CONFIG(ctx) OCLogConfig((ctx))
+#define OIC_LOG_SHUTDOWN() OCLogShutdown()
+#define OIC_LOG(level, tag, logStr) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ OCLog((level), (tag), (logStr)); \
+ } while(0)
+
+// Define variable argument log function for Linux, Android, and Win32
+#define OIC_LOG_V(level, tag, ...) \
+ do { \
+ IF_OC_PRINT_LOG_LEVEL((level)) \
+ OCLogv((level), (tag), __VA_ARGS__); \
+ } while(0)
+
+#endif // ARDUINO
+#endif // __TIZEN__
+#else // NO TB_LOG
+#define OIC_LOG_CONFIG(ctx)
+#define OIC_LOG_SHUTDOWN()
+#define OIC_LOG(level, tag, logStr)
+#define OIC_LOG_V(level, tag, ...)
+#define OIC_LOG_BUFFER(level, tag, buffer, bufferSize)
+#define OIC_LOG_CA_BUFFER(level, tag, buffer, bufferSize, isHeader)
+#define OIC_LOG_INIT()
+#endif // TB_LOG