• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 /**
10  * @addtogroup DriverUtils
11  * @{
12  *
13  * @brief Defines common macros and interfaces of the driver module.
14  *
15  * This module provides interfaces such as log printing, doubly linked list operations, and work queues.
16  *
17  * @since 1.0
18  * @version 1.0
19  */
20 
21 /**
22  * @file hdf_log.h
23  *
24  * @brief Declares log printing functions of the driver module.
25  * This module provides functions for printing logs at the verbose, debug, information, warning, and error levels.
26  *
27  * To use these functions, you must define <b>HDF_LOG_TAG</b>, for example, #define HDF_LOG_TAG evt.
28  *
29  * @since 1.0
30  * @version 1.0
31  */
32 
33 #ifndef HDF_LOG_H
34 #define HDF_LOG_H
35 
36 #ifdef HDF_LOG_TAG
37 #undef HDF_LOG_TAG
38 #endif /* HDF_LOG_TAG */
39 
40 /** Add quotation mark */
41 #define LOG_TAG_MARK_EXTEND(HDF_TAG) #HDF_TAG
42 #define LOG_TAG_MARK(HDF_TAG) LOG_TAG_MARK_EXTEND(HDF_TAG)
43 
44 #ifndef LOG_TAG
45 #define LOG_TAG LOG_TAG_MARK(HDF_LOG_TAG)
46 #endif /* LOG_TAG */
47 
48 #include "hdf_log_adapter.h"
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif /* __cplusplus */
53 
54 /**
55  * @brief Prints logs at the verbose level.
56  *
57  * To use this function, you must define <b>HDF_LOG_TAG</b>, for example, #define HDF_LOG_TAG evt.
58  *
59  * @since 1.0
60  * @version 1.0
61  */
62 #define HDF_LOGV(fmt, args...) HDF_LOGV_WRAPPER(fmt, ##args)
63 /**
64  * @brief Prints logs at the debug level.
65  *
66  * To use this function, you must define <b>HDF_LOG_TAG</b>, for example, #define HDF_LOG_TAG evt.
67  *
68  * @since 1.0
69  * @version 1.0
70  */
71 #define HDF_LOGD(fmt, args...) HDF_LOGD_WRAPPER(fmt, ##args)
72 /**
73  * @brief Prints logs at the information level.
74  *
75  * To use this function, you must define <b>HDF_LOG_TAG</b>, for example, #define HDF_LOG_TAG evt.
76  *
77  * @since 1.0
78  * @version 1.0
79  */
80 #define HDF_LOGI(fmt, args...) HDF_LOGI_WRAPPER(fmt, ##args)
81 /**
82  * @brief Prints logs at the warning level.
83  *
84  * To use this function, you must define <b>HDF_LOG_TAG</b>, for example, #define HDF_LOG_TAG evt.
85  *
86  * @since 1.0
87  * @version 1.0
88  */
89 #define HDF_LOGW(fmt, args...) HDF_LOGW_WRAPPER(fmt, ##args)
90 /**
91  * @brief Prints logs at the error level.
92  *
93  * To use this function, you must define <b>HDF_LOG_TAG</b>, for example, #define HDF_LOG_TAG evt.
94  *
95  * @since 1.0
96  * @version 1.0
97  */
98 #define HDF_LOGE(fmt, args...) HDF_LOGE_WRAPPER(fmt, ##args)
99 
100 #ifdef __cplusplus
101 }
102 #endif /* __cplusplus */
103 
104 #endif /* HDF_LOG_H */
105 /** @} */
106