aws_iot_log.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #pragma once
  14. /* (these two headers aren't used here, but AWS IoT SDK code relies on them
  15. being included from here...) */
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include "esp_log.h"
  19. /* This is a stub replacement for the aws_iot_log.h header in the AWS IoT SDK,
  20. which redirects their logging framework into the esp-idf logging framework.
  21. The current (2.1.1) upstream AWS IoT SDK doesn't allow this as some of its
  22. headers include aws_iot_log.h, but our modified fork does.
  23. */
  24. // redefine the AWS IoT log functions to call into the IDF log layer
  25. #define IOT_DEBUG(format, ...) ESP_LOGD("aws_iot", format, ##__VA_ARGS__)
  26. #define IOT_INFO(format, ...) ESP_LOGI("aws_iot", format, ##__VA_ARGS__)
  27. #define IOT_WARN(format, ...) ESP_LOGW("aws_iot", format, ##__VA_ARGS__)
  28. #define IOT_ERROR(format, ...) ESP_LOGE("aws_iot", format, ##__VA_ARGS__)
  29. /* Function tracing macros used in AWS IoT SDK,
  30. mapped to "verbose" level output
  31. */
  32. #define FUNC_ENTRY ESP_LOGV("aws_iot", "FUNC_ENTRY: %s L#%d \n", __func__, __LINE__)
  33. #define FUNC_EXIT_RC(x) \
  34. do { \
  35. ESP_LOGV("aws_iot", "FUNC_EXIT: %s L#%d Return Code : %d \n", __func__, __LINE__, x); \
  36. return x; \
  37. } while(0)