• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this list of
8  *    conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11  *    of conditions and the following disclaimer in the documentation and/or other materials
12  *    provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its contributors may be used
15  *    to endorse or promote products derived from this software without specific prior written
16  *    permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef HDF_LOG_ADAPTER_H
32 #define HDF_LOG_ADAPTER_H
33 
34 #ifdef LOSCFG_BASE_CORE_HILOG
35 #include "hilog/log.h"
36 #endif
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif /* __cplusplus */
41 
42 #ifdef LOSCFG_BASE_CORE_HILOG
43 #undef LOG_DOMAIN
44 #define LOG_DOMAIN 0xD002500
45 
46 #define HDF_LOGV_WRAPPER(fmt, arg...) HILOG_DEBUG(LOG_DOMAIN, fmt, ##arg)
47 
48 #define HDF_LOGD_WRAPPER(fmt, arg...) HILOG_DEBUG(LOG_DOMAIN, fmt, ##arg)
49 
50 #define HDF_LOGI_WRAPPER(fmt, arg...) HILOG_INFO(LOG_DOMAIN, fmt, ##arg)
51 
52 #define HDF_LOGW_WRAPPER(fmt, arg...) HILOG_WARN(LOG_DOMAIN, fmt, ##arg)
53 
54 #define HDF_LOGE_WRAPPER(fmt, arg...) HILOG_ERROR(LOG_DOMAIN, fmt, ##arg)
55 #else
56 static inline void hdf_print_none(const char *format, ...)
57 {
58     (void)format;
59 }
60 
61 #define HDF_LOGV_WRAPPER(fmt, arg...) hdf_print_none("[HDF:V/" LOG_TAG "]" fmt "\r\n", ##arg)
62 
63 #define HDF_LOGD_WRAPPER(fmt, arg...) hdf_print_none("[HDF:D/" LOG_TAG "]" fmt "\r\n", ##arg)
64 
65 #define HDF_LOGI_WRAPPER(fmt, arg...) hdf_print_none("[HDF:I/" LOG_TAG "]" fmt "\r\n", ##arg)
66 
67 #define HDF_LOGW_WRAPPER(fmt, arg...) hdf_print_none("[HDF:W/" LOG_TAG "]" fmt "\r\n", ##arg)
68 
69 #define HDF_LOGE_WRAPPER(fmt, arg...) hdf_print_none("[HDF:E/" LOG_TAG "]" fmt "\r\n", ##arg)
70 #endif
71 
72 #ifdef __cplusplus
73 }
74 #endif /* __cplusplus */
75 
76 #endif /* HDF_LOG_ADAPTER_H */
77 
78