Piano / inc /

logger.h

  1. /*
  2. * Copyright (c) 2014 Samsung Electronics Co., Ltd 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.  
  17. #ifndef __LOGGER_H__
  18. #define __LOGGER_H__
  19.  
  20. #include <dlog.h>
  21.  
  22. #ifdef LOG_TAG
  23. #undef LOG_TAG
  24. #endif
  25. #define LOG_TAG "$(appName)"
  26.  
  27. #define INF(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, fmt, ##arg)
  28. #define DBG(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, fmt, ##arg)
  29. #define WARN(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, fmt, ##arg)
  30. #define ERR(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, fmt, ##arg)
  31. #define FATAL(fmt, arg...) dlog_print(DLOG_FATAL, LOG_TAG, fmt, ##arg)
  32.  
  33. #define RETM_IF(expr, fmt, arg...) \
  34. { \
  35. if (expr) { \
  36. ERR(fmt, ##arg); \
  37. return; \
  38. } \
  39. }
  40.  
  41. #define RETVM_IF(expr, val, fmt, arg...) \
  42. { \
  43. if (expr) { \
  44. ERR(fmt, ##arg); \
  45. return (val); \
  46. } \
  47. }
  48.  
  49. #endif /* __LOGGER_H__ */