diff --git a/frameworks/capi/vibrator.cpp b/frameworks/capi/vibrator.cpp index fc13699f6979fee67faf8d42d53f267cb40f0aff..61fad82858f6e179ee77e8b460ab44a5c503510e 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 9f3e8d6a2e09d0b496b00175ca7e6b46564ac2a8..bb5aed30436adbd122d303fefc1e5060ded97df0 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 85947d1a0f9024b3b0b81a7cb52e1f4197bf0622..e58bcf5eebee84d3fc6730902dd92a61719cc596 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 82449e85e30940ec3c26b359d210f411c7000cee..27a16dd6996a82b0a6bb7e64cc50a880efe47ca7 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 491bbca129beaea3e8b7ee0d971a46187867a8fa..275364b0ac8ca1052875498fdfc2fa478d320adc 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 e4ae1973b68f14ee5dd54a04247ed3c694c2ce04..9cee850820ea2aab34a376201fde60d5cc61c83c 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 732d525c3ac1a381fa76eaabc8445a8459f8910b..1d32ce3543c65ffdaf0f166bd1daec950466c71e 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 a9255bb979acc73b8c812b2e4021be820d3ce638..a0506941cc7d9a43cdff4b7247ef64c022be4c98 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 e2fd437d7cba58cc26b84dbc91943f54e24daa1a..59c1b856fea2712945f8e30d085e00f3d17a7d62 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 bdbac7fc903775a0cff98d6719720283c28a6fc2..744b13efe6f3677a2b04ce313ff1b15660c71161 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 701e7c28e1654bb8279b421adce295792d90f741..451a6f63f3a8c5abfd91724cba3cf6fa3f7cf552 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 226884c281968ee88bc622527d0f0676699aef6a..614683c19970a006a342810fd204fecb05fdf541 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 6399ff920ad8e7f0f04c4a233c7f5035fdfa95f3..a7524abc0980b09289ab107ec5925fcd590d63c0 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 3e4bb4a12bf94a349b98d057ddd011ec64d17fbf..0184591e1a061d6e4105543590cd94a057a3e260 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 50767c0d99d41b0b98f098a10d0d36145154cda9..8dcbf99f320eb3832823df3309ae29a14b16b3c9 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 564e5a743bb49f3af38a225c93ea6e7982411b51..8a97f3eb4313afa337d61f16407f4f80029ed5d3 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 fa91e857714b751e6ee49b26d289013a13f4b548..dd64617ea73369ce43d1f42e8f6d22d037459e0a 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 abe97bd72aab703ba5685e8a000d3f36f9375be7..c5228dc59271ee9a60706a56c9314b12642f97af 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 0bca98b44f2fe83ddb2a3a4abeb846a26d4cab20..420e11d8f69c8e880eb4d1698f3a4723852ffd9f 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 c8fa76931fe86803b309a0033b64ac7fcebdc254..7ba536a57da3a5eaee97a42115ddc799f61a1317 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 05d024e4d5bd17f667087ef5ae16c934c59ad167..aba3a27f3e754af1568f6e900ab2462a4b6f7361 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 071ad3fbb591f5f5706472280a1429f0d0f83bfb..4dd677fc4acd84d41ebb9c6b2437398ec10a3c73 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 3ed6dd382246e1b536ad1b943b7cc22602afa3c1..c71d38ac39a39580de32a1ab8e505f0d195a6b3a 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 10af81ba4af89f9fc5b1aef8cdb4854c4e4e5967..7fd4d5d4eddcfb76e4ff57c0e28f670dc60bb813 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 216dc319fa58d5189ba7461995e01ef398ed2bd6..e194505b6e266b06995153eb2db4809170669d53 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 78df040a194270baeb7bf6e81125c67ac8ac1bd8..25b1d3a39a6391ef4cfc2681a0d250e54693be0a 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 26a115f7234d64efcc5cfc43ddd1c2d5d524f63b..282855b20fd3f7f4180e730fa45ca8e58cea3cc2 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 a91385b087e58c62e294a0d6fa4637750d9e880b..061a7d9352c382e7ec967d56f828f01a52124b14 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 1f5751274eaac6203bd8bb40bd06cfbb37e1638b..4ffb49b0c5f577d684f6c0139b182e4f5aa1ecb5 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 4a7345919af62ce924bb5009d9d755dd501d0365..a7ccaeae538f463f4a5f622637cd6740cd3f1667 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 f2def50b209a92b8e6cc089e57b5c2427c740634..6c8b38c2fe350fb0a0ead6aef0c1b530add4de71 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 f7d7107aaf9db5b6ce439e46ccb2019629662a26..2ca66c126f8aac67f805b7c8114ccaed7fdca9bc 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 2e2941a997a60fb514d0a84587ce96dc302f7f74..5b5427cd2e88a2072caa3c7f8a94dd98228073de 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 96e96def5ec501a1d592776d2b4c39363496a695..dd999b9ec1ca2025a0f39dad677ac0c8f1e4958e 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 cb3207bbd4e6497fee6200b6031b34f0431573c7..8cbbce9cfae5b493e13454e806781a9611999a09 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 6b894be3602e4af1f31c189d74e77fcfde9211af..e8db461e370d96784a3dd908619fc498181ad6cd 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 eef4f3328249b790f9802382d992ee3d33895bcb..b5c3aaee1ba9169fd91607cbefc203e3357a9746 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 8ad074a5db61a21e47e04adf4fa1f4ce542ed8f9..fac72d08073af520d1cd32fd1a38d2abcbf02295 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;