EOM / inc /

log.h

  1. /*
  2. * Samsung API
  3. * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the License);
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/license/
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an AS IS BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17.  
  18. #ifndef __SAMPLE_APP_LOG_H__
  19. #define __SAMPLE_APP_LOG_H__
  20.  
  21. #include <unistd.h>
  22. #include <dlog.h>
  23.  
  24. #undef LOG_TAG
  25. #define LOG_TAG "EOM_SAMPLE"
  26.  
  27. #if !defined(_D)
  28. #define _D(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, fmt"\n", ##arg)
  29. #endif
  30.  
  31. #if !defined(_W)
  32. #define _W(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, fmt"\n", ##arg)
  33. #endif
  34.  
  35. #if !defined(_E)
  36. #define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, fmt"\n", ##arg)
  37. #endif
  38.  
  39. #define retvm_if(expr, val, fmt, arg...) do { \
  40. if(expr) { \
  41. _E(fmt, ##arg); \
  42. _E("(%s) -> %s() return", #expr, __FUNCTION__); \
  43. return val; \
  44. } \
  45. } while (0)
  46.  
  47. #define retv_if(expr, val) do { \
  48. if(expr) { \
  49. _E("(%s) -> %s() return", #expr, __FUNCTION__); \
  50. return (val); \
  51. } \
  52. } while (0)
  53.  
  54. #define retm_if(expr, fmt, arg...) do { \
  55. if(expr) { \
  56. _E(fmt, ##arg); \
  57. _E("(%s) -> %s() return", #expr, __FUNCTION__); \
  58. return; \
  59. } \
  60. } while (0)
  61.  
  62. #define ret_if(expr) do { \
  63. if(expr) { \
  64. _E("(%s) -> %s() return", #expr, __FUNCTION__); \
  65. return; \
  66. } \
  67. } while (0)
  68.  
  69. #define goto_if(expr, val) do { \
  70. if(expr) { \
  71. _E("(%s) -> goto", #expr); \
  72. goto val; \
  73. } \
  74. } while (0)
  75.  
  76. #define break_if(expr) { \
  77. if(expr) { \
  78. _E("(%s) -> break", #expr); \
  79. break; \
  80. } \
  81. }
  82.  
  83. #define continue_if(expr) { \
  84. if(expr) { \
  85. _E("(%s) -> continue", #expr); \
  86. continue; \
  87. } \
  88. }
  89.  
  90. #endif /* __SAMPLE_APP_LOG_H__ */