lightduer_debug.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * Copyright (2017) Baidu Inc. All rights reserved.
  3. *
  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
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  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.
  15. */
  16. // Author: Su Hao (suhao@baidu.com)
  17. //
  18. // Description: The APIs for debug.
  19. #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_DEBUG_H
  20. #define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_DEBUG_H
  21. #include "lightduer_types.h"
  22. #ifndef DUER_DEBUG_BUF_SIZE
  23. #ifdef DUER_RELEASE_VERSION
  24. #define DUER_DEBUG_BUF_SIZE (64)
  25. #else
  26. #define DUER_DEBUG_BUF_SIZE (512)
  27. #endif
  28. #endif // DUER_DEBUG_BUF_SIZE
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /*
  33. * The debug output
  34. */
  35. typedef void (*duer_debug_f)(duer_context ctx,
  36. duer_u32_t level,
  37. const char* file,
  38. duer_u32_t line,
  39. const char* fmt);
  40. /*
  41. * Set the debug output
  42. *
  43. * @Param ctx, duer_context, the debug context for user
  44. * @Param f_debug, duer_debug_f, the debug output function
  45. */
  46. DUER_EXT void baidu_ca_debug_init(duer_context ctx, duer_debug_f f_debug);
  47. DUER_INT void duer_debug_print(duer_u32_t level, const char* file,
  48. duer_u32_t line, const char* msg);
  49. DUER_INT void duer_debug(duer_u32_t level, const char* file, duer_u32_t line,
  50. const char* fmt, ...);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_DEBUG_H