• 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 namespace {
23 constexpr uint32_t SENSOR_LOG_DOMAIN = 0xD002700;
24 } // namespace
25 #ifndef SENSOR_FUNC_FMT
26 #define SENSOR_FUNC_FMT "in %{public}s, "
27 #endif
28 
29 #ifndef SENSOR_FUNC_INFO
30 #define SENSOR_FUNC_INFO __FUNCTION__
31 #endif
32 
33 #define SEN_HILOGD(fmt, ...) do { \
34     OHOS::HiviewDFX::HiLog::Debug(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \
35 } while (0)
36 #define SEN_HILOGI(fmt, ...) do { \
37     OHOS::HiviewDFX::HiLog::Info(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \
38 } while (0)
39 #define SEN_HILOGW(fmt, ...) do { \
40     OHOS::HiviewDFX::HiLog::Warn(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \
41 } while (0)
42 #define SEN_HILOGE(fmt, ...) do { \
43     OHOS::HiviewDFX::HiLog::Error(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \
44 } while (0)
45 #define SENSOR_LOGF(fmt, ...) do { \
46     OHOS::HiviewDFX::HiLog::Fatal(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \
47 } while (0)
48 } // namespace Sensors
49 } // namespace OHOS
50 #endif // SENSOR_LOG_H