Nigel Rantor / azure_c_shared_utility

Fork of azure_c_shared_utility by Azure IoT

Files at this revision

API Documentation at this revision

Comitter:
AzureIoTClient
Date:
Fri Jun 02 15:53:43 2017 -0700
Parent:
27:8656a313842b
Child:
29:e3ed192c35fb
Commit message:
1.1.16

Changed in this revision

azure_c_shared_utility/xlogging.h Show annotated file Show diff for this revision Revisions of this file
--- a/azure_c_shared_utility/xlogging.h	Mon May 22 10:35:55 2017 -0700
+++ b/azure_c_shared_utility/xlogging.h	Fri Jun 02 15:53:43 2017 -0700
@@ -4,15 +4,24 @@
 #ifndef XLOGGING_H
 #define XLOGGING_H
 
+#include "azure_c_shared_utility/agenttime.h"
+#include "azure_c_shared_utility/optimize_size.h"
+
+#if defined(ESP8266_RTOS)
+#include "c_types.h"
+#endif
+
+#if defined(ARDUINO_ARCH_ESP8266)
+#include "esp8266/azcpgmspace.h"
+#endif
+
 #ifdef __cplusplus
 #include <cstdio>
+extern "C" {
 #else
 #include <stdio.h>
 #endif /* __cplusplus */
 
-#include "azure_c_shared_utility/agenttime.h"
-#include "azure_c_shared_utility/optimize_size.h"
-
 #ifdef TIZENRT
 #undef LOG_INFO
 #endif
@@ -55,7 +64,6 @@
 #define UNUSED(x) (void)(x)
 
 #elif defined(ESP8266_RTOS)
-#include "c_types.h"
 #define LogInfo(FORMAT, ...) do {    \
         static const char flash_str[] ICACHE_RODATA_ATTR STORE_ATTR = FORMAT;  \
         printf(flash_str, ##__VA_ARGS__);   \
@@ -83,7 +91,6 @@
 On the other hand, vsprintf does not support the pinned 'format' and os_printf does not work with va_list,
 so we compacted the log in the macro LogInfo.
 */
-#include "esp8266/azcpgmspace.h"
 #define LOG(log_category, log_options, FORMAT, ...) { \
         const char* __localFORMAT = PSTR(FORMAT); \
         os_printf(__localFORMAT, ##__VA_ARGS__); \
@@ -156,24 +163,12 @@
 #define LogError(FORMAT, ...) do{ LOG(AZ_LOG_ERROR, LOG_LINE, FORMAT, ##__VA_ARGS__); }while((void)0,0)
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
 extern void xlogging_set_log_function(LOGGER_LOG log_function);
 extern LOGGER_LOG xlogging_get_log_function(void);
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
 #endif /* ARDUINO_ARCH_ESP8266 */
 
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
     /**
      * @brief   Print the memory content byte pre byte in hexadecimal and as a char it the byte correspond to any printable ASCII chars.
      *
@@ -189,7 +184,7 @@
     extern void xlogging_dump_buffer(const void* buf, size_t size);
 
 #ifdef __cplusplus
-}
+}   // extern "C"
 #endif /* __cplusplus */
 
 #endif /* XLOGGING_H */