From f9d061eba926f7c08fb9ed92926b5fa25015a299 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Mon, 15 Jan 2024 09:52:46 +0000 Subject: [PATCH] modify log print Signed-off-by: wuzhihuitmac Change-Id: I11d960c8558c12448d46df64db2057e2944f9150 --- frameworks/capi/vibrator.cpp | 9 +++------ frameworks/js/napi/vibrator/src/vibrator_js.cpp | 4 +++- .../js/napi/vibrator/src/vibrator_napi_error.cpp | 6 +++--- .../js/napi/vibrator/src/vibrator_napi_utils.cpp | 4 +++- .../common/src/miscdevice_service_proxy.cpp | 4 +++- frameworks/native/light/light_agent.cpp | 9 +++------ frameworks/native/light/src/light_client.cpp | 4 +++- .../vibrator/src/vibrator_service_client.cpp | 4 +++- frameworks/native/vibrator/vibrator_agent.cpp | 6 +++--- .../src/custom_vibration_matcher.cpp | 4 +++- .../adapter/src/compatible_connection.cpp | 5 +++-- .../adapter/src/compatible_light_connection.cpp | 6 +++--- .../hdi_connection/adapter/src/hdi_connection.cpp | 4 +++- .../adapter/src/hdi_light_connection.cpp | 4 +++- .../interface/src/light_hdi_connection.cpp | 8 +++----- .../interface/src/vibrator_hdi_connection.cpp | 8 +++----- .../miscdevice_service/src/miscdevice_dump.cpp | 5 +++-- .../miscdevice_service/src/miscdevice_service.cpp | 5 +++-- .../src/miscdevice_service_stub.cpp | 4 +++- .../src/vibration_priority_manager.cpp | 4 +++- .../miscdevice_service/src/vibrator_thread.cpp | 4 +++- test/unittest/light/light_agent_test.cpp | 5 +++-- test/unittest/vibrator/capi/vibrator_test.cpp | 5 +++-- .../vibrator/native/vibrator_agent_test.cpp | 5 +++-- utils/common/include/miscdevice_log.h | 15 +++++++-------- utils/common/include/sensors_errors.h | 11 +++++------ utils/common/src/file_utils.cpp | 4 +++- utils/common/src/json_parser.cpp | 6 +++--- utils/common/src/light_animation_ipc.cpp | 7 +++---- utils/common/src/light_info_ipc.cpp | 7 +++---- utils/common/src/miscdevice_common.cpp | 5 +++-- utils/common/src/permission_util.cpp | 1 - utils/common/src/vibrator_infos.cpp | 7 +++---- .../he_json/src/he_vibrator_decoder.cpp | 4 ++-- .../he_json/src/he_vibrator_decoder_factory.cpp | 8 ++++---- .../interface/vibrator_decoder_creator.cpp | 8 ++++---- .../oh_json/src/default_vibrator_decoder.cpp | 5 +++-- .../src/default_vibrator_decoder_factory.cpp | 8 ++++---- 38 files changed, 119 insertions(+), 103 deletions(-) diff --git a/frameworks/capi/vibrator.cpp b/frameworks/capi/vibrator.cpp index fc13699..61fad82 100644 --- a/frameworks/capi/vibrator.cpp +++ b/frameworks/capi/vibrator.cpp @@ -21,14 +21,11 @@ #include "vibrator_agent.h" #include "vibrator_type.h" +#undef LOG_TAG +#define LOG_TAG "Vibrator" + namespace OHOS { namespace Sensors { -using OHOS::HiviewDFX::HiLog; -using namespace OHOS::HiviewDFX; - -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "Vibrator" }; -} // namespace int32_t OH_Vibrator_PlayVibration(int32_t duration, Vibrator_Attribute vibrateAttribute) { diff --git a/frameworks/js/napi/vibrator/src/vibrator_js.cpp b/frameworks/js/napi/vibrator/src/vibrator_js.cpp index 9f3e8d6..bb5aed3 100644 --- a/frameworks/js/napi/vibrator/src/vibrator_js.cpp +++ b/frameworks/js/napi/vibrator/src/vibrator_js.cpp @@ -28,10 +28,12 @@ #include "vibrator_napi_error.h" #include "vibrator_napi_utils.h" +#undef LOG_TAG +#define LOG_TAG "VibratorJs" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "VibratorJs" }; constexpr int32_t VIBRATE_SHORT_DURATION = 35; constexpr int32_t VIBRATE_LONG_DURATION = 1000; } // namespace diff --git a/frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp b/frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp index 85947d1..e58bcf5 100644 --- a/frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp +++ b/frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp @@ -17,11 +17,11 @@ #include +#undef LOG_TAG +#define LOG_TAG "VibratorNapiError" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, MISC_LOG_DOMAIN, "VibratorNapiError"}; -} // namespace napi_value CreateBusinessError(const napi_env &env, const int32_t errCode, const std::string &errMessage) { napi_value businessError = nullptr; diff --git a/frameworks/js/napi/vibrator/src/vibrator_napi_utils.cpp b/frameworks/js/napi/vibrator/src/vibrator_napi_utils.cpp index 82449e8..27a16dd 100644 --- a/frameworks/js/napi/vibrator/src/vibrator_napi_utils.cpp +++ b/frameworks/js/napi/vibrator/src/vibrator_napi_utils.cpp @@ -22,10 +22,12 @@ #include "miscdevice_log.h" #include "vibrator_napi_error.h" +#undef LOG_TAG +#define LOG_TAG "VibratorNapiUtils" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, MISC_LOG_DOMAIN, "VibratorNapiUtils"}; constexpr int32_t RESULT_LENGTH = 2; } // namespace AsyncCallbackInfo::~AsyncCallbackInfo() diff --git a/frameworks/native/common/src/miscdevice_service_proxy.cpp b/frameworks/native/common/src/miscdevice_service_proxy.cpp index 491bbca..275364b 100644 --- a/frameworks/native/common/src/miscdevice_service_proxy.cpp +++ b/frameworks/native/common/src/miscdevice_service_proxy.cpp @@ -20,12 +20,14 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "MiscdeviceServiceProxy" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "MiscdeviceServiceProxy" }; constexpr int32_t MAX_LIGHT_COUNT = 0XFF; } // namespace diff --git a/frameworks/native/light/light_agent.cpp b/frameworks/native/light/light_agent.cpp index e4ae197..9cee850 100644 --- a/frameworks/native/light/light_agent.cpp +++ b/frameworks/native/light/light_agent.cpp @@ -17,14 +17,11 @@ #include "light_client.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "LightNDK" + namespace OHOS { namespace Sensors { -using OHOS::HiviewDFX::HiLog; -using OHOS::HiviewDFX::HiLogLabel; - -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "LightNDK" }; -} // namespace int32_t GetLightList(LightInfo **lightInfo, int32_t &count) { diff --git a/frameworks/native/light/src/light_client.cpp b/frameworks/native/light/src/light_client.cpp index 732d525..1d32ce3 100644 --- a/frameworks/native/light/src/light_client.cpp +++ b/frameworks/native/light/src/light_client.cpp @@ -24,11 +24,13 @@ #include "sensors_errors.h" #include "system_ability_definition.h" +#undef LOG_TAG +#define LOG_TAG "LightClient" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "LightClient" }; constexpr int32_t GET_SERVICE_MAX_COUNT = 30; constexpr uint32_t MAX_LIGHT_LIST_SIZE = 0X00ff; constexpr uint32_t WAIT_MS = 200; diff --git a/frameworks/native/vibrator/src/vibrator_service_client.cpp b/frameworks/native/vibrator/src/vibrator_service_client.cpp index a9255bb..a050694 100644 --- a/frameworks/native/vibrator/src/vibrator_service_client.cpp +++ b/frameworks/native/vibrator/src/vibrator_service_client.cpp @@ -27,12 +27,14 @@ #include "sensors_errors.h" #include "vibrator_decoder_creator.h" +#undef LOG_TAG +#define LOG_TAG "VibratorServiceClient" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "VibratorServiceClient" }; constexpr int32_t GET_SERVICE_MAX_COUNT = 3; constexpr uint32_t WAIT_MS = 200; #ifdef __aarch64__ diff --git a/frameworks/native/vibrator/vibrator_agent.cpp b/frameworks/native/vibrator/vibrator_agent.cpp index e2fd437..59c1b85 100644 --- a/frameworks/native/vibrator/vibrator_agent.cpp +++ b/frameworks/native/vibrator/vibrator_agent.cpp @@ -19,14 +19,14 @@ #include "sensors_errors.h" #include "vibrator_service_client.h" +#undef LOG_TAG +#define LOG_TAG "VibratorNDK" + namespace OHOS { namespace Sensors { -using OHOS::HiviewDFX::HiLog; -using OHOS::HiviewDFX::HiLogLabel; using OHOS::Sensors::VibratorServiceClient; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "VibratorNDK" }; constexpr int32_t DEFAULT_VIBRATOR_ID = 123; int32_t g_loopCount = 1; int32_t g_usage = USAGE_UNKNOWN; diff --git a/services/miscdevice_service/haptic_matcher/src/custom_vibration_matcher.cpp b/services/miscdevice_service/haptic_matcher/src/custom_vibration_matcher.cpp index bdbac7f..744b13e 100644 --- a/services/miscdevice_service/haptic_matcher/src/custom_vibration_matcher.cpp +++ b/services/miscdevice_service/haptic_matcher/src/custom_vibration_matcher.cpp @@ -20,6 +20,9 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "CustomVibrationMatcher" + namespace OHOS { namespace Sensors { namespace { @@ -48,7 +51,6 @@ constexpr int32_t DURATION_MAX = 1600; constexpr float CURVE_INTENSITY_SCALE = 100.00; constexpr int32_t SLICE_STEP = 50; constexpr int32_t CONTINUOUS_VIBRATION_DURATION_MIN = 15; -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "CustomVibrationMatcher" }; } // namespace int32_t CustomVibrationMatcher::TransformTime(const VibratePackage &package, diff --git a/services/miscdevice_service/hdi_connection/adapter/src/compatible_connection.cpp b/services/miscdevice_service/hdi_connection/adapter/src/compatible_connection.cpp index 701e7c2..451a6f6 100644 --- a/services/miscdevice_service/hdi_connection/adapter/src/compatible_connection.cpp +++ b/services/miscdevice_service/hdi_connection/adapter/src/compatible_connection.cpp @@ -22,11 +22,12 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "CompatibleConnection" + namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "CompatibleConnection" }; const std::string VIBRATE_MOCK_THREAD_NAME = "OS_VibMock"; std::unordered_map g_vibratorEffect = { {"haptic.clock.timer", 2000}, diff --git a/services/miscdevice_service/hdi_connection/adapter/src/compatible_light_connection.cpp b/services/miscdevice_service/hdi_connection/adapter/src/compatible_light_connection.cpp index 226884c..614683c 100644 --- a/services/miscdevice_service/hdi_connection/adapter/src/compatible_light_connection.cpp +++ b/services/miscdevice_service/hdi_connection/adapter/src/compatible_light_connection.cpp @@ -20,11 +20,11 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "CompatibleLightConnection" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "CompatibleLightConnection" }; -} // namespace std::vector lightInfo = { {"light_test", 1, 3, 1} }; diff --git a/services/miscdevice_service/hdi_connection/adapter/src/hdi_connection.cpp b/services/miscdevice_service/hdi_connection/adapter/src/hdi_connection.cpp index 6399ff9..a7524ab 100644 --- a/services/miscdevice_service/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/miscdevice_service/hdi_connection/adapter/src/hdi_connection.cpp @@ -20,11 +20,13 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "HdiConnection" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "HdiConnection" }; constexpr int32_t GET_HDI_SERVICE_COUNT = 10; constexpr uint32_t WAIT_MS = 100; } // namespace diff --git a/services/miscdevice_service/hdi_connection/adapter/src/hdi_light_connection.cpp b/services/miscdevice_service/hdi_connection/adapter/src/hdi_light_connection.cpp index 3e4bb4a..0184591 100644 --- a/services/miscdevice_service/hdi_connection/adapter/src/hdi_light_connection.cpp +++ b/services/miscdevice_service/hdi_connection/adapter/src/hdi_light_connection.cpp @@ -24,10 +24,12 @@ #include "v1_0/light_interface_proxy.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "HdiLightConnection" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "HdiLightConnection" }; constexpr int32_t GET_HDI_SERVICE_COUNT = 10; constexpr uint32_t WAIT_MS = 100; } // namespace diff --git a/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp b/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp index 50767c0..8dcbf99 100644 --- a/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp +++ b/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp @@ -23,13 +23,11 @@ #include "hitrace_meter.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "LightHdiConnection" + namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; - -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "LightHdiConnection" }; -} // namespace int32_t LightHdiConnection::ConnectHdi() { diff --git a/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp b/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp index 564e5a7..8a97f3e 100644 --- a/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp +++ b/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp @@ -22,13 +22,11 @@ #include "hdi_connection.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "VibratorHdiConnection" + namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; - -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "VibratorHdiConnection" }; -} // namespace int32_t VibratorHdiConnection::ConnectHdi() { diff --git a/services/miscdevice_service/src/miscdevice_dump.cpp b/services/miscdevice_service/src/miscdevice_dump.cpp index fa91e85..dd64617 100644 --- a/services/miscdevice_service/src/miscdevice_dump.cpp +++ b/services/miscdevice_service/src/miscdevice_dump.cpp @@ -25,11 +25,12 @@ #include "securec.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "MiscdeviceDump" + namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "MiscdeviceDump" }; constexpr uint32_t MAX_DUMP_RECORD_SIZE = 30; constexpr uint32_t BASE_YEAR = 1900; constexpr uint32_t BASE_MON = 1; diff --git a/services/miscdevice_service/src/miscdevice_service.cpp b/services/miscdevice_service/src/miscdevice_service.cpp index abe97bd..c5228dc 100644 --- a/services/miscdevice_service/src/miscdevice_service.cpp +++ b/services/miscdevice_service/src/miscdevice_service.cpp @@ -32,11 +32,12 @@ #include "parameters.h" #endif // OHOS_BUILD_ENABLE_VIBRATOR_CUSTOM +#undef LOG_TAG +#define LOG_TAG "MiscdeviceService" + namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "MiscdeviceService" }; auto g_miscdeviceService = MiscdeviceDelayedSpSingleton::GetInstance(); const bool G_REGISTER_RESULT = SystemAbility::MakeAndRegisterAbility(g_miscdeviceService.GetRefPtr()); constexpr int32_t MIN_VIBRATOR_TIME = 0; diff --git a/services/miscdevice_service/src/miscdevice_service_stub.cpp b/services/miscdevice_service/src/miscdevice_service_stub.cpp index 0bca98b..420e11d 100644 --- a/services/miscdevice_service/src/miscdevice_service_stub.cpp +++ b/services/miscdevice_service/src/miscdevice_service_stub.cpp @@ -26,12 +26,14 @@ #include "permission_util.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "MiscdeviceServiceStub" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "MiscdeviceServiceStub" }; const std::string VIBRATE_PERMISSION = "ohos.permission.VIBRATE"; const std::string LIGHT_PERMISSION = "ohos.permission.SYSTEM_LIGHT_CONTROL"; } // namespace diff --git a/services/miscdevice_service/src/vibration_priority_manager.cpp b/services/miscdevice_service/src/vibration_priority_manager.cpp index c8fa769..7ba536a 100644 --- a/services/miscdevice_service/src/vibration_priority_manager.cpp +++ b/services/miscdevice_service/src/vibration_priority_manager.cpp @@ -22,10 +22,12 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "VibrationPriorityManager" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "VibrationPriorityManager" }; const std::string SETTING_COLUMN_KEYWORD = "KEYWORD"; const std::string SETTING_COLUMN_VALUE = "VALUE"; const std::string SETTING_FEEDBACK_KEY = "physic_navi_haptic_feedback_enabled"; diff --git a/services/miscdevice_service/src/vibrator_thread.cpp b/services/miscdevice_service/src/vibrator_thread.cpp index 05d024e..aba3a27 100644 --- a/services/miscdevice_service/src/vibrator_thread.cpp +++ b/services/miscdevice_service/src/vibrator_thread.cpp @@ -20,10 +20,12 @@ #include "custom_vibration_matcher.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "VibratorThread" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "VibratorThread" }; const std::string VIBRATE_CONTROL_THREAD_NAME = "OS_VibControl"; constexpr size_t COMPOSITE_EFFECT_PART = 128; } // namespace diff --git a/test/unittest/light/light_agent_test.cpp b/test/unittest/light/light_agent_test.cpp index 071ad3f..4dd677f 100644 --- a/test/unittest/light/light_agent_test.cpp +++ b/test/unittest/light/light_agent_test.cpp @@ -22,16 +22,17 @@ #include "light_agent.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "LightAgentTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; -using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { constexpr int32_t TIME_WAIT_FOR_OP = 2; -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "LightAgentTest" }; PermissionDef g_infoManagerTestPermDef = { .permissionName = "ohos.permission.SYSTEM_LIGHT_CONTROL", .bundleName = "accesstoken_test", diff --git a/test/unittest/vibrator/capi/vibrator_test.cpp b/test/unittest/vibrator/capi/vibrator_test.cpp index 3ed6dd3..c71d38a 100644 --- a/test/unittest/vibrator/capi/vibrator_test.cpp +++ b/test/unittest/vibrator/capi/vibrator_test.cpp @@ -25,17 +25,18 @@ #include "sensors_errors.h" #include "vibrator.h" +#undef LOG_TAG +#define LOG_TAG "NativeVibratorTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; -using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { uint32_t g_duration = 300; constexpr int32_t TIME_WAIT_FOR_OP = 2; -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "NativeVibratorTest" }; PermissionDef infoManagerTestPermDef_ = { .permissionName = "ohos.permission.VIBRATE", .bundleName = "accesstoken_test", diff --git a/test/unittest/vibrator/native/vibrator_agent_test.cpp b/test/unittest/vibrator/native/vibrator_agent_test.cpp index 10af81b..7fd4d5d 100644 --- a/test/unittest/vibrator/native/vibrator_agent_test.cpp +++ b/test/unittest/vibrator/native/vibrator_agent_test.cpp @@ -26,10 +26,12 @@ #include "sensors_errors.h" #include "vibrator_agent.h" +#undef LOG_TAG +#define LOG_TAG "VibratorAgentTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; -using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; @@ -37,7 +39,6 @@ namespace { constexpr int32_t TIME_WAIT_FOR_OP = 2; const std::string PHONE_TYPE = "phone"; std::string g_deviceType; -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "VibratorAgentTest" }; PermissionDef g_infoManagerTestPermDef = { .permissionName = "ohos.permission.VIBRATE", .bundleName = "accesstoken_test", diff --git a/utils/common/include/miscdevice_log.h b/utils/common/include/miscdevice_log.h index 216dc31..e194505 100755 --- a/utils/common/include/miscdevice_log.h +++ b/utils/common/include/miscdevice_log.h @@ -20,12 +20,11 @@ #include "sensors_errors.h" #include "miscdevice_log.h" +#undef LOG_DOMAIN +#define LOG_DOMAIN 0xD002701 namespace OHOS { namespace Sensors { -namespace { -constexpr uint32_t MISC_LOG_DOMAIN = 0xD002701; -} // namespace #ifndef MISC_FUNC_FMT #define MISC_FUNC_FMT "in %{public}s " #endif @@ -35,19 +34,19 @@ constexpr uint32_t MISC_LOG_DOMAIN = 0xD002701; #endif #define MISC_HILOGD(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Debug(LABEL, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_DEBUG(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define MISC_HILOGI(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Info(LABEL, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_INFO(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define MISC_HILOGW(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Warn(LABEL, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_WARN(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define MISC_HILOGE(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Error(LABEL, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_ERROR(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define MISC_LOGF(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Fatal(LABEL, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_FATAL(LOG_CORE, MISC_FUNC_FMT fmt, MISC_FUNC_INFO, ##__VA_ARGS__); \ } while (0) } // namespace Sensors } // namespace OHOS diff --git a/utils/common/include/sensors_errors.h b/utils/common/include/sensors_errors.h index 78df040..25b1d3a 100644 --- a/utils/common/include/sensors_errors.h +++ b/utils/common/include/sensors_errors.h @@ -96,21 +96,20 @@ enum { class InnerFunctionTracer { public: - InnerFunctionTracer(const OHOS::HiviewDFX::HiLogLabel &label, const char *func) - : label_ { label }, func_ { func } + InnerFunctionTracer(const char *func) + : func_ { func } { - OHOS::HiviewDFX::HiLog::Debug(label_, "in %{public}s, enter", func_); + HILOG_DEBUG(LOG_CORE, "in %{public}s, enter", func_); } ~InnerFunctionTracer() { - OHOS::HiviewDFX::HiLog::Debug(label_, "in %{public}s, leave", func_); + HILOG_DEBUG(LOG_CORE, "in %{public}s, leave", func_); } private: - const OHOS::HiviewDFX::HiLogLabel &label_; const char *func_ { nullptr }; }; -#define CALL_LOG_ENTER InnerFunctionTracer ___innerFuncTracer___ { LABEL, __FUNCTION__ } +#define CALL_LOG_ENTER InnerFunctionTracer ___innerFuncTracer___ { __FUNCTION__ } #ifdef DEBUG_CODE_TEST #define CHKPL(cond, ...) \ diff --git a/utils/common/src/file_utils.cpp b/utils/common/src/file_utils.cpp index 26a115f..282855b 100755 --- a/utils/common/src/file_utils.cpp +++ b/utils/common/src/file_utils.cpp @@ -22,10 +22,12 @@ #include "securec.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "MiscdeviceFileUtils" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "MiscdeviceFileUtils" }; const std::string CONFIG_DIR = "/vendor/etc/vibrator/"; constexpr int32_t FILE_SIZE_MAX = 0x5000; constexpr int64_t READ_DATA_BUFF_SIZE = 256; diff --git a/utils/common/src/json_parser.cpp b/utils/common/src/json_parser.cpp index a91385b..061a7d9 100755 --- a/utils/common/src/json_parser.cpp +++ b/utils/common/src/json_parser.cpp @@ -21,11 +21,11 @@ #include "file_utils.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "JsonParser" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "JsonParser" }; -} // namespace JsonParser::JsonParser(const std::string &filePath) { diff --git a/utils/common/src/light_animation_ipc.cpp b/utils/common/src/light_animation_ipc.cpp index 1f57512..4ffb49b 100644 --- a/utils/common/src/light_animation_ipc.cpp +++ b/utils/common/src/light_animation_ipc.cpp @@ -17,12 +17,11 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "LightAnimationIPC" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "LightAnimationIPC" }; -} // namespace - int32_t LightAnimationIPC::GetMode() const { return mode_; diff --git a/utils/common/src/light_info_ipc.cpp b/utils/common/src/light_info_ipc.cpp index 4a73459..a7ccaea 100644 --- a/utils/common/src/light_info_ipc.cpp +++ b/utils/common/src/light_info_ipc.cpp @@ -17,12 +17,11 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "LightInfoIPC" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "LightInfoIPC" }; -} // namespace - std::string LightInfoIPC::GetLightName() const { return lightName_; diff --git a/utils/common/src/miscdevice_common.cpp b/utils/common/src/miscdevice_common.cpp index f2def50..6c8b38c 100644 --- a/utils/common/src/miscdevice_common.cpp +++ b/utils/common/src/miscdevice_common.cpp @@ -17,12 +17,13 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "MiscdeviceCommon" + namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "MiscdeviceCommon" }; constexpr int32_t MIN_VIBRATOR_COUNT = 0; constexpr int32_t MAX_VIBRATOR_COUNT = 100; constexpr int32_t MIN_VIBRATOR_INTENSITY = 0; diff --git a/utils/common/src/permission_util.cpp b/utils/common/src/permission_util.cpp index f7d7107..2ca66c1 100644 --- a/utils/common/src/permission_util.cpp +++ b/utils/common/src/permission_util.cpp @@ -19,7 +19,6 @@ namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; int32_t PermissionUtil::CheckVibratePermission(AccessTokenID callerToken, const std::string &permissionName) { diff --git a/utils/common/src/vibrator_infos.cpp b/utils/common/src/vibrator_infos.cpp index 2e2941a..5b5427c 100644 --- a/utils/common/src/vibrator_infos.cpp +++ b/utils/common/src/vibrator_infos.cpp @@ -22,12 +22,11 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "MiscdeviceVibratorInfos" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "MiscdeviceVibratorInfos" }; -} // namespace - void VibratePattern::Dump() const { int32_t size = static_cast(events.size()); diff --git a/utils/haptic_decoder/he_json/src/he_vibrator_decoder.cpp b/utils/haptic_decoder/he_json/src/he_vibrator_decoder.cpp index 96e96de..dd999b9 100644 --- a/utils/haptic_decoder/he_json/src/he_vibrator_decoder.cpp +++ b/utils/haptic_decoder/he_json/src/he_vibrator_decoder.cpp @@ -17,10 +17,11 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "HEVibratorDecoder" namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; namespace { constexpr int32_t EVENT_NUM_MAX = 16; constexpr int32_t SUPPORTED_HE_VERSION_1 = 1; @@ -42,7 +43,6 @@ constexpr int32_t CURVE_INTENSITY_SCALE = 100; constexpr int32_t CURVE_FREQUENCY_MIN = -100; constexpr int32_t CURVE_FREQUENCY_MAX = 100; constexpr int32_t CONTINUOUS_DURATION_MAX = 5000; -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "HEVibratorDecoder" }; } // namespace int32_t HEVibratorDecoder::DecodeEffect(const RawFileDescriptor &rawFd, VibratePackage &pkg) diff --git a/utils/haptic_decoder/he_json/src/he_vibrator_decoder_factory.cpp b/utils/haptic_decoder/he_json/src/he_vibrator_decoder_factory.cpp index cb3207b..8cbbce9 100644 --- a/utils/haptic_decoder/he_json/src/he_vibrator_decoder_factory.cpp +++ b/utils/haptic_decoder/he_json/src/he_vibrator_decoder_factory.cpp @@ -17,12 +17,12 @@ #include "he_vibrator_decoder.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "HEVibratorDecoderFactory" + namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "HEVibratorDecoderFactory" }; -} // namespace + IVibratorDecoder *HEVibratorDecoderFactory::CreateDecoder() { CALL_LOG_ENTER; diff --git a/utils/haptic_decoder/interface/vibrator_decoder_creator.cpp b/utils/haptic_decoder/interface/vibrator_decoder_creator.cpp index 6b894be..e8db461 100644 --- a/utils/haptic_decoder/interface/vibrator_decoder_creator.cpp +++ b/utils/haptic_decoder/interface/vibrator_decoder_creator.cpp @@ -22,12 +22,12 @@ #include "he_vibrator_decoder_factory.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "VibratorDecoderCreator" + namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "VibratorDecoderCreator" }; -} // namespace + IVibratorDecoder *VibratorDecoderCreator::CreateDecoder(const RawFileDescriptor &fd) { CALL_LOG_ENTER; diff --git a/utils/haptic_decoder/oh_json/src/default_vibrator_decoder.cpp b/utils/haptic_decoder/oh_json/src/default_vibrator_decoder.cpp index eef4f33..b5c3aae 100644 --- a/utils/haptic_decoder/oh_json/src/default_vibrator_decoder.cpp +++ b/utils/haptic_decoder/oh_json/src/default_vibrator_decoder.cpp @@ -20,9 +20,11 @@ #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "DefaultVibratorDecoder" + namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; namespace { constexpr int32_t STARTTMIE_MIN = 0; constexpr int32_t STARTTMIE_MAX = 1800000; @@ -45,7 +47,6 @@ constexpr int32_t CURVE_INTENSITY_SCALE = 100; constexpr int32_t CURVE_FREQUENCY_MIN = -100; constexpr int32_t CURVE_FREQUENCY_MAX = 100; constexpr int32_t MAX_JSON_FILE_SIZE = 64 * 1024; -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "DefaultVibratorDecoder" }; } // namespace int32_t DefaultVibratorDecoder::DecodeEffect(const RawFileDescriptor &rawFd, VibratePackage &patternPackage) diff --git a/utils/haptic_decoder/oh_json/src/default_vibrator_decoder_factory.cpp b/utils/haptic_decoder/oh_json/src/default_vibrator_decoder_factory.cpp index 8ad074a..fac72d0 100644 --- a/utils/haptic_decoder/oh_json/src/default_vibrator_decoder_factory.cpp +++ b/utils/haptic_decoder/oh_json/src/default_vibrator_decoder_factory.cpp @@ -18,12 +18,12 @@ #include "default_vibrator_decoder.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "DefaultVibratorDecoderFactory" + namespace OHOS { namespace Sensors { -using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, MISC_LOG_DOMAIN, "DefaultVibratorDecoderFactory" }; -} // namespace + IVibratorDecoder *DefaultVibratorDecoderFactory::CreateDecoder() { CALL_LOG_ENTER; -- Gitee