• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef SENSOR_LOG_H
16 #define SENSOR_LOG_H
17 
18 #include "hilog/log.h"
19 
20 namespace OHOS {
21 namespace Sensors {
22 #undef LOG_DOMAIN
23 #define LOG_DOMAIN 0xD002700
24 
25 #ifndef TAG
26 #define TAG static_cast<uint64_t>(LOG_DOMAIN)
27 #endif
28 
29 #ifndef SENSOR_FUNC_FMT
30 #define SENSOR_FUNC_FMT "in %{public}s, "
31 #endif
32 
33 #ifndef SENSOR_FUNC_INFO
34 #define SENSOR_FUNC_INFO __FUNCTION__
35 #endif
36 
37 #define SEN_HILOGD(fmt, ...) do { \
38     HILOG_DEBUG(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \
39 } while (0)
40 #define SEN_HILOGI(fmt, ...) do { \
41     HILOG_INFO(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \
42 } while (0)
43 #define SEN_HILOGW(fmt, ...) do { \
44     HILOG_WARN(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \
45 } while (0)
46 #define SEN_HILOGE(fmt, ...) do { \
47     HILOG_ERROR(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \
48 } while (0)
49 #define SENSOR_LOGF(fmt, ...) do { \
50     HILOG_FATAL(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \
51 } while (0)
52 } // namespace Sensors
53 } // namespace OHOS
54 #endif // SENSOR_LOG_H