diff --git a/frameworks/js/napi/include/async_callback_info.h b/frameworks/js/napi/include/async_callback_info.h index cdddb94bf06707cc5d81ea5562d967926100a7fb..fe9b012a30b9b16cc65d1a5acf79805695df7c86 100644 --- a/frameworks/js/napi/include/async_callback_info.h +++ b/frameworks/js/napi/include/async_callback_info.h @@ -24,12 +24,14 @@ #include "sensor_errors.h" #include "sensor_log.h" +#undef LOG_TAG +#define LOG_TAG "SensorJsAPI" + namespace OHOS { namespace Sensors { using std::vector; using std::string; using namespace OHOS::HiviewDFX; -static constexpr HiLogLabel LABEL = {LOG_CORE, SENSOR_LOG_DOMAIN, "SensorJsAPI"}; constexpr int32_t THREE_DIMENSIONAL_MATRIX_LENGTH = 9; constexpr static int32_t DATA_LENGTH = 16; constexpr int32_t CALLBACK_NUM = 3; diff --git a/frameworks/js/napi/src/sensor_napi_error.cpp b/frameworks/js/napi/src/sensor_napi_error.cpp old mode 100755 new mode 100644 index e9918fdf42bea55a58ddb7ab4be231cd87b22483..fa3c948ec489fb7cd8cc8aee93c96668e06312e7 --- a/frameworks/js/napi/src/sensor_napi_error.cpp +++ b/frameworks/js/napi/src/sensor_napi_error.cpp @@ -17,11 +17,11 @@ #include +#undef LOG_TAG +#define LOG_TAG "SensorJsAPI" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, SENSOR_LOG_DOMAIN, "SensorJsAPI"}; -} // namespace napi_value CreateBusinessError(const napi_env &env, const int32_t errCode, const std::string &errMessage) { napi_value businessError = nullptr; diff --git a/frameworks/native/src/fd_listener.cpp b/frameworks/native/src/fd_listener.cpp index ef5364a1672e0989b27e44b03cce6ed838ace336..4b8cbe1df1645dba1e690588588004653c428ce3 100644 --- a/frameworks/native/src/fd_listener.cpp +++ b/frameworks/native/src/fd_listener.cpp @@ -20,11 +20,13 @@ #include "sensor_errors.h" #include "stream_socket.h" +#undef LOG_TAG +#define LOG_TAG "FdListener" + namespace OHOS { namespace Sensors { using namespace OHOS::AppExecFwk; namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "FdListener" }; constexpr int32_t MAX_DATA_BUF_SIZE = 256; } // namespace diff --git a/frameworks/native/src/native_sensor.cpp b/frameworks/native/src/native_sensor.cpp index bfcd647e6a278b785317034682d2dc3ffaad70fd..bd27c5f461ec4b85595e951b361cc669264f4328 100644 --- a/frameworks/native/src/native_sensor.cpp +++ b/frameworks/native/src/native_sensor.cpp @@ -21,10 +21,10 @@ #include "sensor_agent.h" #include "sensor_errors.h" -using OHOS::HiviewDFX::HiLog; -using OHOS::HiviewDFX::HiLogLabel; +#undef LOG_TAG +#define LOG_TAG "SensorCapiAPI" + namespace { -const HiLogLabel LABEL = {LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorCapiAPI"}; const uint32_t FLOAT_SIZE = 4; } diff --git a/frameworks/native/src/sensor_agent.cpp b/frameworks/native/src/sensor_agent.cpp index 30466b52471cc843467764b9b387a7ea22fa0130..3a8d0e4ff94d4924a698a0c3b56a711d10f3fc0f 100644 --- a/frameworks/native/src/sensor_agent.cpp +++ b/frameworks/native/src/sensor_agent.cpp @@ -18,16 +18,13 @@ #include "sensor_agent_proxy.h" #include "sensor_errors.h" -using OHOS::HiviewDFX::HiLog; -using OHOS::HiviewDFX::HiLogLabel; +#undef LOG_TAG +#define LOG_TAG "SensorNativeAPI" using OHOS::Sensors::SensorAgentProxy; using OHOS::Sensors::SERVICE_EXCEPTION; using OHOS::Sensors::PARAMETER_ERROR; using OHOS::Sensors::PERMISSION_DENIED; using OHOS::Sensors::NON_SYSTEM_API; -namespace { -constexpr HiLogLabel LABEL = {LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorNativeAPI"}; -} // namespace static int32_t NormalizeErrCode(int32_t code) { diff --git a/frameworks/native/src/sensor_agent_proxy.cpp b/frameworks/native/src/sensor_agent_proxy.cpp index 40ac118d107eb657ec2ec3f1e5012e69cdc1e26d..5bbcec9faa83f01367895d52fd58ba911710c1ad 100644 --- a/frameworks/native/src/sensor_agent_proxy.cpp +++ b/frameworks/native/src/sensor_agent_proxy.cpp @@ -20,12 +20,12 @@ #include "securec.h" #include "sensor_errors.h" #include "sensor_service_client.h" - +#undef LOG_TAG +#define LOG_TAG "SensorAgentProxy" using namespace OHOS::HiviewDFX; namespace OHOS { namespace Sensors { namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorAgentProxy" }; constexpr uint32_t MAX_SENSOR_LIST_SIZE = 0Xffff; std::mutex sensorInfoMutex_; SensorInfo *sensorInfos_ = nullptr; diff --git a/frameworks/native/src/sensor_algorithm.cpp b/frameworks/native/src/sensor_algorithm.cpp index 4f7980f8346421acd86bb6015e062d353c2bb051..be96d33614863826c0d9ceb73a47fb48d2ee8ac6 100644 --- a/frameworks/native/src/sensor_algorithm.cpp +++ b/frameworks/native/src/sensor_algorithm.cpp @@ -20,14 +20,10 @@ #include "sensor_errors.h" #include "sensor_utils.h" -using OHOS::HiviewDFX::HiLog; -using OHOS::HiviewDFX::HiLogLabel; +#undef LOG_TAG +#define LOG_TAG "SensorAlgorithmAPI" using namespace OHOS::Sensors; -namespace { -constexpr HiLogLabel LABEL = {LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorAlgorithmAPI"}; -} // namespace - int32_t SensorAlgorithm::CreateQuaternion(std::vector rotationVector, std::vector &quaternion) { if (static_cast(rotationVector.size()) < ROTATION_VECTOR_LENGTH diff --git a/frameworks/native/src/sensor_client_stub.cpp b/frameworks/native/src/sensor_client_stub.cpp index 96416f2e6aa8ff0f85b0fee33798445be9de19f8..48db50b63dd54a72a45e6683181578284255c4d1 100644 --- a/frameworks/native/src/sensor_client_stub.cpp +++ b/frameworks/native/src/sensor_client_stub.cpp @@ -18,14 +18,12 @@ #include "message_parcel.h" #include "sensor_log.h" +#undef LOG_TAG +#define LOG_TAG "SensorClientStub" namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorClientStub" }; -} // namespace - int32_t SensorClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { diff --git a/frameworks/native/src/sensor_data_channel.cpp b/frameworks/native/src/sensor_data_channel.cpp index 765882893bcf1991aad6dd3ec5ab89d2a5d8ee77..141ee803255a90b666b1218a31aa8666a0b65ca7 100644 --- a/frameworks/native/src/sensor_data_channel.cpp +++ b/frameworks/native/src/sensor_data_channel.cpp @@ -21,12 +21,13 @@ #include "sensor_errors.h" #include "sensor_file_descriptor_listener.h" +#undef LOG_TAG +#define LOG_TAG "SensorDataChannel" namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace OHOS::AppExecFwk; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorDataChannel" }; const std::string LISTENER_THREAD_NAME = "OS_SenConsumer"; } // namespace diff --git a/frameworks/native/src/sensor_file_descriptor_listener.cpp b/frameworks/native/src/sensor_file_descriptor_listener.cpp index aad73354cb8ce160f5fc3a596e5bfcfb172b8880..e3e0c9c9066da415d813ea81fb916aee5c6ac812 100644 --- a/frameworks/native/src/sensor_file_descriptor_listener.cpp +++ b/frameworks/native/src/sensor_file_descriptor_listener.cpp @@ -19,13 +19,15 @@ #include "sensor_errors.h" #include "sys/socket.h" +#undef LOG_TAG +#define LOG_TAG "SensorFileDescriptorListener" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace OHOS::AppExecFwk; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorFileDescriptorListener" }; constexpr int32_t RECEIVE_DATA_SIZE = 100; } // namespace diff --git a/frameworks/native/src/sensor_service_client.cpp b/frameworks/native/src/sensor_service_client.cpp index 11d782258ce6611c0e52c178f3e77f496765f55c..a2f02e9cb921a8dc44687db42d58d0a029613612 100644 --- a/frameworks/native/src/sensor_service_client.cpp +++ b/frameworks/native/src/sensor_service_client.cpp @@ -29,12 +29,14 @@ #include "system_ability_definition.h" #include "rust_binding.h" +#undef LOG_TAG +#define LOG_TAG "SensorServiceClient" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorServiceClient" }; constexpr int32_t GET_SERVICE_MAX_COUNT = 3; constexpr uint32_t WAIT_MS = 200; #ifdef OHOS_BUILD_ENABLE_RUST diff --git a/frameworks/native/src/sensor_service_proxy.cpp b/frameworks/native/src/sensor_service_proxy.cpp index b85a484a13bc547543f98f533e57db4a7b6b5162..18790f4a973434c300289f4831e89e8bd96b7ddd 100644 --- a/frameworks/native/src/sensor_service_proxy.cpp +++ b/frameworks/native/src/sensor_service_proxy.cpp @@ -23,14 +23,13 @@ #include "sensor_errors.h" #include "sensor_parcel.h" +#undef LOG_TAG +#define LOG_TAG "SensorServiceProxy" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorServiceProxy" }; -} // namespace - SensorServiceProxy::SensorServiceProxy(const sptr &impl) : IRemoteProxy(impl) {} diff --git a/services/hdi_connection/adapter/src/compatible_connection.cpp b/services/hdi_connection/adapter/src/compatible_connection.cpp index 1e9712b96874dd3a4e33843ff735c45e4d8942b8..f7096eaaddb254644fb822d55c27308f485bd854 100644 --- a/services/hdi_connection/adapter/src/compatible_connection.cpp +++ b/services/hdi_connection/adapter/src/compatible_connection.cpp @@ -19,14 +19,13 @@ #include "securec.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "CompatibleConnection" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "CompatibleConnection" }; -} // namespace - ReportDataCb CompatibleConnection::reportDataCb_ = nullptr; sptr CompatibleConnection::reportDataCallback_ = nullptr; int32_t CompatibleConnection::ConnectHdi() diff --git a/services/hdi_connection/adapter/src/hdi_connection.cpp b/services/hdi_connection/adapter/src/hdi_connection.cpp index 300b1b1fedd2edc3cb4f9bafdcc11765511f7b5c..cd10fc40afca399c360f8ca8629748b70ae444e6 100644 --- a/services/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/hdi_connection/adapter/src/hdi_connection.cpp @@ -26,6 +26,9 @@ #include "sensor_errors.h" #include "sensor_event_callback.h" +#undef LOG_TAG +#define LOG_TAG "HdiConnection" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; @@ -33,7 +36,6 @@ using OHOS::HDI::Sensor::V2_0::ISensorInterface; using OHOS::HDI::Sensor::V2_0::ISensorCallback; using OHOS::HDI::Sensor::V2_0::HdfSensorInformation; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "HdiConnection" }; sptr g_sensorInterface = nullptr; sptr g_eventCallback = nullptr; std::map g_sensorBasicInfoMap; diff --git a/services/hdi_connection/adapter/src/sensor_event_callback.cpp b/services/hdi_connection/adapter/src/sensor_event_callback.cpp index 89286b614ef6683f974a9b4a664f7b25ec26808c..734e6de7c0358d7823f4ff6151b1b48a6838a04b 100644 --- a/services/hdi_connection/adapter/src/sensor_event_callback.cpp +++ b/services/hdi_connection/adapter/src/sensor_event_callback.cpp @@ -19,11 +19,13 @@ #include "sensor_data_event.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "HdiConnection" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "HdiConnection" }; std::unique_ptr HdiConnection_ = std::make_unique(); constexpr int32_t HEADPOSTURE_DATA_SIZE = 20; } // namespace diff --git a/services/hdi_connection/hardware/src/hdi_service_impl.cpp b/services/hdi_connection/hardware/src/hdi_service_impl.cpp index ae58f1e827ea1ee282648d7e0c491b7b8cf1c308..d17013570b0246835bbc232e596dbbd92ae9e915 100644 --- a/services/hdi_connection/hardware/src/hdi_service_impl.cpp +++ b/services/hdi_connection/hardware/src/hdi_service_impl.cpp @@ -21,12 +21,15 @@ #include #include "sensor_errors.h" + +#undef LOG_TAG +#define LOG_TAG "HdiServiceImpl" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "HdiServiceImpl" }; constexpr int64_t SAMPLING_INTERVAL_NS = 200000000; constexpr float TARGET_SUM = 9.8F * 9.8F; constexpr float MAX_RANGE = 9999.0F; diff --git a/services/hdi_connection/interface/src/sensor_hdi_connection.cpp b/services/hdi_connection/interface/src/sensor_hdi_connection.cpp index 2280924e492e77b5523dc09e0f592bff4d5ee32d..37e07270b3efdf38acbc1263967b14421e7ef45d 100644 --- a/services/hdi_connection/interface/src/sensor_hdi_connection.cpp +++ b/services/hdi_connection/interface/src/sensor_hdi_connection.cpp @@ -21,6 +21,9 @@ #include "hdi_connection.h" #include "hitrace_meter.h" #include "sensor_errors.h" + +#undef LOG_TAG +#define LOG_TAG "SensorHdiConnection" std::mutex OHOS::Sensors::ISensorHdiConnection::dataMutex_; std::condition_variable OHOS::Sensors::ISensorHdiConnection::dataCondition_; @@ -28,7 +31,6 @@ namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorHdiConnection" }; #ifdef BUILD_VARIANT_ENG constexpr float MAX_RANGE = 9999.0; constexpr float POWER = 20.0; diff --git a/services/src/client_info.cpp b/services/src/client_info.cpp index 649b15cf14f47bccc8ec30a48043550eeaeb1022..f70d9e6d56e7e228249132721fcd610637c33749 100644 --- a/services/src/client_info.cpp +++ b/services/src/client_info.cpp @@ -25,12 +25,14 @@ #include "sensor_hdi_connection.h" #endif // HDF_DRIVERS_INTERFACE_SENSOR +#undef LOG_TAG +#define LOG_TAG "ClientInfo" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "ClientInfo" }; constexpr int32_t INVALID_SENSOR_ID = -1; constexpr int32_t INVALID_PID = -1; constexpr int32_t INVALID_UID = -1; diff --git a/services/src/flush_info_record.cpp b/services/src/flush_info_record.cpp index 1d840746323ee5aee0dd0a9de4319172a4a5e9b6..b39c14955aad89a887baebd5b1621fe67ef33b67 100644 --- a/services/src/flush_info_record.cpp +++ b/services/src/flush_info_record.cpp @@ -17,12 +17,14 @@ #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "FlushInfoRecord" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "FlushInfoRecord" }; constexpr int32_t CHANNEL_NO_FLUSH = -1; } // namespace diff --git a/services/src/sensor_data_processer.cpp b/services/src/sensor_data_processer.cpp index 47e83bb964657eea153ef446157ab4c72ebbe3c6..9a23c4e3e4ea1acfe0df48582f73508e4c04289e 100644 --- a/services/src/sensor_data_processer.cpp +++ b/services/src/sensor_data_processer.cpp @@ -26,12 +26,14 @@ #include "sensor_errors.h" #include "system_ability_definition.h" +#undef LOG_TAG +#define LOG_TAG "SensorDataProcesser" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorDataProcesser" }; const std::string SENSOR_REPORT_THREAD_NAME = "OS_SenProducer"; } // namespace diff --git a/services/src/sensor_dump.cpp b/services/src/sensor_dump.cpp index 8e4b5c75d501f809f6d4c80949bbb27a3afba794..01feacb2f67d36ec778f5f1ed9bc29605921028c 100644 --- a/services/src/sensor_dump.cpp +++ b/services/src/sensor_dump.cpp @@ -26,11 +26,13 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorDump" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorDump" }; constexpr int32_t MAX_DUMP_PARAMETERS = 32; #ifdef BUILD_VARIANT_ENG constexpr uint32_t MAX_DUMP_DATA_SIZE = 10; diff --git a/services/src/sensor_manager.cpp b/services/src/sensor_manager.cpp index fe870cb8cd7cd73a663fa70690554978986a2337..941dd45d90fbe197e2256d7a6b52778cc7e0c5a0 100644 --- a/services/src/sensor_manager.cpp +++ b/services/src/sensor_manager.cpp @@ -23,11 +23,13 @@ #include "sensor_data_event.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorManager" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorManager" }; #ifdef HDF_DRIVERS_INTERFACE_SENSOR constexpr int32_t INVALID_SENSOR_ID = -1; #endif // HDF_DRIVERS_INTERFACE_SENSOR diff --git a/services/src/sensor_power_policy.cpp b/services/src/sensor_power_policy.cpp index 0a90ad243034247197b9e9816d3b8644d9ad83a1..82bbf15799caf9b206bcccf847b93a9f2e24fb47 100644 --- a/services/src/sensor_power_policy.cpp +++ b/services/src/sensor_power_policy.cpp @@ -20,13 +20,14 @@ #ifdef OHOS_BUILD_ENABLE_RUST #include "rust_binding.h" #endif // OHOS_BUILD_ENABLE_RUST +#undef LOG_TAG +#define LOG_TAG "SensorPowerPolicy" namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorPowerPolicy" }; constexpr int32_t INVALID_SENSOR_ID = -1; constexpr int64_t MAX_EVENT_COUNT = 1000; ClientInfo &clientInfo_ = ClientInfo::GetInstance(); diff --git a/services/src/sensor_service.cpp b/services/src/sensor_service.cpp index 45ca8992900da80119ac6de63eaacd2eee01b4dd..5979dcf565411eff4ae5de3a28da51149f6144e5 100644 --- a/services/src/sensor_service.cpp +++ b/services/src/sensor_service.cpp @@ -29,11 +29,13 @@ #include "sensor_errors.h" #include "system_ability_definition.h" +#undef LOG_TAG +#define LOG_TAG "SensorService" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorService" }; auto g_sensorService = SensorDelayedSpSingleton::GetInstance(); const bool G_REGISTER_RESULT = SystemAbility::MakeAndRegisterAbility(g_sensorService.GetRefPtr()); constexpr int32_t INVALID_PID = -1; diff --git a/services/src/sensor_service_stub.cpp b/services/src/sensor_service_stub.cpp index 21a6e9a551682775b0a46282a4ea5627f39691c1..b4a692a303dd740c02fd31b235b1e4f3ae7c66a3 100644 --- a/services/src/sensor_service_stub.cpp +++ b/services/src/sensor_service_stub.cpp @@ -30,12 +30,12 @@ #include "sensor_errors.h" #include "sensor_parcel.h" +#undef LOG_TAG +#define LOG_TAG "SensorServiceStub" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorServiceStub" }; -} // namespace SensorServiceStub::SensorServiceStub() { diff --git a/services/src/stream_server.cpp b/services/src/stream_server.cpp index 5a55d8c59bd02325c2ba2b604c7553e56efe5844..27176c12b59da7eb00f2490b8260a286b87cfc30 100644 --- a/services/src/stream_server.cpp +++ b/services/src/stream_server.cpp @@ -21,10 +21,12 @@ #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "StreamServer" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "StreamServer" }; constexpr int32_t INVALID_PID = -1; constexpr int32_t INVALID_FD = -1; } // namespace diff --git a/test/fuzztest/interfaces/getactivesensorinfos_fuzzer/getactivesensorinfos_fuzzer.cpp b/test/fuzztest/interfaces/getactivesensorinfos_fuzzer/getactivesensorinfos_fuzzer.cpp index 1ea7754f4af8efc084245bc9b7b63857424bb129..57d545e6eb12fd609aa0290c912a44aad585c1c2 100644 --- a/test/fuzztest/interfaces/getactivesensorinfos_fuzzer/getactivesensorinfos_fuzzer.cpp +++ b/test/fuzztest/interfaces/getactivesensorinfos_fuzzer/getactivesensorinfos_fuzzer.cpp @@ -24,13 +24,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "GetActiveSensorInfosFuzzTest" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "GetActiveSensorInfosFuzzTest" }; constexpr size_t DATA_MIN_SIZE = 4; } // namespace diff --git a/test/fuzztest/interfaces/register_fuzzer/register_fuzzer.cpp b/test/fuzztest/interfaces/register_fuzzer/register_fuzzer.cpp index d4f646dac773765bfbc8329406e384353e187727..22fd492873706604a45c5f20ecbd0e5bad35ccf2 100644 --- a/test/fuzztest/interfaces/register_fuzzer/register_fuzzer.cpp +++ b/test/fuzztest/interfaces/register_fuzzer/register_fuzzer.cpp @@ -24,13 +24,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "RegisterFuzzTest" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "RegisterFuzzTest" }; constexpr size_t DATA_MIN_SIZE = 4; } // namespace diff --git a/test/fuzztest/interfaces/resumesensors_fuzzer/resumesensors_fuzzer.cpp b/test/fuzztest/interfaces/resumesensors_fuzzer/resumesensors_fuzzer.cpp index 9bf068f4a74ed15f2b2a2b25f0f4ce76f65ee6bc..a924edb5eafa5e34df48fa34039b42115fb4e56f 100644 --- a/test/fuzztest/interfaces/resumesensors_fuzzer/resumesensors_fuzzer.cpp +++ b/test/fuzztest/interfaces/resumesensors_fuzzer/resumesensors_fuzzer.cpp @@ -23,13 +23,15 @@ #include "sensor_agent.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "ResumeSensorsFuzzTest" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "ResumeSensorsFuzzTest" }; constexpr size_t DATA_MIN_SIZE = 4; } // namespace diff --git a/test/fuzztest/interfaces/suspendsensors_fuzzer/suspendsensors_fuzzer.cpp b/test/fuzztest/interfaces/suspendsensors_fuzzer/suspendsensors_fuzzer.cpp index 5bdd8c3827723613c0acf40c367cd5647e07edf0..8e459440905af86c4ca3d89a3c4caf71442ec40f 100644 --- a/test/fuzztest/interfaces/suspendsensors_fuzzer/suspendsensors_fuzzer.cpp +++ b/test/fuzztest/interfaces/suspendsensors_fuzzer/suspendsensors_fuzzer.cpp @@ -23,13 +23,15 @@ #include "sensor_agent.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SuspendSensorsFuzzTest" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SuspendSensorsFuzzTest" }; constexpr size_t DATA_MIN_SIZE = 4; } // namespace diff --git a/test/fuzztest/interfaces/unregister_fuzzer/unregister_fuzzer.cpp b/test/fuzztest/interfaces/unregister_fuzzer/unregister_fuzzer.cpp index 0255dd70466a725e17e18c8205b4d82f236ec8ce..86cdfb7fb219defa04ea3a76a54154ffa131896d 100644 --- a/test/fuzztest/interfaces/unregister_fuzzer/unregister_fuzzer.cpp +++ b/test/fuzztest/interfaces/unregister_fuzzer/unregister_fuzzer.cpp @@ -24,13 +24,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "UnregisterFuzzTest" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "UnregisterFuzzTest" }; constexpr size_t DATA_MIN_SIZE = 4; } // namespace diff --git a/test/unittest/common/src/system_info.cpp b/test/unittest/common/src/system_info.cpp index af7b9754cc2b41a416ef3edf402a4b760c577589..d3fa641c45cad2d2a53c8997dcc50a4af9c9f1ad 100644 --- a/test/unittest/common/src/system_info.cpp +++ b/test/unittest/common/src/system_info.cpp @@ -26,12 +26,14 @@ #include "securec.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SYSTEM_INFO" + namespace OHOS { namespace Sensors { namespace SYSTEM_INFO { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SYSTEM_INFO" }; constexpr int32_t LOCATION = 14; constexpr int32_t TIME_WAIT_FOR_OP = 1000; constexpr int32_t DEFAULT_PID = -1; diff --git a/test/unittest/interfaces/inner_api/drop_detection_test.cpp b/test/unittest/interfaces/inner_api/drop_detection_test.cpp index 071fc4d79171080b764dbeb0c9d3b9cfa4aa2f21..3abd6a525f73c1a6823d27c99b994e60640bcff3 100644 --- a/test/unittest/interfaces/inner_api/drop_detection_test.cpp +++ b/test/unittest/interfaces/inner_api/drop_detection_test.cpp @@ -22,13 +22,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "DropDetectionTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "DropDetectionTest" }; std::atomic_bool g_existDropDetection = false; } // namespace diff --git a/test/unittest/interfaces/inner_api/head_posture_test.cpp b/test/unittest/interfaces/inner_api/head_posture_test.cpp index 463f8f987891bb7d288cc5a10359fc985bb8c7c3..9c8855d7cadcc2c188b6f05a71a5f4b86983278c 100644 --- a/test/unittest/interfaces/inner_api/head_posture_test.cpp +++ b/test/unittest/interfaces/inner_api/head_posture_test.cpp @@ -22,13 +22,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "HeadPostureTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "HeadPostureTest" }; std::atomic_bool g_existHeadPosture = false; } // namespace diff --git a/test/unittest/interfaces/inner_api/posture_test.cpp b/test/unittest/interfaces/inner_api/posture_test.cpp index bd7b1484dfdeb21d1708f34576caa6c7122d529c..887d15fa43f81ee80d8033a80788839f70ca46fd 100644 --- a/test/unittest/interfaces/inner_api/posture_test.cpp +++ b/test/unittest/interfaces/inner_api/posture_test.cpp @@ -22,13 +22,15 @@ #include "sensor_agent_type.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "PostureTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "PostureTest" }; constexpr float ANGLE_MAX = 180.0F; constexpr float ANGLE_MIN = 0.0F; std::atomic_bool g_existPosture = false; diff --git a/test/unittest/interfaces/inner_api/sensor_agent_test.cpp b/test/unittest/interfaces/inner_api/sensor_agent_test.cpp old mode 100755 new mode 100644 index a3a5dcedd9c291912190717b9b9423206d2ddac6..9f215d26e222199c5e9180dbe17616d58904eedd --- a/test/unittest/interfaces/inner_api/sensor_agent_test.cpp +++ b/test/unittest/interfaces/inner_api/sensor_agent_test.cpp @@ -25,6 +25,9 @@ #include "sensor_errors.h" #include "system_info.h" +#undef LOG_TAG +#define LOG_TAG "SensorAgentTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; @@ -33,7 +36,6 @@ using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorAgentTest" }; constexpr int32_t SENSOR_ID { 1 }; constexpr int32_t INVALID_VALUE { -1 }; diff --git a/test/unittest/interfaces/inner_api/sensor_algorithm_test.cpp b/test/unittest/interfaces/inner_api/sensor_algorithm_test.cpp old mode 100755 new mode 100644 index db163c9c105f4f689d92bf7ffbd3ce70d790c829..c0917f0c7fcded4584df154281b7de161de49911 --- a/test/unittest/interfaces/inner_api/sensor_algorithm_test.cpp +++ b/test/unittest/interfaces/inner_api/sensor_algorithm_test.cpp @@ -19,13 +19,15 @@ #include "sensor_algorithm.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorAlgorithmTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorAlgorithmTest" }; constexpr int32_t QUATERNION_LENGTH = 4; constexpr int32_t ROTATION_VECTOR_LENGTH = 3; constexpr int32_t THREE_DIMENSIONAL_MATRIX_LENGTH = 9; diff --git a/test/unittest/interfaces/inner_api/sensor_power_test.cpp b/test/unittest/interfaces/inner_api/sensor_power_test.cpp index 6116bb7583562f1d51094f5b648dfa6ddef7e1b2..1d3a96be68d8f10cccedfb8e2bb82ace2cd1bd01 100644 --- a/test/unittest/interfaces/inner_api/sensor_power_test.cpp +++ b/test/unittest/interfaces/inner_api/sensor_power_test.cpp @@ -27,6 +27,9 @@ #include "sensor_agent.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorPowerTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; @@ -35,7 +38,6 @@ using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorPowerTest" }; constexpr int32_t SENSOR_ID { 1 }; constexpr int32_t INVALID_VALUE { -1 }; } // namespace diff --git a/test/unittest/interfaces/kits/sensor_native_test.cpp b/test/unittest/interfaces/kits/sensor_native_test.cpp old mode 100755 new mode 100644 index 1755d6c2f85dff610e757e057b4b1fa0a4708762..69293ab31e99bac4ba72822ba6b0d35fc6395480 --- a/test/unittest/interfaces/kits/sensor_native_test.cpp +++ b/test/unittest/interfaces/kits/sensor_native_test.cpp @@ -25,6 +25,9 @@ #include "oh_sensor.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorAgentTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; @@ -33,7 +36,6 @@ using namespace Security::AccessToken; using Security::AccessToken::AccessTokenID; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "SensorAgentTest" }; constexpr Sensor_Type SENSOR_ID { SENSOR_TYPE_ACCELEROMETER }; constexpr uint32_t SENSOR_NAME_LENGTH_MAX = 64; constexpr int64_t SENSOR_SAMPLE_PERIOD = 200000000; diff --git a/utils/common/include/sensor_errors.h b/utils/common/include/sensor_errors.h index 50e1d8261434c9a237d1def762b9bebb15f07bcd..cb181d28dff5d3bb80bf3b60d9340214477ebbed 100644 --- a/utils/common/include/sensor_errors.h +++ b/utils/common/include/sensor_errors.h @@ -126,21 +126,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/include/sensor_log.h b/utils/common/include/sensor_log.h index 1d39432d94851fdd35128015fb436902ab5cbb4f..48be0a9126d8ee6f8241b121a2a7da0459269818 100644 --- a/utils/common/include/sensor_log.h +++ b/utils/common/include/sensor_log.h @@ -19,9 +19,9 @@ namespace OHOS { namespace Sensors { -namespace { -constexpr uint32_t SENSOR_LOG_DOMAIN = 0xD002700; -} // namespace +#undef LOG_DOMAIN +#define LOG_DOMAIN 0xD002700 + #ifndef SENSOR_FUNC_FMT #define SENSOR_FUNC_FMT "in %{public}s, " #endif @@ -31,19 +31,19 @@ constexpr uint32_t SENSOR_LOG_DOMAIN = 0xD002700; #endif #define SEN_HILOGD(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Debug(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_DEBUG(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define SEN_HILOGI(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Info(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_INFO(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define SEN_HILOGW(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Warn(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_WARN(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define SEN_HILOGE(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Error(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_ERROR(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ } while (0) #define SENSOR_LOGF(fmt, ...) do { \ - OHOS::HiviewDFX::HiLog::Fatal(LABEL, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ + HILOG_FATAL(LOG_CORE, SENSOR_FUNC_FMT fmt, SENSOR_FUNC_INFO, ##__VA_ARGS__); \ } while (0) } // namespace Sensors } // namespace OHOS diff --git a/utils/common/src/active_info.cpp b/utils/common/src/active_info.cpp index 2236dd10725d4040afbc57ffe4bc69c856527d6f..d6fb346f84517f8c54ad56019cdf9df2b601f111 100644 --- a/utils/common/src/active_info.cpp +++ b/utils/common/src/active_info.cpp @@ -17,12 +17,12 @@ #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "ActiveInfo" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "ActiveInfo" }; -} // namespace ActiveInfo::ActiveInfo(int32_t pid, int32_t sensorId, int64_t samplingPeriodNs, int64_t maxReportDelayNs) :pid_(pid), sensorId_(sensorId), samplingPeriodNs_(samplingPeriodNs), maxReportDelayNs_(maxReportDelayNs) diff --git a/utils/common/src/permission_util.cpp b/utils/common/src/permission_util.cpp index 2d2f5a46670cd5519505e548b232b2b328bb8a0f..b8424a247a3c4679d835b2b9977c6505f12ad113 100644 --- a/utils/common/src/permission_util.cpp +++ b/utils/common/src/permission_util.cpp @@ -20,14 +20,13 @@ #include "sensor_agent_type.h" #include "sensor_log.h" +#undef LOG_TAG +#define LOG_TAG "PermissionUtil" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = {LOG_CORE, SENSOR_LOG_DOMAIN, "PermissionUtil"}; -} // namespace - std::unordered_map PermissionUtil::sensorPermissions_ = { { SENSOR_TYPE_ID_ACCELEROMETER, ACCELEROMETER_PERMISSION }, { SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, ACCELEROMETER_PERMISSION }, diff --git a/utils/common/src/report_data_callback.cpp b/utils/common/src/report_data_callback.cpp index 438619a704e26fa9e32f1bac05c6c9a21a602441..998926360740cb1f79fded88ff59dbf677c7e9ec 100644 --- a/utils/common/src/report_data_callback.cpp +++ b/utils/common/src/report_data_callback.cpp @@ -16,13 +16,13 @@ #include "report_data_callback.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "ReportDataCallback" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = {LOG_CORE, SENSOR_LOG_DOMAIN, "ReportDataCallback"}; -} // namespace ReportDataCallback::ReportDataCallback() { eventsBuf_.circularBuf = new (std::nothrow) SensorData[CIRCULAR_BUF_LEN]; diff --git a/utils/common/src/sensor.cpp b/utils/common/src/sensor.cpp index bd20895ac16fb6c5a0c87ec8fd1adb4efe88d43a..32f1c2f9eea17c126004fde8b66527c0b763674a 100644 --- a/utils/common/src/sensor.cpp +++ b/utils/common/src/sensor.cpp @@ -16,14 +16,14 @@ #include "sensor.h" #include "sensor_errors.h" + +#undef LOG_TAG +#define LOG_TAG "Sensor" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; -namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "Sensor" }; -} // namespace - Sensor::Sensor() : sensorId_(0), sensorTypeId_(0), diff --git a/utils/common/src/sensor_basic_data_channel.cpp b/utils/common/src/sensor_basic_data_channel.cpp old mode 100755 new mode 100644 index b09a687ee50c09d373f32e79639eba643028b237..1e01b867433ccb20a019a5c3d6c3fa5907cb691c --- a/utils/common/src/sensor_basic_data_channel.cpp +++ b/utils/common/src/sensor_basic_data_channel.cpp @@ -22,12 +22,14 @@ #include "hisysevent.h" #include "sensor_errors.h" +#undef LOG_TAG +#define LOG_TAG "SensorBasicChannel" + namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorBasicChannel" }; constexpr int32_t SENSOR_READ_DATA_SIZE = sizeof(SensorData) * 100; constexpr int32_t DEFAULT_CHANNEL_SIZE = 2 * 1024; constexpr int32_t SOCKET_PAIR_SIZE = 2; diff --git a/utils/ipc/include/circle_stream_buffer.h b/utils/ipc/include/circle_stream_buffer.h index 5857314e9b820f179b546f74a1e42167332dce50..1d71d05963d10b17f51c25e7a19b834b2f1ed02a 100644 --- a/utils/ipc/include/circle_stream_buffer.h +++ b/utils/ipc/include/circle_stream_buffer.h @@ -18,10 +18,12 @@ #include "stream_buffer.h" +#undef LOG_TAG +#define LOG_TAG "CircleStreamBuffer" + namespace OHOS { namespace Sensors { class CircleStreamBuffer : public StreamBuffer { - static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "CircleStreamBuffer" }; public: CircleStreamBuffer() = default; ~CircleStreamBuffer() = default; diff --git a/utils/ipc/include/net_packet.h b/utils/ipc/include/net_packet.h index 3be9a5677874d5000d4498fdf79e8a9a6dc7078d..c12bc9abaca9cde01e7070d41a19301fcd04774c 100644 --- a/utils/ipc/include/net_packet.h +++ b/utils/ipc/include/net_packet.h @@ -19,6 +19,9 @@ #include "proto.h" #include "stream_buffer.h" +#undef LOG_TAG +#define LOG_TAG "NetPacket" + #pragma pack(1) using PACKHEAD = struct PackHead { OHOS::Sensors::MessageId idMsg; @@ -29,7 +32,6 @@ using PACKHEAD = struct PackHead { namespace OHOS { namespace Sensors { class NetPacket : public StreamBuffer { - static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "NetPacket" }; public: explicit NetPacket(MessageId msgId); NetPacket(const NetPacket &pkt); diff --git a/utils/ipc/include/stream_buffer.h b/utils/ipc/include/stream_buffer.h index 324066553906d7effccd423b4b5b9898bb758803..8db8a871f940169cfb7f6159d0d057fc207f03c0 100644 --- a/utils/ipc/include/stream_buffer.h +++ b/utils/ipc/include/stream_buffer.h @@ -29,10 +29,12 @@ #include "rust_binding.h" #endif // OHOS_BUILD_ENABLE_RUST +#undef LOG_TAG +#define LOG_TAG "StreamBuffer" + namespace OHOS { namespace Sensors { class StreamBuffer { - static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "StreamBuffer" }; public: StreamBuffer() = default; explicit StreamBuffer(const StreamBuffer &buf); diff --git a/utils/ipc/src/stream_session.cpp b/utils/ipc/src/stream_session.cpp index 546b02f0822ca29ac608687dc6e15cd012c969f7..39f0b8c49302a21a650dcdf4b06f504c0e586117 100644 --- a/utils/ipc/src/stream_session.cpp +++ b/utils/ipc/src/stream_session.cpp @@ -22,11 +22,11 @@ #include "sensor_errors.h" #include "stream_socket.h" +#undef LOG_TAG +#define LOG_TAG "StreamSession" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "StreamSession" }; -} // namespace StreamSession::StreamSession(const std::string &programName, const int32_t fd, const int32_t uid, const int32_t pid) : programName_(programName) diff --git a/utils/ipc/src/stream_socket.cpp b/utils/ipc/src/stream_socket.cpp index 2ec9cc030d368a52fe5eb1ab85e74b55c3e90c33..48c3fed9f86822f1eac7ac47f63e84ed4c536968 100644 --- a/utils/ipc/src/stream_socket.cpp +++ b/utils/ipc/src/stream_socket.cpp @@ -22,9 +22,8 @@ namespace OHOS { namespace Sensors { #ifndef OHOS_BUILD_ENABLE_RUST -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "StreamSocket" }; -} // namespace +#undef LOG_TAG +#define LOG_TAG "StreamSocket" #endif // OHOS_BUILD_ENABLE_RUST StreamSocket::StreamSocket() {} diff --git a/vibration_convert/core/algorithm/conversion/src/conversion_fft.cpp b/vibration_convert/core/algorithm/conversion/src/conversion_fft.cpp index 92939717da033cac9d159894c19f7b016554390c..4ef39a0aa4b70e0e8c2cddc4d34dd0025568d48a 100644 --- a/vibration_convert/core/algorithm/conversion/src/conversion_fft.cpp +++ b/vibration_convert/core/algorithm/conversion/src/conversion_fft.cpp @@ -19,10 +19,12 @@ #include "sensors_errors.h" #include "utils.h" +#undef LOG_TAG +#define LOG_TAG "ConversionFFT" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "ConversionFFT" }; constexpr int32_t SPECTRUM_COUNT_MAX { 8192 }; constexpr int32_t MAX_FFT_SIZE { 10240 }; } // namespace diff --git a/vibration_convert/core/algorithm/conversion/src/conversion_filter.cpp b/vibration_convert/core/algorithm/conversion/src/conversion_filter.cpp index f3915b07416e1211d5e8c72f073c3e52a2d2bba0..261a95284afd4df761362aca84e7cd93a296e894 100644 --- a/vibration_convert/core/algorithm/conversion/src/conversion_filter.cpp +++ b/vibration_convert/core/algorithm/conversion/src/conversion_filter.cpp @@ -17,10 +17,12 @@ #include "sensor_log.h" +#undef LOG_TAG +#define LOG_TAG "ConversionFilter" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "ConversionFilter" }; constexpr double CUT_OFF_MIN { 10.0 }; constexpr double VALIDE_RESONANCE_MAX { 0.999999 }; constexpr double AMOUNT_RESONANCE_MIN { 1.0 }; diff --git a/vibration_convert/core/algorithm/conversion/src/conversion_mfcc.cpp b/vibration_convert/core/algorithm/conversion/src/conversion_mfcc.cpp index 72691f40bcaa8245b5480bf4225b5bfc92b27e78..6982f4df4fc2fc21bc18a359e8024c5c477fa570 100644 --- a/vibration_convert/core/algorithm/conversion/src/conversion_mfcc.cpp +++ b/vibration_convert/core/algorithm/conversion/src/conversion_mfcc.cpp @@ -20,10 +20,12 @@ #include "sensors_errors.h" #include "utils.h" +#undef LOG_TAG +#define LOG_TAG "ConversionMfcc" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "ConversionMfcc" }; constexpr double BANDS_MIN_THRESHOLD { 0.000001 }; constexpr uint32_t MEL_FILTERS_OR_COEFFS_MAX { 4096 * 4096 }; } // namespace diff --git a/vibration_convert/core/algorithm/conversion/src/fft.cpp b/vibration_convert/core/algorithm/conversion/src/fft.cpp index f57c66098595c1a1333e5ff7598ecadd184536db..703162f1a06e60876577ee13b3f4f9ef5efcf38f 100644 --- a/vibration_convert/core/algorithm/conversion/src/fft.cpp +++ b/vibration_convert/core/algorithm/conversion/src/fft.cpp @@ -24,10 +24,12 @@ #include "sensor_log.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "Fft" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "Fft" }; constexpr uint32_t MAX_FAST_BITS { 16 }; constexpr int32_t NUM_SAMPLES_MIN { 2 }; constexpr double HAMMING_WND_UP { 0.54 }; diff --git a/vibration_convert/core/algorithm/frequency_estimation/src/frequency_estimation.cpp b/vibration_convert/core/algorithm/frequency_estimation/src/frequency_estimation.cpp index e2020d0033b3865cf38a8191f8834df45e8dff1b..f9b562a96d447901ad3088e2a615649af7ae97ff 100644 --- a/vibration_convert/core/algorithm/frequency_estimation/src/frequency_estimation.cpp +++ b/vibration_convert/core/algorithm/frequency_estimation/src/frequency_estimation.cpp @@ -22,10 +22,12 @@ #include "sensor_log.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "FrequencyEstimation" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "FrequencyEstimation" }; constexpr double BASE_SEMITONE { 69.0 }; constexpr double PITCH_INTERVAL_MIN { 12.0 }; constexpr double LA_FREQUENCE { 440.0 }; diff --git a/vibration_convert/core/algorithm/intensity_processor/src/intensity_processor.cpp b/vibration_convert/core/algorithm/intensity_processor/src/intensity_processor.cpp index 406f825db1c0d46d45a3f28d2997f9375de97b38..6bcf8f86f81fc2b68bab8032073591620df77861 100644 --- a/vibration_convert/core/algorithm/intensity_processor/src/intensity_processor.cpp +++ b/vibration_convert/core/algorithm/intensity_processor/src/intensity_processor.cpp @@ -19,10 +19,12 @@ #include "sensor_log.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "IntensityProcessor" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "IntensityProcessor" }; constexpr double VOLUME_DB_COEF { 10.0 }; } // namespace diff --git a/vibration_convert/core/algorithm/onset/src/onset.cpp b/vibration_convert/core/algorithm/onset/src/onset.cpp index 5f0d9a3a26b0f5324aefbbe6448fc41cb1f38665..1d6d07a5f21037cbb00a5852c24ec8615dcef0fc 100644 --- a/vibration_convert/core/algorithm/onset/src/onset.cpp +++ b/vibration_convert/core/algorithm/onset/src/onset.cpp @@ -25,10 +25,12 @@ #include "sensors_errors.h" #include "utils.h" +#undef LOG_TAG +#define LOG_TAG "Onset" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "Onset" }; // Effective threshold of note envelope constexpr double C_ONSET_ENV_VALIDE_THRESHOLD = 0.0001; constexpr double POWER_DB_COEF = 10.0; diff --git a/vibration_convert/core/algorithm/peak_finder/src/peak_finder.cpp b/vibration_convert/core/algorithm/peak_finder/src/peak_finder.cpp index 9ea09d51e8dbae53d4088acc204efbd10f18737a..6dd3e397383238b4c572816ddb38165a17bc4645 100644 --- a/vibration_convert/core/algorithm/peak_finder/src/peak_finder.cpp +++ b/vibration_convert/core/algorithm/peak_finder/src/peak_finder.cpp @@ -23,10 +23,12 @@ #include "sensors_errors.h" #include "utils.h" +#undef LOG_TAG +#define LOG_TAG "PeakFinder" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "PeakFinder" }; constexpr size_t MAX_N { 32 }; constexpr int32_t PEAKS_MIN_SAMPLE_COUNT { 512 }; constexpr double REMOVE_RATIO { 0.1 }; diff --git a/vibration_convert/core/native/src/audio_parsing.cpp b/vibration_convert/core/native/src/audio_parsing.cpp index 1dc57ff03a1e98a269ba39e587594a98239e8015..1abf1d8bbaa776ffcd05cd27d8125c6e8dfb0340 100644 --- a/vibration_convert/core/native/src/audio_parsing.cpp +++ b/vibration_convert/core/native/src/audio_parsing.cpp @@ -30,10 +30,12 @@ #include "vibration_convert_core.h" #include "vibration_convert_type.h" +#undef LOG_TAG +#define LOG_TAG "AudioParsing" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, Sensors::SENSOR_LOG_DOMAIN, "AudioParsing"}; constexpr int32_t MIN_SAMPLE_COUNT = 4096; constexpr uint32_t AUDIO_DATA_CONVERSION_FACTOR = INT32_MAX; constexpr int32_t AUDIO_DATA_MAX_NUMBER = 100000; diff --git a/vibration_convert/core/native/src/generate_vibration_json_file.cpp b/vibration_convert/core/native/src/generate_vibration_json_file.cpp index 6135a0086f522aba1e3b0618281a0defc9d95e54..3dcc64e872fbd6235d2c00f3eda1784c1817c6c8 100644 --- a/vibration_convert/core/native/src/generate_vibration_json_file.cpp +++ b/vibration_convert/core/native/src/generate_vibration_json_file.cpp @@ -24,11 +24,11 @@ #include "sensor_log.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "GenerateVibrationJsonFile" + namespace OHOS { namespace Sensors { -namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, Sensors::SENSOR_LOG_DOMAIN, "GenerateVibrationJsonFile" }; -} int32_t GenerateVibrationJsonFile::GenerateJsonFile(std::vector &hapticEvents) { diff --git a/vibration_convert/core/native/src/vibration_convert_core.cpp b/vibration_convert/core/native/src/vibration_convert_core.cpp index dc08e3cfaf120a838cc2247efe529a7b856e90e6..5cd5a78798a12d4a1fcebf2c751c0d097852983e 100644 --- a/vibration_convert/core/native/src/vibration_convert_core.cpp +++ b/vibration_convert/core/native/src/vibration_convert_core.cpp @@ -21,10 +21,12 @@ #include "sensors_errors.h" #include "vibration_convert_core.h" +#undef LOG_TAG +#define LOG_TAG "VibrationConvertCore" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "VibrationConvertCore" }; constexpr double AMP_INVALIDE_DELTA { 0.001 }; constexpr int32_t FRAGMENT_MIN_LEN { 32 }; constexpr double COEF { 0.01 }; diff --git a/vibration_convert/core/native/test/unittest/generate_json_test.cpp b/vibration_convert/core/native/test/unittest/generate_json_test.cpp index 88735acb2ef940486d05c8e58996562146f8b923..f0e430da9f6f95eea9173214b8b3e638209b10c5 100644 --- a/vibration_convert/core/native/test/unittest/generate_json_test.cpp +++ b/vibration_convert/core/native/test/unittest/generate_json_test.cpp @@ -26,15 +26,14 @@ #include "vibration_convert_core.h" #include "vibration_convert_type.h" +#undef LOG_TAG +#define LOG_TAG "GenerateJsonFileTest" + namespace OHOS { namespace Sensors { using namespace testing::ext; using namespace OHOS::HiviewDFX; -namespace { - constexpr HiLogLabel LABEL = { LOG_CORE, OHOS::Sensors::SENSOR_LOG_DOMAIN, "GenerateJsonFileTest" }; -} // namespace - class GenerateJsonFileTest : public testing::Test { public: static void SetUpTestCase(); diff --git a/vibration_convert/core/utils/src/audio_utils.cpp b/vibration_convert/core/utils/src/audio_utils.cpp index 428c816af6fb3b5af866cd736b3d74eecb92cbb0..4445058a03300a663af5d6f204150e574a20141c 100644 --- a/vibration_convert/core/utils/src/audio_utils.cpp +++ b/vibration_convert/core/utils/src/audio_utils.cpp @@ -16,10 +16,12 @@ #include "audio_utils.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "AudioUtils" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, Sensors::SENSOR_LOG_DOMAIN, "AudioUtils"}; constexpr int32_t MTOF_ARRAY_SIZE = 128; // This is a lookup table for converting midi to frequency constexpr double MTOF_ARRAY[MTOF_ARRAY_SIZE + 1] = { diff --git a/vibration_convert/core/utils/src/utils.cpp b/vibration_convert/core/utils/src/utils.cpp index 275218cc54804fd5c69a7706049b523c685fff72..65a7d22a10a3f0b3572b37822601ff4d5ffeebf3 100644 --- a/vibration_convert/core/utils/src/utils.cpp +++ b/vibration_convert/core/utils/src/utils.cpp @@ -28,10 +28,12 @@ #include "sensor_log.h" #include "sensors_errors.h" +#undef LOG_TAG +#define LOG_TAG "Utils" + namespace OHOS { namespace Sensors { namespace{ -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "Utils" }; constexpr double PERCENTAGE_RANGE = 100.0; constexpr int32_t VOICE_MIN_INTENSITY_NORM = 25; constexpr size_t MAX_SIZE = 26460000; diff --git a/vibration_convert/interfaces/js/src/vibrator_convert_js.cpp b/vibration_convert/interfaces/js/src/vibrator_convert_js.cpp index 2740d5e503ff24c1bfcc5579aeb1ea2871f803af..617dec03aa0d9e5e34a7bc296f00716a9f975025 100644 --- a/vibration_convert/interfaces/js/src/vibrator_convert_js.cpp +++ b/vibration_convert/interfaces/js/src/vibrator_convert_js.cpp @@ -22,10 +22,12 @@ #include "sensor_napi_error.h" #include "vibrator_convert_napi_utils.h" +#undef LOG_TAG +#define LOG_TAG "VibratorConvert" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "VibratorConvert" }; const char* CONVERT = "convert"; const char* CONVERT_CLASS = "convert_class"; } // namespace diff --git a/vibration_convert/interfaces/js/src/vibrator_convert_napi_utils.cpp b/vibration_convert/interfaces/js/src/vibrator_convert_napi_utils.cpp index d1021c8125c2860e890d74fb061a6bfeaebde044..d5e86df79dfea935d2c0ba05c1cea19b1263463f 100644 --- a/vibration_convert/interfaces/js/src/vibrator_convert_napi_utils.cpp +++ b/vibration_convert/interfaces/js/src/vibrator_convert_napi_utils.cpp @@ -25,10 +25,12 @@ #include "sensor_napi_error.h" #include "vibration_convert_type.h" +#undef LOG_TAG +#define LOG_TAG "VibratorConvertNapiUtils" + namespace OHOS { namespace Sensors { namespace { -constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, SENSOR_LOG_DOMAIN, "VibratorConvertNapiUtils"}; constexpr int32_t RESULT_LENGTH = 2; constexpr int64_t INVALID_FILE_SIZE = -1; } // namespace