diff options
author | Artem Nosach <ANosach@luxoft.com> | 2016-06-17 14:58:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-17 14:58:37 +0300 |
commit | 7e9a2198ad57f1d8a9da70402c4db4c7e53b9e3d (patch) | |
tree | 92785f58a4004b9fae1ec550e5fa12ebbb2410cb | |
parent | c28abf92bc3201160968ba83be72d2db46c5dc55 (diff) | |
parent | 7b817d1b7577586bb4a91fca7ba7ff3330103366 (diff) | |
download | sdl_core-7e9a2198ad57f1d8a9da70402c4db4c7e53b9e3d.tar.gz |
Merge pull request #587 from OHerasym/feature/adapt_logger_macroses
Adapt logger macroses
474 files changed, 5670 insertions, 6692 deletions
diff --git a/src/appMain/life_cycle.cc b/src/appMain/life_cycle.cc index b344ecf58b..815329196a 100644 --- a/src/appMain/life_cycle.cc +++ b/src/appMain/life_cycle.cc @@ -57,7 +57,7 @@ using threads::Thread; namespace main_namespace { -CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain") +SDL_CREATE_LOGGER("SDLMain") namespace { void NameMessageBrokerThread(const System::Thread& thread, @@ -105,11 +105,11 @@ LifeCycle::LifeCycle(const profile::Profile& profile) } bool LifeCycle::StartComponents() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); #ifdef OS_WINDOWS WSAData wsa_data; if (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data)) { - LOGGER_ERROR(logger_, "WSAStartup() failed"); + SDL_ERROR("WSAStartup() failed"); return false; } #endif @@ -142,7 +142,7 @@ bool LifeCycle::StartComponents() { media_manager_ = new media_manager::MediaManagerImpl( *app_manager_, *protocol_handler_, profile_); if (!app_manager_->Init(*last_state_, media_manager_)) { - LOGGER_ERROR(logger_, "Application manager init failed."); + SDL_ERROR("Application manager init failed."); return false; } @@ -161,7 +161,7 @@ bool LifeCycle::StartComponents() { app_manager_->AddPolicyObserver(crypto_manager_); if (!crypto_manager_->Init()) { - LOGGER_ERROR(logger_, "CryptoManager initialization fail."); + SDL_ERROR("CryptoManager initialization fail."); return false; } #endif // ENABLE_SECURITY @@ -203,34 +203,34 @@ bool LifeCycle::InitMessageSystem() { DCHECK(!message_broker_) message_broker_ = NsMessageBroker::CMessageBroker::getInstance(); if (!message_broker_) { - LOGGER_FATAL(logger_, " Wrong pMessageBroker pointer!"); + SDL_FATAL(" Wrong pMessageBroker pointer!"); return false; } message_broker_server_ = new NsMessageBroker::TcpServer( profile_.server_address(), profile_.server_port(), message_broker_); if (!message_broker_server_) { - LOGGER_FATAL(logger_, " Wrong pJSONRPC20Server pointer!"); + SDL_FATAL(" Wrong pJSONRPC20Server pointer!"); return false; } message_broker_->startMessageBroker(message_broker_server_); if (!networking::init()) { - LOGGER_FATAL(logger_, " Networking initialization failed!"); + SDL_FATAL(" Networking initialization failed!"); return false; } if (!message_broker_server_->Bind()) { - LOGGER_FATAL(logger_, "Message broker server bind failed!"); + SDL_FATAL("Message broker server bind failed!"); return false; } else { - LOGGER_INFO(logger_, "Message broker server bind successful!"); + SDL_INFO("Message broker server bind successful!"); } if (!message_broker_server_->Listen()) { - LOGGER_FATAL(logger_, "Message broker server listen failed!"); + SDL_FATAL("Message broker server listen failed!"); return false; } else { - LOGGER_INFO(logger_, " Message broker server listen successful!"); + SDL_INFO(" Message broker server listen successful!"); } mb_adapter_ = new hmi_message_handler::MessageBrokerAdapter( @@ -238,11 +238,11 @@ bool LifeCycle::InitMessageSystem() { hmi_handler_->AddHMIMessageAdapter(mb_adapter_); if (!mb_adapter_->Connect()) { - LOGGER_FATAL(logger_, "Cannot connect to remote peer!"); + SDL_FATAL("Cannot connect to remote peer!"); return false; } - LOGGER_INFO(logger_, "Start CMessageBroker thread!"); + SDL_INFO("Start CMessageBroker thread!"); mb_thread_ = new System::Thread( new System::ThreadArgImpl<NsMessageBroker::CMessageBroker>( *message_broker_, @@ -253,7 +253,7 @@ bool LifeCycle::InitMessageSystem() { // thread doesn't have valid Id to associate name with NameMessageBrokerThread(*mb_thread_, "MessageBroker"); - LOGGER_INFO(logger_, "Start MessageBroker TCP server thread!"); + SDL_INFO("Start MessageBroker TCP server thread!"); mb_server_thread_ = new System::Thread(new System::ThreadArgImpl<NsMessageBroker::TcpServer>( *message_broker_server_, @@ -262,7 +262,7 @@ bool LifeCycle::InitMessageSystem() { mb_server_thread_->Start(false); NameMessageBrokerThread(*mb_server_thread_, "MB TCPServer"); - LOGGER_INFO(logger_, "StartAppMgr JSONRPC 2.0 controller receiver thread!"); + SDL_INFO("StartAppMgr JSONRPC 2.0 controller receiver thread!"); mb_adapter_thread_ = new System::Thread( new System::ThreadArgImpl<hmi_message_handler::MessageBrokerAdapter>( *mb_adapter_, @@ -285,13 +285,13 @@ bool LifeCycle::InitMessageSystem() { hmi_handler_.AddHMIMessageAdapter(dbus_adapter_); if (!dbus_adapter_->Init()) { - LOGGER_FATAL(logger_, "Cannot init DBus service!"); + SDL_FATAL("Cannot init DBus service!"); return false; } dbus_adapter_->SubscribeTo(); - LOGGER_INFO(logger_, "Start DBusMessageAdapter thread!"); + SDL_INFO("Start DBusMessageAdapter thread!"); dbus_adapter_thread_ = new System::Thread( new System::ThreadArgImpl<hmi_message_handler::DBusMessageAdapter>( *dbus_adapter_, @@ -313,14 +313,14 @@ bool LifeCycle::InitMessageSystem() { #endif // MQUEUE_HMIADAPTER void LifeCycle::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ::utils::CreateSdlEvent(); ::utils::SubscribeToTerminationSignals(); ::utils::WaitForSdlExecute(); } void LifeCycle::StopComponents() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(hmi_handler_); hmi_handler_->set_message_observer(NULL); @@ -334,7 +334,7 @@ void LifeCycle::StopComponents() { DCHECK_OR_RETURN_VOID(app_manager_); app_manager_->Stop(); - LOGGER_INFO(logger_, "Stopping Protocol Handler"); + SDL_INFO("Stopping Protocol Handler"); DCHECK_OR_RETURN_VOID(protocol_handler_); protocol_handler_->RemoveProtocolObserver(media_manager_); @@ -342,52 +342,52 @@ void LifeCycle::StopComponents() { protocol_handler_->RemoveProtocolObserver(security_manager_); if (security_manager_) { security_manager_->RemoveListener(app_manager_); - LOGGER_INFO(logger_, "Destroying Crypto Manager"); + SDL_INFO("Destroying Crypto Manager"); delete crypto_manager_; crypto_manager_ = NULL; - LOGGER_INFO(logger_, "Destroying Security Manager"); + SDL_INFO("Destroying Security Manager"); delete security_manager_; security_manager_ = NULL; } #endif // ENABLE_SECURITY protocol_handler_->Stop(); - LOGGER_INFO(logger_, "Destroying Media Manager"); + SDL_INFO("Destroying Media Manager"); DCHECK_OR_RETURN_VOID(media_manager_); delete media_manager_; media_manager_ = NULL; - LOGGER_INFO(logger_, "Destroying Transport Manager."); + SDL_INFO("Destroying Transport Manager."); DCHECK_OR_RETURN_VOID(transport_manager_); transport_manager_->Visibility(false); transport_manager_->Stop(); delete transport_manager_; transport_manager_ = NULL; - LOGGER_INFO(logger_, "Stopping Connection Handler."); + SDL_INFO("Stopping Connection Handler."); DCHECK_OR_RETURN_VOID(connection_handler_); connection_handler_->Stop(); - LOGGER_INFO(logger_, "Destroying Protocol Handler"); + SDL_INFO("Destroying Protocol Handler"); DCHECK(protocol_handler_); delete protocol_handler_; protocol_handler_ = NULL; - LOGGER_INFO(logger_, "Destroying Connection Handler."); + SDL_INFO("Destroying Connection Handler."); delete connection_handler_; connection_handler_ = NULL; - LOGGER_INFO(logger_, "Destroying Last State"); + SDL_INFO("Destroying Last State"); DCHECK(last_state_); delete last_state_; last_state_ = NULL; - LOGGER_INFO(logger_, "Destroying Application Manager."); + SDL_INFO("Destroying Application Manager."); DCHECK(app_manager_); delete app_manager_; app_manager_ = NULL; - LOGGER_INFO(logger_, "Destroying HMI Message Handler and MB adapter."); + SDL_INFO("Destroying HMI Message Handler and MB adapter."); #ifdef DBUS_HMIADAPTER if (dbus_adapter_) { @@ -415,7 +415,7 @@ void LifeCycle::StopComponents() { delete hmi_handler_; hmi_handler_ = NULL; - LOGGER_INFO(logger_, "Destroying Message Broker"); + SDL_INFO("Destroying Message Broker"); StopThread(mb_server_thread_); StopThread(mb_thread_); if (message_broker_server_) { diff --git a/src/appMain/main.cc b/src/appMain/main.cc index f1214f1d88..df4072948b 100644 --- a/src/appMain/main.cc +++ b/src/appMain/main.cc @@ -42,9 +42,9 @@ * \param argv array of arguments * \return EXIT_SUCCESS or EXIT_FAILURE */ + int main(int argc, char* argv[]) { PLATFORM_INIT(argc, argv); - profile::Profile profile_instance; if ((argc > 1) && (0 != argv)) { profile_instance.config_file_name(argv[1]); @@ -54,35 +54,32 @@ int main(int argc, char* argv[]) { threads::Thread::SetNameForId(threads::Thread::CurrentId(), "MainThread"); - INIT_LOGGER(profile_instance.logs_enabled()); - CREATE_LOGGERPTR_LOCAL(logger_, "SDLMain") + logger::LoggerAutoPtr logger_auto_ptr(profile_instance.logs_enabled()); + SDL_CREATE_LOGGER("SDLMain"); - LOGGER_INFO(logger_, "Application started!"); - LOGGER_INFO(logger_, "SDL version: " << profile_instance.sdl_version()); + SDL_INFO("Application started!"); + SDL_INFO("SDL version: " << profile_instance.sdl_version()); main_namespace::LifeCycle life_cycle(profile_instance); if (!life_cycle.StartComponents()) { - LOGGER_FATAL(logger_, "Failed to start components"); + SDL_FATAL("Failed to start components"); life_cycle.StopComponents(); - DEINIT_LOGGER(); exit(EXIT_FAILURE); } - LOGGER_INFO(logger_, "Components have been started"); + SDL_INFO("Components have been started"); if (!life_cycle.InitMessageSystem()) { - LOGGER_FATAL(logger_, "Failed to init message system"); + SDL_FATAL("Failed to init message system"); life_cycle.StopComponents(); - DEINIT_LOGGER(); exit(EXIT_FAILURE); } - LOGGER_INFO(logger_, "Message system has been initialized"); + SDL_INFO("Message system has been initialized"); life_cycle.Run(); - LOGGER_INFO(logger_, "Stop SDL due to caught signal"); + SDL_INFO("Stop SDL due to caught signal"); life_cycle.StopComponents(); - LOGGER_INFO(logger_, "Application has been stopped successfuly"); + SDL_INFO("Application has been stopped successfuly"); - DEINIT_LOGGER(); return EXIT_SUCCESS; } diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 2161f2dbf9..eb66d13bb9 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -488,9 +488,8 @@ class ApplicationManagerImpl mobile_apis::AudioStreamingState::eType audio_state) { ApplicationSharedPtr app = application(app_id); if (!app) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") - LOGGER_ERROR(logger_, - "Application with appID=" << app_id << " does not exist"); + SDL_CREATE_LOGGER("ApplicationManager") + SDL_ERROR("Application with appID=" << app_id << " does not exist"); return; } state_ctrl_.SetRegularState(app, audio_state); @@ -506,9 +505,8 @@ class ApplicationManagerImpl void SetState(uint32_t app_id, HmiStatePtr new_state) { ApplicationSharedPtr app = application(app_id); if (!app) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") - LOGGER_ERROR(logger_, - "Application with appID=" << app_id << " does not exist"); + SDL_CREATE_LOGGER("ApplicationManager") + SDL_ERROR("Application with appID=" << app_id << " does not exist"); return; } state_ctrl_.SetRegularState(app, new_state, SendActivateApp); @@ -523,9 +521,8 @@ class ApplicationManagerImpl void SetState(uint32_t app_id, mobile_apis::HMILevel::eType hmi_level) { ApplicationSharedPtr app = application(app_id); if (!app) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") - LOGGER_ERROR(logger_, - "Application with appID=" << app_id << " does not exist"); + SDL_CREATE_LOGGER("ApplicationManager") + SDL_ERROR("Application with appID=" << app_id << " does not exist"); return; } state_ctrl_.SetRegularState(app, hmi_level, SendActivateApp); @@ -544,9 +541,8 @@ class ApplicationManagerImpl mobile_apis::AudioStreamingState::eType audio_state) { ApplicationSharedPtr app = application(app_id); if (!app) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") - LOGGER_ERROR(logger_, - "Application with appID=" << app_id << " does not exist"); + SDL_CREATE_LOGGER("ApplicationManager") + SDL_ERROR("Application with appID=" << app_id << " does not exist"); return; } state_ctrl_.SetRegularState(app, hmi_level, audio_state, SendActivateApp); @@ -566,9 +562,8 @@ class ApplicationManagerImpl mobile_apis::SystemContext::eType system_context) { ApplicationSharedPtr app = application(app_id); if (!app) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") - LOGGER_ERROR(logger_, - "Application with appID=" << app_id << " does not exist"); + SDL_CREATE_LOGGER("ApplicationManager") + SDL_ERROR("Application with appID=" << app_id << " does not exist"); return; } state_ctrl_.SetRegularState( @@ -584,9 +579,8 @@ class ApplicationManagerImpl mobile_apis::SystemContext::eType system_context) { ApplicationSharedPtr app = application(app_id); if (!app) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") - LOGGER_ERROR(logger_, - "Application with appID=" << app_id << " does not exist"); + SDL_CREATE_LOGGER("ApplicationManager") + SDL_ERROR("Application with appID=" << app_id << " does not exist"); return; } state_ctrl_.SetRegularState(app, system_context); @@ -600,9 +594,8 @@ class ApplicationManagerImpl void SetHmiState(uint32_t app_id, mobile_apis::HMILevel::eType hmi_level) { ApplicationSharedPtr app = application(app_id); if (!app) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") - LOGGER_ERROR(logger_, - "Application with appID=" << app_id << " does not exist"); + SDL_CREATE_LOGGER("ApplicationManager") + SDL_ERROR("Application with appID=" << app_id << " does not exist"); return; } state_ctrl_.SetRegularState(app, hmi_level); @@ -616,9 +609,8 @@ class ApplicationManagerImpl void SetState(uint32_t app_id, HmiStatePtr state) { ApplicationSharedPtr app = application(app_id); if (!app) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") - LOGGER_ERROR(logger_, - "Application with appID=" << app_id << " does not exist"); + SDL_CREATE_LOGGER("ApplicationManager") + SDL_ERROR("Application with appID=" << app_id << " does not exist"); return; } state_ctrl_.SetRegularState(app, state); @@ -1181,14 +1173,14 @@ class ApplicationManagerImpl void PrepareApplicationListSO(ApplicationList app_list, smart_objects::SmartObject& applications, ApplicationManager& app_mngr) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager"); + SDL_CREATE_LOGGER("ApplicationManager"); smart_objects::SmartArray* app_array = applications.asArray(); uint32_t app_count = NULL == app_array ? 0 : app_array->size(); typename ApplicationList::const_iterator it; for (it = app_list.begin(); it != app_list.end(); ++it) { if (!it->valid()) { - LOGGER_ERROR(logger_, "Application not found "); + SDL_ERROR("Application not found "); continue; } @@ -1202,12 +1194,12 @@ class ApplicationManagerImpl app_mngr)) { applications[app_count++] = hmi_application; } else { - LOGGER_DEBUG(logger_, "Can't CreateHMIApplicationStruct "); + SDL_DEBUG("Can't CreateHMIApplicationStruct "); } } if (0 == app_count) { - LOGGER_WARN(logger_, "Empty applications list"); + SDL_WARN("Empty applications list"); } } diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index f9453d89a0..3eeef28079 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -161,12 +161,8 @@ class CommandImpl : public Command { bool allowed_to_terminate_; ApplicationManager& application_manager_; #ifdef ENABLE_LOG -#if defined(OS_POSIX) - static log4cxx::LoggerPtr logger_; -#elif defined(OS_WINDOWS) - static std::string logger_; + static logger::LoggerType logger_module_ptr; #endif -#endif // ENABLE_LOG private: DISALLOW_COPY_AND_ASSIGN(CommandImpl); diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h index e2112839b7..262c1cb8a5 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h @@ -60,7 +60,7 @@ class VIGetVehicleDataRequestTemplate : public RequestToHMI { * @brief Execute command with sending DBus thin request to HMI **/ virtual void Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h index 2c7d5ed845..f186294bc5 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h @@ -59,7 +59,7 @@ class VIGetVehicleDataResponseTemplate : public ResponseFromHMI { * @brief Execute command **/ virtual void Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(eventID); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h index ec653c5507..0155a51d21 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h @@ -60,7 +60,7 @@ class VISubscribeVehicleDataRequestTemplate : public RequestToHMI { * @brief Execute command with sending DBus thin request to HMI **/ virtual void Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h index ce09624892..7ac2407a0f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h @@ -58,7 +58,7 @@ class VISubscribeVehicleDataResponseTemplate : public ResponseFromHMI { * @brief Execute command **/ virtual void Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(eventID); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h index 550d2482e8..910bb6c0f1 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h @@ -60,7 +60,7 @@ class VIUnsubscribeVehicleDataRequestTemplate : public RequestToHMI { * @brief Execute command with sending DBus thin request to HMI **/ virtual void Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h index 514fd7bf4d..93fe9bfeb1 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h @@ -59,7 +59,7 @@ class VIUnsubscribeVehicleDataResponseTemplate : public ResponseFromHMI { * @brief Execute command **/ virtual void Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(eventID); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc index 594fba5359..d74276e3ed 100644 --- a/src/components/application_manager/src/application_data_impl.cc +++ b/src/components/application_manager/src/application_data_impl.cc @@ -37,7 +37,7 @@ #include "utils/logger.h" namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOGGER("ApplicationManager") InitialApplicationDataImpl::InitialApplicationDataImpl() : app_types_(NULL) @@ -416,7 +416,7 @@ void DynamicApplicationDataImpl::SetGlobalProperties( (this->*callback)(param); } } else { - LOGGER_WARN(logger_, "Invalid or Null smart object"); + SDL_WARN("Invalid or Null smart object"); } } diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 532675769e..25876d42af 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -70,7 +70,7 @@ mobile_apis::FileType::eType StringToFileType(const char* str) { } } -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOGGER("ApplicationManager") namespace application_manager { ApplicationImpl::ApplicationImpl( uint32_t application_id, @@ -207,17 +207,17 @@ bool ApplicationImpl::IsAudioApplication() const { } void ApplicationImpl::SetRegularState(HmiStatePtr state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); state_.AddState(state); } void ApplicationImpl::RemovePostponedState() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); state_.RemoveState(HmiState::STATE_ID_POSTPONED); } void ApplicationImpl::SetPostponedState(HmiStatePtr state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); state_.AddState(state); } @@ -230,12 +230,12 @@ struct StateIDComparator { }; void ApplicationImpl::AddHMIState(HmiStatePtr state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); state_.AddState(state); } void ApplicationImpl::RemoveHMIState(HmiState::StateID state_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); state_.RemoveState(state_id); } @@ -391,19 +391,19 @@ bool ApplicationImpl::audio_streaming_allowed() const { void ApplicationImpl::StartStreaming( protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (ServiceType::kMobileNav == service_type) { - LOGGER_TRACE(logger_, "ServiceType = Video"); + SDL_TRACE("ServiceType = Video"); if (!video_streaming_approved()) { - LOGGER_TRACE(logger_, "Video streaming not approved"); + SDL_TRACE("Video streaming not approved"); MessageHelper::SendNaviStartStream(app_id(), application_manager_); set_video_stream_retry_number(0); } } else if (ServiceType::kAudio == service_type) { - LOGGER_TRACE(logger_, "ServiceType = Audio"); + SDL_TRACE("ServiceType = Audio"); if (!audio_streaming_approved()) { - LOGGER_TRACE(logger_, "Audio streaming not approved"); + SDL_TRACE("Audio streaming not approved"); MessageHelper::SendAudioStartStream(app_id(), application_manager_); set_audio_stream_retry_number(0); } @@ -413,7 +413,7 @@ void ApplicationImpl::StartStreaming( void ApplicationImpl::StopStreamingForce( protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SuspendStreaming(service_type); @@ -427,7 +427,7 @@ void ApplicationImpl::StopStreamingForce( void ApplicationImpl::StopStreaming( protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SuspendStreaming(service_type); @@ -440,7 +440,7 @@ void ApplicationImpl::StopStreaming( } void ApplicationImpl::StopNaviStreaming() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); video_stream_suspend_timer_.Stop(); MessageHelper::SendNaviStopStream(app_id(), application_manager_); set_video_streaming_approved(false); @@ -448,7 +448,7 @@ void ApplicationImpl::StopNaviStreaming() { } void ApplicationImpl::StopAudioStreaming() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); audio_stream_suspend_timer_.Stop(); MessageHelper::SendAudioStopStream(app_id(), application_manager_); set_audio_streaming_approved(false); @@ -458,7 +458,7 @@ void ApplicationImpl::StopAudioStreaming() { void ApplicationImpl::SuspendStreaming( protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (ServiceType::kMobileNav == service_type) { video_stream_suspend_timer_.Stop(); @@ -477,7 +477,7 @@ void ApplicationImpl::SuspendStreaming( void ApplicationImpl::WakeUpStreaming( protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (ServiceType::kMobileNav == service_type) { sync_primitives::AutoLock lock(video_streaming_suspended_lock_); @@ -504,15 +504,15 @@ void ApplicationImpl::WakeUpStreaming( void ApplicationImpl::OnVideoStreamSuspend() { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); - LOGGER_INFO(logger_, "Suspend video streaming by timer"); + SDL_AUTO_TRACE(); + SDL_INFO("Suspend video streaming by timer"); SuspendStreaming(ServiceType::kMobileNav); } void ApplicationImpl::OnAudioStreamSuspend() { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); - LOGGER_INFO(logger_, "Suspend audio streaming by timer"); + SDL_AUTO_TRACE(); + SDL_INFO("Suspend audio streaming by timer"); SuspendStreaming(ServiceType::kAudio); } @@ -604,9 +604,8 @@ bool ApplicationImpl::is_resuming() const { bool ApplicationImpl::AddFile(const AppFile& file) { if (app_files_.count(file.file_name) == 0) { - LOGGER_INFO(logger_, - "AddFile file " << file.file_name << " File type is " - << file.file_type); + SDL_INFO("AddFile file " << file.file_name << " File type is " + << file.file_type); app_files_[file.file_name] = file; return true; } @@ -615,9 +614,8 @@ bool ApplicationImpl::AddFile(const AppFile& file) { bool ApplicationImpl::UpdateFile(const AppFile& file) { if (app_files_.count(file.file_name) != 0) { - LOGGER_INFO(logger_, - "UpdateFile file " << file.file_name << " File type is " - << file.file_type); + SDL_INFO("UpdateFile file " << file.file_name << " File type is " + << file.file_type); app_files_[file.file_name] = file; return true; } @@ -627,9 +625,8 @@ bool ApplicationImpl::UpdateFile(const AppFile& file) { bool ApplicationImpl::DeleteFile(const std::string& file_name) { AppFilesMap::iterator it = app_files_.find(file_name); if (it != app_files_.end()) { - LOGGER_INFO(logger_, - "DeleteFile file " << it->second.file_name << " File type is " - << it->second.file_type); + SDL_INFO("DeleteFile file " << it->second.file_name << " File type is " + << it->second.file_type); app_files_.erase(it); return true; } @@ -699,8 +696,7 @@ bool ApplicationImpl::IsCommandLimitsExceeded( CommandNumberTimeLimit::iterator it = cmd_number_to_time_limits_.find(cmd_id); if (cmd_number_to_time_limits_.end() == it) { - LOGGER_WARN(logger_, - "Limits for command id " << cmd_id << "had not been set."); + SDL_WARN("Limits for command id " << cmd_id << "had not been set."); return true; } @@ -716,18 +712,16 @@ bool ApplicationImpl::IsCommandLimitsExceeded( frequency_restrictions = application_manager_.get_settings().get_vehicle_data_frequency(); } else { - LOGGER_INFO(logger_, "No restrictions for request"); + SDL_INFO("No restrictions for request"); return false; } - LOGGER_INFO(logger_, - "Time Info: " - << "\n Current: " << current.tv_sec << "\n Limit: (" - << limit.first.tv_sec << "," << limit.second - << ")" - "\n frequency_restrictions: (" - << frequency_restrictions.first << "," - << frequency_restrictions.second << ")"); + SDL_INFO("Time Info: " + << "\n Current: " << current.tv_sec << "\n Limit: (" + << limit.first.tv_sec << "," << limit.second + << ")" + "\n frequency_restrictions: (" << frequency_restrictions.first + << "," << frequency_restrictions.second << ")"); if (current.tv_sec < limit.first.tv_sec + frequency_restrictions.second) { if (limit.second < frequency_restrictions.first) { ++limit.second; @@ -782,7 +776,7 @@ bool ApplicationImpl::IsCommandLimitsExceeded( break; } default: { - LOGGER_WARN(logger_, "Limit source is not implemented."); + SDL_WARN("Limit source is not implemented."); break; } } @@ -813,7 +807,7 @@ void ApplicationImpl::set_is_application_data_changed( } void ApplicationImpl::UpdateHash() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); hash_val_ = utils::gen_hash(application_manager_.get_settings().hash_string_size()); set_is_application_data_changed(true); @@ -835,7 +829,7 @@ void ApplicationImpl::CleanupFiles() { app_files_it = app_files_.find(file_name); if ((app_files_it == app_files_.end()) || (!app_files_it->second.is_persistent)) { - LOGGER_INFO(logger_, "DeleteFile file " << file_name); + SDL_INFO("DeleteFile file " << file_name); file_system::DeleteFile(file_name); } } @@ -885,9 +879,8 @@ void ApplicationImpl::LoadPersistentFiles() { file.file_type = StringToFileType(file_type.c_str()); } - LOGGER_INFO(logger_, - "Loaded persistent file " - << file.file_name << " File type is " << file.file_type); + SDL_INFO("Loaded persistent file " << file.file_name << " File type is " + << file.file_type); AddFile(file); } } diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 5dcc5868fa..38fa0fab69 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -69,7 +69,7 @@ #define ssize_t SSIZE_T #endif -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOGGER("ApplicationManager") namespace application_manager { @@ -179,7 +179,7 @@ ApplicationManagerImpl::ApplicationManagerImpl( } ApplicationManagerImpl::~ApplicationManagerImpl() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); is_stopping_ = true; SendOnSDLClose(); @@ -195,7 +195,7 @@ ApplicationManagerImpl::~ApplicationManagerImpl() { mobile_so_factory_ = NULL; } protocol_handler_ = NULL; - LOGGER_DEBUG(logger_, "Destroying Policy Handler"); + SDL_DEBUG("Destroying Policy Handler"); RemovePolicyObserver(this); sync_primitives::AutoLock lock(timer_pool_lock_); @@ -211,11 +211,11 @@ ApplicationSharedPtr FindApp(DataAccessor<ApplicationSet> accessor, ApplicationSet::iterator it = std::find_if( accessor.GetData().begin(), accessor.GetData().end(), finder); if (accessor.GetData().end() == it) { - LOGGER_DEBUG(logger_, "Unable to find application"); + SDL_DEBUG("Unable to find application"); return ApplicationSharedPtr(); } ApplicationSharedPtr app = *it; - LOGGER_DEBUG(logger_, " Found Application app_id = " << app->app_id()); + SDL_DEBUG(" Found Application app_id = " << app->app_id()); return app; } @@ -227,11 +227,11 @@ ApplicationSharedPtr FindApp( std::find_if( accessor.GetData().begin(), accessor.GetData().end(), finder); if (accessor.GetData().end() == it) { - LOGGER_DEBUG(logger_, "Unable to find application"); + SDL_DEBUG("Unable to find application"); return ApplicationSharedPtr(); } ApplicationSharedPtr app = *it; - LOGGER_DEBUG(logger_, " Found Application app_id = " << app->app_id()); + SDL_DEBUG(" Found Application app_id = " << app->app_id()); return app; } @@ -262,6 +262,7 @@ ApplicationSharedPtr ApplicationManagerImpl::application( ApplicationSharedPtr ApplicationManagerImpl::application_by_hmi_app( uint32_t hmi_app_id) const { + SDL_CREATE_LOGGER("ApplicationManager") HmiAppIdPredicate finder(hmi_app_id); DataAccessor<ApplicationSet> accessor = applications(); return FindApp(accessor, finder); @@ -445,7 +446,7 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( const utils::SharedPtr<smart_objects::SmartObject>& request_for_registration) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& message = *request_for_registration; uint32_t connection_key = @@ -460,7 +461,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( DCHECK_OR_RETURN(connection_handler_, ApplicationSharedPtr()); if (connection_handler().GetDataOnSessionKey( connection_key, &app_id, &sessions_list, &device_id) == -1) { - LOGGER_ERROR(logger_, "Failed to create application: no connection info."); + SDL_ERROR("Failed to create application: no connection info."); utils::SharedPtr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( connection_key, @@ -471,14 +472,13 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( return ApplicationSharedPtr(); } - LOGGER_DEBUG(logger_, "Restarting application list update timer"); + SDL_DEBUG("Restarting application list update timer"); GetPolicyHandler().OnAppsSearchStarted(); uint32_t timeout = get_settings().application_list_update_timeout(); application_list_update_timer_.Start(timeout, timer::kSingleShot); if (!is_all_apps_allowed_) { - LOGGER_WARN(logger_, - "RegisterApplication: access to app's disabled by user"); + SDL_WARN("RegisterApplication: access to app's disabled by user"); utils::SharedPtr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( connection_key, @@ -497,10 +497,9 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( std::string device_mac = ""; if (connection_handler().get_session_observer().GetDataOnDeviceID( device_id, NULL, NULL, &device_mac, NULL) == -1) { - LOGGER_ERROR(logger_, "Failed to extract device mac for id " << device_id); + SDL_ERROR("Failed to extract device mac for id " << device_id); } else { - LOGGER_DEBUG(logger_, - "Device mac for id" << device_id << " is " << device_mac); + SDL_DEBUG("Device mac for id" << device_id << " is " << device_mac); } ApplicationSharedPtr application( new ApplicationImpl(app_id, @@ -616,7 +615,7 @@ bool ApplicationManagerImpl::LoadAppDataToHMI(ApplicationSharedPtr app) { bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) { using namespace mobile_api; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(app, false); // remove from resumption if app was activated by user @@ -631,9 +630,9 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) { mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed( ApplicationSharedPtr app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!app) { - LOGGER_ERROR(logger_, "Application pointer invalid"); + SDL_ERROR("Application pointer invalid"); NOTREACHED(); return mobile_api::HMILevel::INVALID_ENUM; } @@ -650,34 +649,30 @@ mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed( } else if (is_active_app_exist && (!is_audio_app)) { result = GetDefaultHmiLevel(app); } - LOGGER_ERROR(logger_, - "is_audio_app : " - << is_audio_app << "; does_audio_app_with_same_type_exist : " - << does_audio_app_with_same_type_exist - << "; is_active_app_exist : " << is_active_app_exist - << "; result : " << result); + SDL_ERROR("is_audio_app : " + << is_audio_app << "; does_audio_app_with_same_type_exist : " + << does_audio_app_with_same_type_exist << "; is_active_app_exist : " + << is_active_app_exist << "; result : " << result); return result; } void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) { // TODO(VS): Call function from ConnectionHandler if (!connection_handler_) { - LOGGER_WARN(logger_, "Connection handler is not set."); + SDL_WARN("Connection handler is not set."); return; } connection_handler::DeviceHandle handle; if (!connection_handler().GetDeviceID(device_mac, &handle)) { - LOGGER_ERROR( - logger_, - "Attempt to connect to invalid device with mac:" << device_mac); + SDL_ERROR("Attempt to connect to invalid device with mac:" << device_mac); return; } connection_handler().ConnectToDevice(handle); } void ApplicationManagerImpl::OnHMIStartedCooperation() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); hmi_cooperating_ = true; MessageHelper::SendGetSystemInfoRequest(*this); @@ -774,8 +769,8 @@ HmiStatePtr ApplicationManagerImpl::CreateRegularState( } bool ApplicationManagerImpl::IsStateActive(HmiState::StateID state_id) const { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Checking for active state id " << state_id); + SDL_AUTO_TRACE(); + SDL_DEBUG("Checking for active state id " << state_id); return state_ctrl_.IsStateActive(state_id); } @@ -785,8 +780,8 @@ void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key, int32_t sampling_rate, int32_t bits_per_sample, int32_t audio_type) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_INFO(logger_, "START MICROPHONE RECORDER"); + SDL_AUTO_TRACE(); + SDL_INFO("START MICROPHONE RECORDER"); DCHECK_OR_RETURN_VOID(media_manager_); media_manager_->StartMicrophoneRecording( session_key, get_settings().recording_file_name(), max_duration); @@ -794,12 +789,12 @@ void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key, void ApplicationManagerImpl::SendAudioPassThroughNotification( uint32_t session_key, std::vector<uint8_t>& binary_data) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!audio_pass_thru_active_) { - LOGGER_ERROR(logger_, - "Trying to send PassThroughNotification" - " when PassThrough is not active"); + SDL_ERROR( + "Trying to send PassThroughNotification" + " when PassThrough is not active"); return; } @@ -810,7 +805,7 @@ void ApplicationManagerImpl::SendAudioPassThroughNotification( } void ApplicationManagerImpl::StopAudioPassThru(int32_t application_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(audio_pass_thru_lock_); DCHECK_OR_RETURN_VOID(media_manager_); media_manager_->StopMicrophoneRecording(application_key); @@ -822,9 +817,9 @@ std::string ApplicationManagerImpl::GetDeviceName( std::string device_name = ""; if (connection_handler().get_session_observer().GetDataOnDeviceID( handle, &device_name, NULL, NULL, NULL) == -1) { - LOGGER_ERROR(logger_, "Failed to extract device name for id " << handle); + SDL_ERROR("Failed to extract device name for id " << handle); } else { - LOGGER_DEBUG(logger_, "\t\t\t\t\tDevice name is " << device_name); + SDL_DEBUG("\t\t\t\t\tDevice name is " << device_name); } return device_name; @@ -840,7 +835,7 @@ ApplicationManagerImpl::GetDeviceTransportType( if (it != devices_type.end()) { return devices_type[transport_type]; } else { - LOGGER_ERROR(logger_, "Unknown transport type " << transport_type); + SDL_ERROR("Unknown transport type " << transport_type); } return result; @@ -848,10 +843,10 @@ ApplicationManagerImpl::GetDeviceTransportType( void ApplicationManagerImpl::OnMessageReceived( const ::protocol_handler::RawMessagePtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!message) { - LOGGER_ERROR(logger_, "Null-pointer message received."); + SDL_ERROR("Null-pointer message received."); NOTREACHED(); return; } @@ -859,7 +854,7 @@ void ApplicationManagerImpl::OnMessageReceived( utils::SharedPtr<Message> outgoing_message = ConvertRawMsgToMessage(message); if (outgoing_message) { - LOGGER_DEBUG(logger_, "Posting new Message"); + SDL_DEBUG("Posting new Message"); messages_from_mobile_.PostMessage( impl::MessageFromMobile(outgoing_message)); } @@ -867,15 +862,15 @@ void ApplicationManagerImpl::OnMessageReceived( void ApplicationManagerImpl::OnMobileMessageSent( const ::protocol_handler::RawMessagePtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } void ApplicationManagerImpl::OnMessageReceived( hmi_message_handler::MessageSharedPointer message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!message) { - LOGGER_ERROR(logger_, "Null-pointer message received."); + SDL_ERROR("Null-pointer message received."); NOTREACHED(); return; } @@ -922,7 +917,7 @@ void ApplicationManagerImpl::OnErrorSending( void ApplicationManagerImpl::OnDeviceListUpdated( const connection_handler::DeviceMap& device_list) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // add device to policy DB connection_handler::DeviceMap::const_iterator it = device_list.begin(); @@ -945,7 +940,7 @@ void ApplicationManagerImpl::OnDeviceListUpdated( smart_objects::SmartObjectSPtr msg_params = MessageHelper::CreateDeviceListSO(device_list, GetPolicyHandler(), *this); if (!msg_params) { - LOGGER_WARN(logger_, "Failed to create sub-smart object."); + SDL_WARN("Failed to create sub-smart object."); return; } @@ -964,14 +959,14 @@ void ApplicationManagerImpl::OnDeviceListUpdated( void ApplicationManagerImpl::OnFindNewApplicationsRequest() { connection_handler().ConnectToAllDevices(); - LOGGER_DEBUG(logger_, "Starting application list update timer"); + SDL_DEBUG("Starting application list update timer"); uint32_t timeout = get_settings().application_list_update_timeout(); application_list_update_timer_.Start(timeout, timer::kSingleShot); GetPolicyHandler().OnAppsSearchStarted(); } void ApplicationManagerImpl::SendUpdateAppList() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace smart_objects; using namespace hmi_apis; @@ -993,13 +988,13 @@ void ApplicationManagerImpl::SendUpdateAppList() { void ApplicationManagerImpl::RemoveDevice( const connection_handler::DeviceHandle& device_handle) { - LOGGER_DEBUG(logger_, "device_handle " << device_handle); + SDL_DEBUG("device_handle " << device_handle); } mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel( ApplicationConstSharedPtr application) const { using namespace mobile_apis; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HMILevel::eType default_hmi = HMILevel::HMI_NONE; if (policy_handler_.PolicyEnabled()) { @@ -1015,13 +1010,10 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel( } else if ("NONE" == default_hmi_string) { default_hmi = HMILevel::HMI_NONE; } else { - LOGGER_ERROR( - logger_, - "Unable to convert " + default_hmi_string + " to HMILevel"); + SDL_ERROR("Unable to convert " + default_hmi_string + " to HMILevel"); } } else { - LOGGER_ERROR(logger_, - "Unable to get default hmi_level for " << policy_app_id); + SDL_ERROR("Unable to get default hmi_level for " << policy_app_id); } } return default_hmi; @@ -1032,14 +1024,14 @@ uint32_t ApplicationManagerImpl::GenerateGrammarID() { } uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t hmi_app_id = get_rand_from_range(1); - LOGGER_DEBUG(logger_, "GenerateNewHMIAppID value is: " << hmi_app_id); + SDL_DEBUG("GenerateNewHMIAppID value is: " << hmi_app_id); while (resume_ctrl_.IsHMIApplicationIdExist(hmi_app_id)) { - LOGGER_DEBUG(logger_, "HMI appID " << hmi_app_id << " is exists."); + SDL_DEBUG("HMI appID " << hmi_app_id << " is exists."); hmi_app_id = get_rand_from_range(1); - LOGGER_DEBUG(logger_, "Trying new value: " << hmi_app_id); + SDL_DEBUG("Trying new value: " << hmi_app_id); } return hmi_app_id; @@ -1052,10 +1044,9 @@ void ApplicationManagerImpl::ReplaceMobileByHMIAppId( ApplicationSharedPtr application_ptr = application(message[strings::app_id].asUInt()); if (application_ptr.valid()) { - LOGGER_DEBUG(logger_, - "ReplaceMobileByHMIAppId from " - << message[strings::app_id].asInt() << " to " - << application_ptr->hmi_app_id()); + SDL_DEBUG("ReplaceMobileByHMIAppId from " + << message[strings::app_id].asInt() << " to " + << application_ptr->hmi_app_id()); message[strings::app_id] = application_ptr->hmi_app_id(); } } else { @@ -1089,10 +1080,9 @@ void ApplicationManagerImpl::ReplaceHMIByMobileAppId( application_by_hmi_app(message[strings::app_id].asUInt()); if (application.valid()) { - LOGGER_DEBUG(logger_, - "ReplaceHMIByMobileAppId from " - << message[strings::app_id].asInt() << " to " - << application->app_id()); + SDL_DEBUG("ReplaceHMIByMobileAppId from " + << message[strings::app_id].asInt() << " to " + << application->app_id()); message[strings::app_id] = application->app_id(); } } else { @@ -1121,7 +1111,7 @@ void ApplicationManagerImpl::ReplaceHMIByMobileAppId( bool ApplicationManagerImpl::StartNaviService( uint32_t app_id, protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (HMILevelAllowsStreaming(app_id, service_type)) { NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); @@ -1131,7 +1121,7 @@ bool ApplicationManagerImpl::StartNaviService( std::pair<uint32_t, std::pair<bool, bool>>( app_id, std::make_pair(false, false))); if (!res.second) { - LOGGER_WARN(logger_, "Navi service refused"); + SDL_WARN("Navi service refused"); return false; } it = res.first; @@ -1145,7 +1135,7 @@ bool ApplicationManagerImpl::StartNaviService( application(app_id)->StartStreaming(service_type); return true; } else { - LOGGER_WARN(logger_, "Refused navi service by HMI level"); + SDL_WARN("Refused navi service by HMI level"); } return false; } @@ -1153,11 +1143,11 @@ bool ApplicationManagerImpl::StartNaviService( void ApplicationManagerImpl::StopNaviService( uint32_t app_id, protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); if (navi_service_status_.end() == it) { - LOGGER_WARN(logger_, "No Information about navi service " << service_type); + SDL_WARN("No Information about navi service " << service_type); } else { // Fill NaviServices map. Set false to first value of pair if // we've stopped video service or to second value if we've @@ -1168,7 +1158,7 @@ void ApplicationManagerImpl::StopNaviService( ApplicationSharedPtr app = application(app_id); if (!app) { - LOGGER_WARN(logger_, "An application is not registered."); + SDL_WARN("An application is not registered."); return; } app->StopStreaming(service_type); @@ -1180,20 +1170,17 @@ bool ApplicationManagerImpl::OnServiceStartedCallback( const protocol_handler::ServiceType& type) { using namespace helpers; using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "ServiceType = " << type << ". Session = " << std::hex - << session_key); + SDL_AUTO_TRACE(); + SDL_DEBUG("ServiceType = " << type << ". Session = " << std::hex + << session_key); if (type == kRpc) { - LOGGER_DEBUG(logger_, "RPC service is about to be started."); + SDL_DEBUG("RPC service is about to be started."); return true; } ApplicationSharedPtr app = application(session_key); if (!app) { - LOGGER_WARN(logger_, - "The application with id:" << session_key - << " doesn't exists."); + SDL_WARN("The application with id:" << session_key << " doesn't exists."); return false; } @@ -1202,10 +1189,10 @@ bool ApplicationManagerImpl::OnServiceStartedCallback( if (app->is_navi()) { return StartNaviService(session_key, type); } else { - LOGGER_WARN(logger_, "Refuse not navi application"); + SDL_WARN("Refuse not navi application"); } } else { - LOGGER_WARN(logger_, "Refuse unknown service"); + SDL_WARN("Refuse unknown service"); } return false; } @@ -1219,13 +1206,12 @@ void ApplicationManagerImpl::OnServiceEndedCallback( using namespace connection_handler; using namespace mobile_apis; - LOGGER_DEBUG(logger_, - "OnServiceEndedCallback for service " - << type << " with reason " << close_reason - << " in session 0x" << std::hex << session_key); + SDL_DEBUG("OnServiceEndedCallback for service " + << type << " with reason " << close_reason << " in session 0x" + << std::hex << session_key); if (type == kRpc) { - LOGGER_INFO(logger_, "Remove application."); + SDL_INFO("Remove application."); /* In case it was unexpected disconnect or some special case (malformed message, flood) application will be removed and we will unregister application correctly, but in case it was @@ -1282,7 +1268,7 @@ void ApplicationManagerImpl::OnServiceEndedCallback( bool ApplicationManagerImpl::OnHandshakeDone( uint32_t connection_key, security_manager::SSLContext::HandshakeResult result) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using security_manager::SSLContext; using namespace helpers; @@ -1302,13 +1288,13 @@ bool ApplicationManagerImpl::OnHandshakeDone( } void ApplicationManagerImpl::OnCertificateUpdateRequired() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); GetPolicyHandler().OnPTExchangeNeeded(); } security_manager::SSLContext::HandshakeContext ApplicationManagerImpl::GetHandshakeContext(uint32_t key) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationConstSharedPtr app = application(key); security_manager::SSLContext::HandshakeContext res; DCHECK_OR_RETURN(app.valid(), res); @@ -1348,16 +1334,16 @@ void ApplicationManagerImpl::StartDevicesDiscovery() { void ApplicationManagerImpl::SendMessageToMobile( const commands::MessageSharedPtr message, bool final_message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!message) { - LOGGER_ERROR(logger_, "Null-pointer message received."); + SDL_ERROR("Null-pointer message received."); NOTREACHED(); return; } if (!protocol_handler_) { - LOGGER_WARN(logger_, "No Protocol Handler set"); + SDL_WARN("No Protocol Handler set"); return; } @@ -1365,7 +1351,7 @@ void ApplicationManagerImpl::SendMessageToMobile( (*message)[strings::params][strings::connection_key].asUInt()); if (!app) { - LOGGER_ERROR(logger_, "No application associated with connection key"); + SDL_ERROR("No application associated with connection key"); if ((*message)[strings::msg_params].keyExists(strings::result_code) && ((*message)[strings::msg_params][strings::result_code] == NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION)) { @@ -1381,15 +1367,14 @@ void ApplicationManagerImpl::SendMessageToMobile( } mobile_so_factory().attachSchema(*message, false); - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "Attached schema to message, result if valid: " << message->isValid()); // Messages to mobile are not yet prioritized so use default priority value utils::SharedPtr<Message> message_to_send( new Message(protocol_handler::MessagePriority::kDefault)); if (!ConvertSOtoMessage((*message), (*message_to_send))) { - LOGGER_WARN(logger_, "Can't send msg to Mobile: failed to create string"); + SDL_WARN("Can't send msg to Mobile: failed to create string"); return; } @@ -1413,7 +1398,7 @@ void ApplicationManagerImpl::SendMessageToMobile( for (; iter != iter_end; ++iter) { if (true == iter->second.asBool()) { - LOGGER_INFO(logger_, "Request's param: " << iter->first); + SDL_INFO("Request's param: " << iter->first); params.push_back(iter->first); } } @@ -1423,9 +1408,8 @@ void ApplicationManagerImpl::SendMessageToMobile( if (mobile_apis::Result::SUCCESS != check_result) { const std::string string_functionID = MessageHelper::StringifiedFunctionID(function_id); - LOGGER_WARN(logger_, - "Function \"" << string_functionID << "\" (#" << function_id - << ") not allowed by policy"); + SDL_WARN("Function \"" << string_functionID << "\" (#" << function_id + << ") not allowed by policy"); return; } @@ -1441,9 +1425,7 @@ void ApplicationManagerImpl::SendMessageToMobile( } if (message_to_send->binary_data()) { - LOGGER_DEBUG( - logger_, - "Binary data size: " << message_to_send->binary_data()->size()); + SDL_DEBUG("Binary data size: " << message_to_send->binary_data()->size()); } messages_to_mobile_.PostMessage( impl::MessageToMobile(message_to_send, final_message)); @@ -1457,28 +1439,27 @@ void ApplicationManagerImpl::TerminateRequest(uint32_t connection_key, bool ApplicationManagerImpl::ManageMobileCommand( const commands::MessageSharedPtr message, commands::Command::CommandOrigin origin) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!message) { - LOGGER_WARN(logger_, "Null-pointer message received."); + SDL_WARN("Null-pointer message received."); return false; } if (IsLowVoltage()) { - LOGGER_WARN(logger_, "Low Voltage is active"); + SDL_WARN("Low Voltage is active"); return false; } #ifdef DEBUG MessageHelper::PrintSmartObject(*message); #endif - LOGGER_DEBUG(logger_, "Trying to create message in mobile factory."); + SDL_DEBUG("Trying to create message in mobile factory."); utils::SharedPtr<commands::Command> command( MobileCommandFactory::CreateCommand(message, origin, *this)); if (!command) { - LOGGER_WARN(logger_, - "RET Failed to create mobile command from smart object"); + SDL_WARN("RET Failed to create mobile command from smart object"); return false; } @@ -1507,7 +1488,7 @@ bool ApplicationManagerImpl::ManageMobileCommand( (mobile_apis::FunctionID::UnregisterAppInterfaceID != function_id)) { app = application(connection_key); if (!app) { - LOGGER_ERROR(logger_, "RET APPLICATION_NOT_REGISTERED"); + SDL_ERROR("RET APPLICATION_NOT_REGISTERED"); smart_objects::SmartObjectSPtr response = MessageHelper::CreateNegativeResponse( connection_key, @@ -1557,12 +1538,11 @@ bool ApplicationManagerImpl::ManageMobileCommand( request_ctrl_.addMobileRequest(command, app_hmi_level); if (result == request_controller::RequestController::SUCCESS) { - LOGGER_DEBUG(logger_, "Perform request"); + SDL_DEBUG("Perform request"); } else if (result == request_controller::RequestController:: TOO_MANY_PENDING_REQUESTS) { - LOGGER_ERROR(logger_, - "RET Unable top perform request: " - << "TOO_MANY_PENDING_REQUESTS"); + SDL_ERROR("RET Unable top perform request: " + << "TOO_MANY_PENDING_REQUESTS"); smart_objects::SmartObjectSPtr response = MessageHelper::CreateNegativeResponse( @@ -1580,9 +1560,8 @@ bool ApplicationManagerImpl::ManageMobileCommand( return false; } else if (result == request_controller::RequestController::TOO_MANY_REQUESTS) { - LOGGER_ERROR(logger_, - "RET Unable to perform request: " - << "TOO_MANY_REQUESTS"); + SDL_ERROR("RET Unable to perform request: " + << "TOO_MANY_REQUESTS"); ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( @@ -1601,9 +1580,8 @@ bool ApplicationManagerImpl::ManageMobileCommand( return false; } else if (result == request_controller::RequestController:: NONE_HMI_LEVEL_MANY_REQUESTS) { - LOGGER_ERROR(logger_, - "RET Unable to perform request: " - << "REQUEST_WHILE_IN_NONE_HMI_LEVEL"); + SDL_ERROR("RET Unable to perform request: " + << "REQUEST_WHILE_IN_NONE_HMI_LEVEL"); ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( @@ -1620,28 +1598,28 @@ bool ApplicationManagerImpl::ManageMobileCommand( connection_key, mobile_apis::Result::INVALID_ENUM, false); return false; } else { - LOGGER_ERROR(logger_, "RET Unable to perform request: Unknown case"); + SDL_ERROR("RET Unable to perform request: Unknown case"); return false; } return true; } - LOGGER_ERROR(logger_, "RET UNKNOWN MESSAGE TYPE " << message_type); + SDL_ERROR("RET UNKNOWN MESSAGE TYPE " << message_type); return false; } void ApplicationManagerImpl::SendMessageToHMI( const commands::MessageSharedPtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!message) { - LOGGER_WARN(logger_, "Null-pointer message received."); + SDL_WARN("Null-pointer message received."); NOTREACHED(); return; } if (!hmi_handler_) { - LOGGER_WARN(logger_, "No HMI Handler set"); + SDL_WARN("No HMI Handler set"); return; } @@ -1649,20 +1627,19 @@ void ApplicationManagerImpl::SendMessageToHMI( utils::SharedPtr<Message> message_to_send( new Message(protocol_handler::MessagePriority::kDefault)); if (!message_to_send) { - LOGGER_ERROR(logger_, "Null pointer"); + SDL_ERROR("Null pointer"); return; } hmi_so_factory().attachSchema(*message, false); - LOGGER_INFO( - logger_, + SDL_INFO( "Attached schema to message, result if valid: " << message->isValid()); #ifdef HMI_DBUS_API message_to_send->set_smart_object(*message); #else if (!ConvertSOtoMessage(*message, *message_to_send)) { - LOGGER_WARN(logger_, "Cannot send message to HMI: failed to create string"); + SDL_WARN("Cannot send message to HMI: failed to create string"); return; } #endif // HMI_DBUS_API @@ -1672,15 +1649,15 @@ void ApplicationManagerImpl::SendMessageToHMI( bool ApplicationManagerImpl::ManageHMICommand( const commands::MessageSharedPtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!message) { - LOGGER_WARN(logger_, "Null-pointer message received."); + SDL_WARN("Null-pointer message received."); return false; } if (IsLowVoltage()) { - LOGGER_WARN(logger_, "Low Voltage is active"); + SDL_WARN("Low Voltage is active"); return false; } @@ -1688,7 +1665,7 @@ bool ApplicationManagerImpl::ManageHMICommand( CommandSharedPtr command = HMICommandFactory::CreateCommand(message, *this); if (!command) { - LOGGER_WARN(logger_, "Failed to create command from smart object"); + SDL_WARN("Failed to create command from smart object"); return false; } @@ -1696,7 +1673,7 @@ bool ApplicationManagerImpl::ManageHMICommand( (*(message.get()))[strings::params][strings::message_type].asInt(); if (kRequest == message_type) { - LOGGER_DEBUG(logger_, "ManageHMICommand"); + SDL_DEBUG("ManageHMICommand"); request_ctrl_.addHMIRequest(command); } @@ -1714,22 +1691,21 @@ bool ApplicationManagerImpl::ManageHMICommand( bool ApplicationManagerImpl::Init(resumption::LastState& last_state, media_manager::MediaManager* media_manager) { - LOGGER_TRACE(logger_, "Init application manager"); + SDL_TRACE("Init application manager"); const std::string app_storage_folder = get_settings().app_storage_folder(); if (!InitDirectory(app_storage_folder, TYPE_STORAGE) || !IsReadWriteAllowed(app_storage_folder, TYPE_STORAGE)) { return false; } if (!resume_ctrl_.Init(last_state)) { - LOGGER_ERROR(logger_, "Problem with initialization of resume controller"); + SDL_ERROR("Problem with initialization of resume controller"); return false; } hmi_capabilities_->Init(&last_state); if (!(file_system::IsWritingAllowed(app_storage_folder) && file_system::IsReadingAllowed(app_storage_folder))) { - LOGGER_ERROR(logger_, - "Storage directory doesn't have read/write permissions"); + SDL_ERROR("Storage directory doesn't have read/write permissions"); return false; } @@ -1747,25 +1723,23 @@ bool ApplicationManagerImpl::Init(resumption::LastState& last_state, IsReadWriteAllowed(app_icons_folder, TYPE_ICONS); if (GetPolicyHandler().PolicyEnabled()) { if (!GetPolicyHandler().LoadPolicyLibrary()) { - LOGGER_ERROR(logger_, - "Policy library is not loaded. Check LD_LIBRARY_PATH"); + SDL_ERROR("Policy library is not loaded. Check LD_LIBRARY_PATH"); return false; } - LOGGER_INFO(logger_, "Policy library is loaded, now initing PT"); + SDL_INFO("Policy library is loaded, now initing PT"); if (!GetPolicyHandler().InitPolicyTable()) { - LOGGER_ERROR(logger_, "Policy table is not initialized."); + SDL_ERROR("Policy table is not initialized."); return false; } } else { - LOGGER_WARN(logger_, - "System is configured to work without policy functionality."); + SDL_WARN("System is configured to work without policy functionality."); } media_manager_ = media_manager; return true; } bool ApplicationManagerImpl::Stop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); stopping_application_mng_lock_.Acquire(); is_stopping_ = true; stopping_application_mng_lock_.Release(); @@ -1773,13 +1747,12 @@ bool ApplicationManagerImpl::Stop() { try { UnregisterAllApplications(); } catch (...) { - LOGGER_ERROR(logger_, - "An error occurred during unregistering applications."); + SDL_ERROR("An error occurred during unregistering applications."); } request_ctrl_.DestroyThreadpool(); // for PASA customer policy backup should happen :AllApp(SUSPEND) - LOGGER_DEBUG(logger_, "Unloading policy library."); + SDL_DEBUG("Unloading policy library."); GetPolicyHandler().UnloadPolicyLibrary(); return true; @@ -1787,11 +1760,10 @@ bool ApplicationManagerImpl::Stop() { bool ApplicationManagerImpl::ConvertMessageToSO( const Message& message, smart_objects::SmartObject& output) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "\t\t\tMessage to convert: protocol " - << message.protocol_version() << "; json " - << message.json_message()); + SDL_AUTO_TRACE(); + SDL_DEBUG("\t\t\tMessage to convert: protocol " << message.protocol_version() + << "; json " + << message.json_message()); switch (message.protocol_version()) { case ProtocolVersion::kV4: @@ -1807,9 +1779,8 @@ bool ApplicationManagerImpl::ConvertMessageToSO( if (!conversion_result || !mobile_so_factory().attachSchema(output, true) || ((output.validate() != smart_objects::Errors::OK))) { - LOGGER_WARN(logger_, - "Failed to parse string to smart object :" - << message.json_message()); + SDL_WARN("Failed to parse string to smart object :" + << message.json_message()); utils::SharedPtr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( message.connection_key(), @@ -1819,20 +1790,17 @@ bool ApplicationManagerImpl::ConvertMessageToSO( ManageMobileCommand(response, commands::Command::ORIGIN_SDL); return false; } - LOGGER_DEBUG(logger_, - "Convertion result for sdl object is true function_id " - << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); + SDL_DEBUG("Convertion result for sdl object is true function_id " + << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); output[strings::params][strings::connection_key] = message.connection_key(); output[strings::params][strings::protocol_version] = message.protocol_version(); if (message.binary_data()) { if (message.payload_size() < message.data_size()) { - LOGGER_ERROR(logger_, - "Incomplete binary" - << " binary size should be " << message.data_size() - << " payload data size is " - << message.payload_size()); + SDL_ERROR("Incomplete binary" + << " binary size should be " << message.data_size() + << " payload data size is " << message.payload_size()); utils::SharedPtr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( message.connection_key(), @@ -1854,26 +1822,25 @@ bool ApplicationManagerImpl::ConvertMessageToSO( formatters::FormatterJsonRpc::FromString< hmi_apis::FunctionID::eType, hmi_apis::messageType::eType>(message.json_message(), output); - LOGGER_DEBUG(logger_, - "Convertion result: " - << result << " function id " - << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); + SDL_DEBUG("Convertion result: " + << result << " function id " + << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); if (!hmi_so_factory().attachSchema(output, false)) { - LOGGER_WARN(logger_, "Failed to attach schema to object."); + SDL_WARN("Failed to attach schema to object."); return false; } if (output.validate() != smart_objects::Errors::OK) { - LOGGER_ERROR(logger_, "Incorrect parameter from HMI"); + SDL_ERROR("Incorrect parameter from HMI"); if (application_manager::MessageType::kNotification == output[strings::params][strings::message_type].asInt()) { - LOGGER_ERROR(logger_, "Ignore wrong HMI notification"); + SDL_ERROR("Ignore wrong HMI notification"); return false; } if (application_manager::MessageType::kRequest == output[strings::params][strings::message_type].asInt()) { - LOGGER_ERROR(logger_, "Ignore wrong HMI request"); + SDL_ERROR("Ignore wrong HMI request"); return false; } @@ -1889,7 +1856,7 @@ bool ApplicationManagerImpl::ConvertMessageToSO( static NsSmartDeviceLinkRPC::V1::v4_protocol_v1_2_no_extra v1_shema; if (message.function_id() == 0 || message.type() == kUnknownType) { - LOGGER_ERROR(logger_, "Message received: UNSUPPORTED_VERSION"); + SDL_ERROR("Message received: UNSUPPORTED_VERSION"); int32_t conversation_result = formatters::CFormatterJsonSDLRPCv1::fromString< @@ -1926,31 +1893,28 @@ bool ApplicationManagerImpl::ConvertMessageToSO( default: // TODO(PV): // removed NOTREACHED() because some app can still have vesion 1. - LOGGER_WARN(logger_, - "Application used unsupported protocol :" - << message.protocol_version() << "."); + SDL_WARN("Application used unsupported protocol :" + << message.protocol_version() << "."); return false; } - LOGGER_DEBUG(logger_, "Successfully parsed message into smart object"); + SDL_DEBUG("Successfully parsed message into smart object"); return true; } bool ApplicationManagerImpl::ConvertSOtoMessage( const smart_objects::SmartObject& message, Message& output) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (smart_objects::SmartType_Null == message.getType() || smart_objects::SmartType_Invalid == message.getType()) { - LOGGER_WARN(logger_, "Invalid smart object received."); + SDL_WARN("Invalid smart object received."); return false; } - LOGGER_DEBUG( - logger_, - "Message with protocol: " << message.getElement(jhs::S_PARAMS) - .getElement(jhs::S_PROTOCOL_TYPE) - .asInt()); + SDL_DEBUG("Message with protocol: " << message.getElement(jhs::S_PARAMS) + .getElement(jhs::S_PROTOCOL_TYPE) + .asInt()); std::string output_string; const int64_t protocol_type = message.getElement(jhs::S_PARAMS) @@ -1964,14 +1928,14 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( if (protocol_version == 1) { if (!formatters::CFormatterJsonSDLRPCv1::toString(message, output_string)) { - LOGGER_WARN(logger_, "Failed to serialize smart object"); + SDL_WARN("Failed to serialize smart object"); return false; } output.set_protocol_version(application_manager::kV1); } else { if (!formatters::CFormatterJsonSDLRPCv2::toString(message, output_string)) { - LOGGER_WARN(logger_, "Failed to serialize smart object"); + SDL_WARN("Failed to serialize smart object"); return false; } output.set_protocol_version( @@ -1981,7 +1945,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( } case 1: { if (!formatters::FormatterJsonRpc::ToString(message, output_string)) { - LOGGER_WARN(logger_, "Failed to serialize smart object"); + SDL_WARN("Failed to serialize smart object"); return false; } output.set_protocol_version(application_manager::kHMI); @@ -1992,7 +1956,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( return false; } - LOGGER_DEBUG(logger_, "Convertion result: " << output_string); + SDL_DEBUG("Convertion result: " << output_string); output.set_connection_key(message.getElement(jhs::S_PARAMS) .getElement(strings::connection_key) @@ -2026,28 +1990,28 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( .asBinary()); if (NULL == binaryData) { - LOGGER_ERROR(logger_, "Null pointer"); + SDL_ERROR("Null pointer"); return false; } output.set_binary_data(binaryData); } - LOGGER_DEBUG(logger_, "Successfully parsed smart object into message"); + SDL_DEBUG("Successfully parsed smart object into message"); return true; } utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage( const ::protocol_handler::RawMessagePtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(message); utils::SharedPtr<Message> outgoing_message; - LOGGER_DEBUG(logger_, "Service type." << message->service_type()); + SDL_DEBUG("Service type." << message->service_type()); if (message->service_type() != protocol_handler::kRpc && message->service_type() != protocol_handler::kBulk) { // skip this message, not under handling of ApplicationManager - LOGGER_TRACE(logger_, "Skipping message; not the under AM handling."); + SDL_TRACE("Skipping message; not the under AM handling."); return outgoing_message; } @@ -2057,14 +2021,14 @@ utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage( if (convertion_result) { outgoing_message = convertion_result; } else { - LOGGER_ERROR(logger_, "Received invalid message"); + SDL_ERROR("Received invalid message"); } return outgoing_message; } void ApplicationManagerImpl::ProcessMessageFromMobile( const utils::SharedPtr<Message> message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); #ifdef TELEMETRY_MONITOR AMTelemetryObserver::MessageMetricSharedPtr metric( new AMTelemetryObserver::MessageMetric()); @@ -2075,12 +2039,12 @@ void ApplicationManagerImpl::ProcessMessageFromMobile( DCHECK_OR_RETURN_VOID(so_from_mobile); if (!so_from_mobile) { - LOGGER_ERROR(logger_, "Null pointer"); + SDL_ERROR("Null pointer"); return; } if (!ConvertMessageToSO(*message, *so_from_mobile)) { - LOGGER_ERROR(logger_, "Cannot create smart object from message"); + SDL_ERROR("Cannot create smart object from message"); return; } #ifdef TELEMETRY_MONITOR @@ -2088,7 +2052,7 @@ void ApplicationManagerImpl::ProcessMessageFromMobile( #endif // TELEMETRY_MONITOR if (!ManageMobileCommand(so_from_mobile, commands::Command::ORIGIN_MOBILE)) { - LOGGER_ERROR(logger_, "Received command didn't run successfully"); + SDL_ERROR("Received command didn't run successfully"); } #ifdef TELEMETRY_MONITOR metric->end = date_time::DateTime::getCurrentTime(); @@ -2100,11 +2064,11 @@ void ApplicationManagerImpl::ProcessMessageFromMobile( void ApplicationManagerImpl::ProcessMessageFromHMI( const utils::SharedPtr<Message> message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr smart_object(new smart_objects::SmartObject); if (!smart_object) { - LOGGER_ERROR(logger_, "Null pointer"); + SDL_ERROR("Null pointer"); return; } @@ -2112,14 +2076,14 @@ void ApplicationManagerImpl::ProcessMessageFromHMI( *smart_object = message->smart_object(); #else if (!ConvertMessageToSO(*message, *smart_object)) { - LOGGER_ERROR(logger_, "Cannot create smart object from message"); + SDL_ERROR("Cannot create smart object from message"); return; } #endif // HMI_DBUS_API - LOGGER_DEBUG(logger_, "Converted message, trying to create hmi command"); + SDL_DEBUG("Converted message, trying to create hmi command"); if (!ManageHMICommand(smart_object)) { - LOGGER_ERROR(logger_, "Received command didn't run successfully"); + SDL_ERROR("Received command didn't run successfully"); } } @@ -2127,7 +2091,7 @@ hmi_apis::HMI_API& ApplicationManagerImpl::hmi_so_factory() { if (!hmi_so_factory_) { hmi_so_factory_ = new hmi_apis::HMI_API; if (!hmi_so_factory_) { - LOGGER_ERROR(logger_, "Out of memory"); + SDL_ERROR("Out of memory"); NOTREACHED(); } } @@ -2138,7 +2102,7 @@ mobile_apis::MOBILE_API& ApplicationManagerImpl::mobile_so_factory() { if (!mobile_so_factory_) { mobile_so_factory_ = new mobile_apis::MOBILE_API; if (!mobile_so_factory_) { - LOGGER_ERROR(logger_, "Out of memory."); + SDL_ERROR("Out of memory."); NOTREACHED(); } } @@ -2156,9 +2120,9 @@ const HMICapabilities& ApplicationManagerImpl::hmi_capabilities() const { void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data, SmartObject& ttsName, SmartObject& vrSynonym) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!app_data.keyExists(json::languages)) { - LOGGER_WARN(logger_, "\"languages\" not exists"); + SDL_WARN("\"languages\" not exists"); return; } @@ -2176,43 +2140,41 @@ void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data, const size_t size = languages.length(); for (size_t idx = 0; idx < size; ++idx) { if (languages[idx].keyExists(cur_vr_lang)) { - LOGGER_DEBUG(logger_, "Found active HMI language " << cur_vr_lang); + SDL_DEBUG("Found active HMI language " << cur_vr_lang); specific_idx = idx; } else if (languages[idx].keyExists(json::default_)) { - LOGGER_DEBUG(logger_, "Found default language"); + SDL_DEBUG("Found default language"); default_idx = idx; } } if ((-1 == specific_idx) && (-1 == default_idx)) { - LOGGER_DEBUG(logger_, "No suitable language found"); + SDL_DEBUG("No suitable language found"); return; } if (app_data[json::languages][specific_idx][cur_vr_lang].keyExists( json::ttsName)) { - LOGGER_DEBUG(logger_, "Get ttsName from " << cur_vr_lang << " language"); + SDL_DEBUG("Get ttsName from " << cur_vr_lang << " language"); ttsName = app_data[json::languages][specific_idx][cur_vr_lang][json::ttsName]; } else { - LOGGER_DEBUG(logger_, - "No data for ttsName for " << cur_vr_lang << " language"); + SDL_DEBUG("No data for ttsName for " << cur_vr_lang << " language"); } if (app_data[json::languages][specific_idx][cur_vr_lang].keyExists( json::vrSynonyms)) { - LOGGER_DEBUG(logger_, "Get vrSynonyms from " << cur_vr_lang << " language"); + SDL_DEBUG("Get vrSynonyms from " << cur_vr_lang << " language"); vrSynonym = app_data[json::languages][specific_idx][cur_vr_lang][json::vrSynonyms]; } else { - LOGGER_DEBUG(logger_, - "No data for vrSynonyms for " << cur_vr_lang << " language"); + SDL_DEBUG("No data for vrSynonyms for " << cur_vr_lang << " language"); } } void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, const uint32_t connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace policy; const std::size_t arr_size(obj_array.size()); @@ -2220,7 +2182,7 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, const SmartObject& app_data = obj_array[idx]; if (!(app_data.keyExists(json::name) && app_data.keyExists(json::appId))) { - LOGGER_DEBUG(logger_, "The entry in query apps json is not valid"); + SDL_DEBUG("The entry in query apps json is not valid"); continue; } @@ -2228,9 +2190,8 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, ApplicationSharedPtr registered_app = application_by_policy_id(policy_app_id); if (registered_app) { - LOGGER_DEBUG(logger_, - "Application with the same id: " - << policy_app_id << " is registered already."); + SDL_DEBUG("Application with the same id: " << policy_app_id + << " is registered already."); continue; } @@ -2271,8 +2232,7 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, if (-1 == connection_handler().GetDataOnSessionKey( connection_key, NULL, NULL, &device_id)) { - LOGGER_ERROR(logger_, - "Failed to create application: no connection info."); + SDL_ERROR("Failed to create application: no connection info."); continue; } @@ -2305,22 +2265,20 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, app->set_tts_name(ttsName); sync_primitives::AutoLock lock(apps_to_register_list_lock_); - LOGGER_DEBUG(logger_, - "apps_to_register_ size before: " << apps_to_register_.size()); + SDL_DEBUG("apps_to_register_ size before: " << apps_to_register_.size()); apps_to_register_.insert(app); - LOGGER_DEBUG(logger_, - "apps_to_register_ size after: " << apps_to_register_.size()); + SDL_DEBUG("apps_to_register_ size after: " << apps_to_register_.size()); } } void ApplicationManagerImpl::ProcessQueryApp( const smart_objects::SmartObject& sm_object, const uint32_t connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace policy; if (!sm_object.keyExists(json::response)) { - LOGGER_DEBUG(logger_, "The response key is not exists."); + SDL_DEBUG("The response key is not exists."); return; } @@ -2365,7 +2323,7 @@ void ApplicationManagerImpl::updateRequestTimeout( uint32_t connection_key, uint32_t mobile_correlation_id, uint32_t new_timeout_value) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); request_ctrl_.updateRequestTimeout( connection_key, mobile_correlation_id, new_timeout_value); } @@ -2401,7 +2359,7 @@ void ApplicationManagerImpl::RemovePolicyObserver( void ApplicationManagerImpl::SetUnregisterAllApplicationsReason( mobile_api::AppInterfaceUnregisteredReason::eType reason) { - LOGGER_TRACE(logger_, "reason = " << reason); + SDL_TRACE("reason = " << reason); unregister_reason_ = reason; } @@ -2428,14 +2386,14 @@ void ApplicationManagerImpl::HeadUnitReset( break; } default: { - LOGGER_ERROR(logger_, "Bad AppInterfaceUnregisteredReason"); + SDL_ERROR("Bad AppInterfaceUnregisteredReason"); return; } } } void ApplicationManagerImpl::SendOnSDLClose() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // must be sent to PASA HMI on shutdown synchronously smart_objects::SmartObjectSPtr msg = @@ -2450,7 +2408,7 @@ void ApplicationManagerImpl::SendOnSDLClose() { commands::CommandImpl::protocol_version_; if (!msg) { - LOGGER_WARN(logger_, "Null-pointer message received."); + SDL_WARN("Null-pointer message received."); NOTREACHED(); return; } @@ -2460,21 +2418,19 @@ void ApplicationManagerImpl::SendOnSDLClose() { new Message(protocol_handler::MessagePriority::kDefault)); hmi_so_factory().attachSchema(*msg, false); - LOGGER_DEBUG( - logger_, - "Attached schema to message, result if valid: " << msg->isValid()); + SDL_DEBUG("Attached schema to message, result if valid: " << msg->isValid()); #ifdef HMI_DBUS_API message_to_send->set_smart_object(*msg); #else if (!ConvertSOtoMessage(*msg, *message_to_send)) { - LOGGER_WARN(logger_, "Cannot send message to HMI: failed to create string"); + SDL_WARN("Cannot send message to HMI: failed to create string"); return; } #endif // HMI_DBUS_API if (!hmi_handler_) { - LOGGER_WARN(logger_, "No HMI Handler set"); + SDL_WARN("No HMI Handler set"); return; } @@ -2482,7 +2438,7 @@ void ApplicationManagerImpl::SendOnSDLClose() { } void ApplicationManagerImpl::UnregisterAllApplications() { - LOGGER_DEBUG(logger_, "Unregister reason " << unregister_reason_); + SDL_DEBUG("Unregister reason " << unregister_reason_); hmi_cooperating_ = false; bool is_ignition_off = false; @@ -2529,9 +2485,7 @@ void ApplicationManagerImpl::RemoveAppsWaitingForRegistration( apps_to_register_.begin(), apps_to_register_.end(), device_finder); while (apps_to_register_.end() != it_app) { - LOGGER_DEBUG(logger_, - "Waiting app: " << (*it_app)->name().c_str() - << " is removed."); + SDL_DEBUG("Waiting app: " << (*it_app)->name().c_str() << " is removed."); apps_to_register_.erase(it_app); it_app = std::find_if( apps_to_register_.begin(), apps_to_register_.end(), device_finder); @@ -2545,11 +2499,10 @@ void ApplicationManagerImpl::UnregisterApplication( mobile_apis::Result::eType reason, bool is_resuming, bool is_unexpected_disconnect) { - LOGGER_DEBUG(logger_, - "app_id = " << app_id << "; reason = " << reason - << "; is_resuming = " << is_resuming - << "; is_unexpected_disconnect = " - << is_unexpected_disconnect); + SDL_DEBUG("app_id = " << app_id << "; reason = " << reason + << "; is_resuming = " << is_resuming + << "; is_unexpected_disconnect = " + << is_unexpected_disconnect); size_t subscribed_for_way_points_app_count = 0; // SDL sends UnsubscribeWayPoints only for last application @@ -2559,7 +2512,7 @@ void ApplicationManagerImpl::UnregisterApplication( subscribed_way_points_apps_list_.size(); } if (1 == subscribed_for_way_points_app_count) { - LOGGER_ERROR(logger_, "Send UnsubscribeWayPoints"); + SDL_ERROR("Send UnsubscribeWayPoints"); MessageHelper::SendUnsubscribedWayPoints(*this); } @@ -2587,8 +2540,7 @@ void ApplicationManagerImpl::UnregisterApplication( if (app_ptr) { app_ptr->usage_report().RecordRemovalsForBadBehavior(); if (reason == mobile_apis::Result::TOO_MANY_PENDING_REQUESTS) { - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "INSERT: " << GetHashedAppID(app_id, app_ptr->policy_app_id())); forbidden_applications.insert( GetHashedAppID(app_id, app_ptr->policy_app_id())); @@ -2597,7 +2549,7 @@ void ApplicationManagerImpl::UnregisterApplication( break; } default: { - LOGGER_ERROR(logger_, "Unknown unregister reason " << reason); + SDL_ERROR("Unknown unregister reason " << reason); break; } } @@ -2614,11 +2566,11 @@ void ApplicationManagerImpl::UnregisterApplication( } } if (!app_to_remove) { - LOGGER_ERROR(logger_, "Cant find application with app_id = " << app_id); + SDL_ERROR("Cant find application with app_id = " << app_id); // Just to terminate RAI in case of connection is dropped (rare case) // App won't be unregistered since RAI has not been started yet - LOGGER_DEBUG(logger_, "Trying to terminate possible RAI request."); + SDL_DEBUG("Trying to terminate possible RAI request."); request_ctrl_.terminateAppRequests(app_id); return; @@ -2632,8 +2584,7 @@ void ApplicationManagerImpl::UnregisterApplication( AppV4DevicePredicate finder(handle); ApplicationSharedPtr app = FindApp(accessor, finder); if (!app) { - LOGGER_DEBUG(logger_, - "There is no more SDL4 apps with device handle: " << handle); + SDL_DEBUG("There is no more SDL4 apps with device handle: " << handle); RemoveAppsWaitingForRegistration(handle); SendUpdateAppList(); @@ -2658,15 +2609,15 @@ void ApplicationManagerImpl::OnAppUnauthorized(const uint32_t& app_id) { } void ApplicationManagerImpl::Handle(const impl::MessageFromMobile message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!message) { - LOGGER_ERROR(logger_, "Null-pointer message received."); + SDL_ERROR("Null-pointer message received."); return; } sync_primitives::AutoLock lock(stopping_application_mng_lock_); if (is_stopping_) { - LOGGER_INFO(logger_, "Application manager is stopping"); + SDL_INFO("Application manager is stopping"); return; } ProcessMessageFromMobile(message); @@ -2674,8 +2625,7 @@ void ApplicationManagerImpl::Handle(const impl::MessageFromMobile message) { void ApplicationManagerImpl::Handle(const impl::MessageToMobile message) { if (!protocol_handler_) { - LOGGER_WARN(logger_, - "Protocol Handler is not set; cannot send message to mobile."); + SDL_WARN("Protocol Handler is not set; cannot send message to mobile."); return; } @@ -2683,7 +2633,7 @@ void ApplicationManagerImpl::Handle(const impl::MessageToMobile message) { MobileMessageHandler::HandleOutgoingMessageProtocol(message); if (!rawMessage) { - LOGGER_ERROR(logger_, "Failed to create raw message."); + SDL_ERROR("Failed to create raw message."); return; } @@ -2698,7 +2648,7 @@ void ApplicationManagerImpl::Handle(const impl::MessageToMobile message) { } protocol_handler_->SendMessageToMobileApp(rawMessage, is_final); - LOGGER_INFO(logger_, "Message for mobile given away"); + SDL_INFO("Message for mobile given away"); if (close_session) { connection_handler().CloseSession(message->connection_key(), @@ -2707,10 +2657,10 @@ void ApplicationManagerImpl::Handle(const impl::MessageToMobile message) { } void ApplicationManagerImpl::Handle(const impl::MessageFromHmi message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!message) { - LOGGER_ERROR(logger_, "Null-pointer message received."); + SDL_ERROR("Null-pointer message received."); return; } @@ -2718,27 +2668,27 @@ void ApplicationManagerImpl::Handle(const impl::MessageFromHmi message) { } void ApplicationManagerImpl::Handle(const impl::MessageToHmi message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!hmi_handler_) { - LOGGER_ERROR(logger_, "Observer is not set for HMIMessageHandler"); + SDL_ERROR("Observer is not set for HMIMessageHandler"); return; } hmi_handler_->SendMessageToHMI(message); - LOGGER_INFO(logger_, "Message for HMI given away"); + SDL_INFO("Message for HMI given away"); } void ApplicationManagerImpl::Handle(const impl::AudioData message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr on_audio_pass = new smart_objects::SmartObject(); if (!on_audio_pass) { - LOGGER_ERROR(logger_, "OnAudioPassThru NULL pointer"); + SDL_ERROR("OnAudioPassThru NULL pointer"); return; } - LOGGER_DEBUG(logger_, "Fill smart object"); + SDL_DEBUG("Fill smart object"); (*on_audio_pass)[strings::params][strings::message_type] = application_manager::MessageType::kNotification; @@ -2748,17 +2698,17 @@ void ApplicationManagerImpl::Handle(const impl::AudioData message) { (*on_audio_pass)[strings::params][strings::function_id] = mobile_apis::FunctionID::OnAudioPassThruID; - LOGGER_DEBUG(logger_, "Fill binary data"); + SDL_DEBUG("Fill binary data"); // binary data (*on_audio_pass)[strings::params][strings::binary_data] = smart_objects::SmartObject(message.binary_data); - LOGGER_DEBUG(logger_, "After fill binary data"); - LOGGER_DEBUG(logger_, "Send data"); + SDL_DEBUG("After fill binary data"); + SDL_DEBUG("Send data"); CommandSharedPtr command(MobileCommandFactory::CreateCommand( on_audio_pass, commands::Command::ORIGIN_SDL, *this)); if (!command) { - LOGGER_WARN(logger_, "Failed to create mobile command from smart object"); + SDL_WARN("Failed to create mobile command from smart object"); return; } @@ -2773,7 +2723,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( mobile_apis::FunctionID::eType function_id, const RPCParams& rpc_params, CommandParametersPermissions* params_permissions) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO(AOleynik): Remove check of policy_enable, when this flag will be // unused in config file if (!GetPolicyHandler().PolicyEnabled()) { @@ -2784,10 +2734,9 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( MessageHelper::StringifiedFunctionID(function_id); const std::string stringified_hmi_level = MessageHelper::StringifiedHMILevel(hmi_level); - LOGGER_DEBUG(logger_, - "Checking permissions for " << policy_app_id << " in " - << stringified_hmi_level << " rpc " - << stringified_functionID); + SDL_DEBUG("Checking permissions for " << policy_app_id << " in " + << stringified_hmi_level << " rpc " + << stringified_functionID); policy::CheckPermissionResult result; GetPolicyHandler().CheckPermissions(policy_app_id, stringified_hmi_level, @@ -2805,7 +2754,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( function_id != mobile_apis::FunctionID::UnregisterAppInterfaceID) { ApplicationSharedPtr app = application_by_policy_id(policy_app_id); if (!app) { - LOGGER_ERROR(logger_, "No application for policy id " << policy_app_id); + SDL_ERROR("No application for policy id " << policy_app_id); return mobile_apis::Result::GENERIC_ERROR; } if (result.hmi_level_permitted != policy::kRpcAllowed) { @@ -2818,11 +2767,11 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( stringified_hmi_level; if (result.hmi_level_permitted != policy::kRpcAllowed) { - LOGGER_WARN(logger_, "Request is blocked by policies. " << log_msg); + SDL_WARN("Request is blocked by policies. " << log_msg); ApplicationSharedPtr app = application_by_policy_id(policy_app_id); if (!app) { - LOGGER_ERROR(logger_, "No application for policy id " << policy_app_id); + SDL_ERROR("No application for policy id " << policy_app_id); return mobile_apis::Result::GENERIC_ERROR; } app->usage_report().RecordPolicyRejectedRpcCall(); @@ -2836,18 +2785,18 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( return mobile_apis::Result::INVALID_ENUM; } } - LOGGER_DEBUG(logger_, "Request is allowed by policies. " << log_msg); + SDL_DEBUG("Request is allowed by policies. " << log_msg); return mobile_api::Result::SUCCESS; } void ApplicationManagerImpl::OnLowVoltage() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); is_low_voltage_ = true; request_ctrl_.OnLowVoltage(); } bool ApplicationManagerImpl::IsLowVoltage() { - LOGGER_TRACE(logger_, "result: " << is_low_voltage_); + SDL_TRACE("result: " << is_low_voltage_); return is_low_voltage_; } @@ -2864,13 +2813,13 @@ std::string ApplicationManagerImpl::GetHashedAppID( bool ApplicationManagerImpl::HMILevelAllowsStreaming( uint32_t app_id, protocol_handler::ServiceType service_type) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis::HMILevel; using namespace helpers; ApplicationSharedPtr app = application(app_id); if (!app) { - LOGGER_WARN(logger_, "An application is not registered."); + SDL_WARN("An application is not registered."); return false; } return Compare<eType, EQ, ONE>(app->hmi_level(), HMI_FULL, HMI_LIMITED); @@ -2879,11 +2828,11 @@ bool ApplicationManagerImpl::HMILevelAllowsStreaming( bool ApplicationManagerImpl::CanAppStream( uint32_t app_id, protocol_handler::ServiceType service_type) const { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app) { - LOGGER_WARN(logger_, "An application is not registered."); + SDL_WARN("An application is not registered."); return false; } @@ -2893,7 +2842,7 @@ bool ApplicationManagerImpl::CanAppStream( } else if (ServiceType::kAudio == service_type) { is_allowed = app->audio_streaming_allowed(); } else { - LOGGER_WARN(logger_, "Unsupported service_type " << service_type); + SDL_WARN("Unsupported service_type " << service_type); } return HMILevelAllowsStreaming(app_id, service_type) && is_allowed; @@ -2903,11 +2852,11 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) { using namespace mobile_apis::AppInterfaceUnregisteredReason; using namespace mobile_apis::Result; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || !app->is_navi()) { - LOGGER_DEBUG(logger_, "There is no navi application with id: " << app_id); + SDL_DEBUG("There is no navi application with id: " << app_id); return; } @@ -2937,11 +2886,11 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) { void ApplicationManagerImpl::OnAppStreaming( uint32_t app_id, protocol_handler::ServiceType service_type, bool state) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || !app->is_navi()) { - LOGGER_DEBUG(logger_, " There is no navi application with id: " << app_id); + SDL_DEBUG(" There is no navi application with id: " << app_id); return; } DCHECK_OR_RETURN_VOID(media_manager_); @@ -2957,28 +2906,28 @@ void ApplicationManagerImpl::OnAppStreaming( void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || !app->is_navi()) { - LOGGER_DEBUG(logger_, "There is no navi application with id: " << app_id); + SDL_DEBUG("There is no navi application with id: " << app_id); return; } NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); if (navi_service_status_.end() == it) { - LOGGER_ERROR(logger_, "No info about navi servicies for app"); + SDL_ERROR("No info about navi servicies for app"); return; } if (connection_handler_) { if (it->second.first) { - LOGGER_DEBUG(logger_, "Going to end video service"); + SDL_DEBUG("Going to end video service"); connection_handler().SendEndService(app_id, ServiceType::kMobileNav); app->StopStreamingForce(ServiceType::kMobileNav); } if (it->second.second) { - LOGGER_DEBUG(logger_, "Going to end audio service"); + SDL_DEBUG("Going to end audio service"); connection_handler().SendEndService(app_id, ServiceType::kAudio); app->StopStreamingForce(ServiceType::kAudio); } @@ -3001,31 +2950,31 @@ void ApplicationManagerImpl::OnHMILevelChanged( uint32_t app_id, mobile_apis::HMILevel::eType from, mobile_apis::HMILevel::eType to) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis::HMILevel; using namespace helpers; if (from == to) { - LOGGER_TRACE(logger_, "HMILevel from = to"); + SDL_TRACE("HMILevel from = to"); return; } ApplicationSharedPtr app = application(app_id); if (!app || !app->is_navi()) { - LOGGER_ERROR(logger_, "Navi application not found"); + SDL_ERROR("Navi application not found"); return; } if (to == HMI_FULL || to == HMI_LIMITED) { - LOGGER_TRACE(logger_, "HMILevel to FULL or LIMITED"); + SDL_TRACE("HMILevel to FULL or LIMITED"); if (from == HMI_BACKGROUND) { - LOGGER_TRACE(logger_, "HMILevel from BACKGROUND"); + SDL_TRACE("HMILevel from BACKGROUND"); AllowStreaming(app_id); } } else if (to == HMI_BACKGROUND) { - LOGGER_TRACE(logger_, "HMILevel to BACKGROUND"); + SDL_TRACE("HMILevel to BACKGROUND"); if (from == HMI_FULL || from == HMI_LIMITED) { - LOGGER_TRACE(logger_, "HMILevel from FULL or LIMITED"); + SDL_TRACE("HMILevel from FULL or LIMITED"); navi_app_to_end_stream_.push_back(app_id); TimerSPtr end_stream_timer(utils::MakeShared<timer::Timer>( @@ -3038,7 +2987,7 @@ void ApplicationManagerImpl::OnHMILevelChanged( timer_pool_.push_back(end_stream_timer); } } else if (to == HMI_NONE) { - LOGGER_TRACE(logger_, "HMILevel to NONE"); + SDL_TRACE("HMILevel to NONE"); if (from == HMI_FULL || from == HMI_LIMITED || from == HMI_BACKGROUND) { EndNaviServices(app_id); } @@ -3047,7 +2996,7 @@ void ApplicationManagerImpl::OnHMILevelChanged( void ApplicationManagerImpl::SendHMIStatusNotification( const utils::SharedPtr<Application> app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); smart_objects::SmartObjectSPtr notification = utils::MakeShared<smart_objects::SmartObject>(); @@ -3075,7 +3024,7 @@ void ApplicationManagerImpl::SendHMIStatusNotification( } void ApplicationManagerImpl::ClearTimerPool() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::vector<TimerSPtr> new_timer_pool; @@ -3093,7 +3042,7 @@ void ApplicationManagerImpl::ClearTimerPool() { } void ApplicationManagerImpl::CloseNaviApp() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis::AppInterfaceUnregisteredReason; using namespace mobile_apis::Result; @@ -3103,8 +3052,7 @@ void ApplicationManagerImpl::CloseNaviApp() { NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); if (navi_service_status_.end() != it) { if (it->second.first || it->second.second) { - LOGGER_INFO(logger_, - "App haven't answered for EndService. Unregister it."); + SDL_INFO("App haven't answered for EndService. Unregister it."); ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( app_id, PROTOCOL_VIOLATION), @@ -3115,7 +3063,7 @@ void ApplicationManagerImpl::CloseNaviApp() { } void ApplicationManagerImpl::EndNaviStreaming() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis::AppInterfaceUnregisteredReason; using namespace mobile_apis::Result; @@ -3130,11 +3078,11 @@ void ApplicationManagerImpl::EndNaviStreaming() { void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || !app->is_navi()) { - LOGGER_ERROR(logger_, "Navi application not found"); + SDL_ERROR("Navi application not found"); return; } @@ -3151,11 +3099,11 @@ void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) { void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || !app->is_navi()) { - LOGGER_ERROR(logger_, "Navi application not found"); + SDL_ERROR("Navi application not found"); return; } @@ -3180,7 +3128,7 @@ policy::DeviceConsent ApplicationManagerImpl::GetUserConsentForDevice( return policy_handler_.GetUserConsentForDevice(device_id); } void ApplicationManagerImpl::OnWakeUp() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); is_low_voltage_ = false; request_ctrl_.OnWakeUp(); } @@ -3190,12 +3138,11 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( const std::string& file_path, const std::string& file_name, const int64_t offset) { - LOGGER_DEBUG(logger_, - "SaveBinaryWithOffset binary_size = " - << binary_data.size() << " offset = " << offset); + SDL_DEBUG("SaveBinaryWithOffset binary_size = " << binary_data.size() + << " offset = " << offset); if (binary_data.size() > file_system::GetAvailableDiskSpace(file_path)) { - LOGGER_ERROR(logger_, "Out of free disc space."); + SDL_ERROR("Out of free disc space."); return mobile_apis::Result::OUT_OF_MEMORY; } @@ -3205,15 +3152,13 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( std::ofstream* file_stream; if (offset != 0) { if (file_size != static_cast<uint64_t>(offset)) { - LOGGER_DEBUG(logger_, - "ApplicationManagerImpl::SaveBinaryWithOffset offset" - << " does'n match existing file size"); + SDL_DEBUG("ApplicationManagerImpl::SaveBinaryWithOffset offset" + << " does'n match existing file size"); return mobile_apis::Result::INVALID_DATA; } file_stream = file_system::Open(full_file_path, std::ios_base::app); } else { - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "ApplicationManagerImpl::SaveBinaryWithOffset offset is 0, rewrite"); // if offset == 0: rewrite file file_stream = file_system::Open(full_file_path, std::ios_base::out); @@ -3230,7 +3175,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( file_system::Close(file_stream); delete file_stream; file_stream = NULL; - LOGGER_INFO(logger_, "Successfully write data to file"); + SDL_INFO("Successfully write data to file"); return mobile_apis::Result::SUCCESS; } @@ -3265,7 +3210,7 @@ bool ApplicationManagerImpl::IsHMICooperating() const { } void ApplicationManagerImpl::OnApplicationListUpdateTimer() { - LOGGER_DEBUG(logger_, "Application list update timer finished"); + SDL_DEBUG("Application list update timer finished"); SendUpdateAppList(); GetPolicyHandler().OnAppsSearchCompleted(); } @@ -3289,8 +3234,7 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() { } if (!app_list.empty()) { for (uint32_t i = 0; i < app_list.size(); ++i) { - LOGGER_INFO(logger_, - "Send TTS GlobalProperties to HMI with default helpPrompt"); + SDL_INFO("Send TTS GlobalProperties to HMI with default helpPrompt"); MessageHelper::SendTTSGlobalProperties( application(app_list[i]), true, *this); RemoveAppFromTTSGlobalPropertiesList(app_list[i]); @@ -3300,7 +3244,7 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() { void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList( const uint32_t app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint16_t timeout = get_settings().tts_global_properties_timeout(); TimevalStruct current_time = date_time::DateTime::getCurrentTime(); current_time.tv_sec += timeout; @@ -3312,7 +3256,7 @@ void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList( } // if add first item need to start timer on one second if (1 == tts_global_properties_app_list_.size()) { - LOGGER_INFO(logger_, "Start tts_global_properties_timer_"); + SDL_INFO("Start tts_global_properties_timer_"); tts_global_properties_app_list_lock_.Release(); const uint32_t timeout_ms = 1000; tts_global_properties_timer_.Start(timeout_ms, timer::kPeriodic); @@ -3323,7 +3267,7 @@ void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList( void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList( const uint32_t app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // please avoid AutoLock usage to avoid deadlock tts_global_properties_app_list_lock_.Acquire(); std::map<uint32_t, TimevalStruct>::iterator it = @@ -3331,7 +3275,7 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList( if (tts_global_properties_app_list_.end() != it) { tts_global_properties_app_list_.erase(it); if (tts_global_properties_app_list_.empty()) { - LOGGER_DEBUG(logger_, "Stop tts_global_properties_timer_"); + SDL_DEBUG("Stop tts_global_properties_timer_"); // if container is empty need to stop timer tts_global_properties_app_list_lock_.Release(); tts_global_properties_timer_.Stop(); @@ -3343,7 +3287,7 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList( mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType( std::string str) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if ("DEFAULT" == str) { return mobile_apis::AppHMIType::DEFAULT; } else if ("COMMUNICATION" == str) { @@ -3372,7 +3316,7 @@ mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType( bool ApplicationManagerImpl::CompareAppHMIType( const smart_objects::SmartObject& from_policy, const smart_objects::SmartObject& from_application) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool equal = false; uint32_t lenght_policy_app_types = from_policy.length(); uint32_t lenght_application_app_types = from_application.length(); @@ -3394,7 +3338,7 @@ bool ApplicationManagerImpl::CompareAppHMIType( void ApplicationManagerImpl::OnUpdateHMIAppType( std::map<std::string, std::vector<std::string>> app_hmi_types) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::map<std::string, std::vector<std::string>>::iterator it_app_hmi_types_from_policy; @@ -3453,22 +3397,19 @@ void ApplicationManagerImpl::OnUpdateHMIAppType( } ProtocolVersion ApplicationManagerImpl::SupportedSDLVersion() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool heart_beat_support = get_settings().heart_beat_timeout(); bool sdl4_support = protocol_handler_->get_settings().enable_protocol_4(); if (sdl4_support) { - LOGGER_DEBUG(logger_, - "SDL Supported protocol version " << ProtocolVersion::kV4); + SDL_DEBUG("SDL Supported protocol version " << ProtocolVersion::kV4); return ProtocolVersion::kV4; } if (heart_beat_support) { - LOGGER_DEBUG(logger_, - "SDL Supported protocol version " << ProtocolVersion::kV3); + SDL_DEBUG("SDL Supported protocol version " << ProtocolVersion::kV3); return ProtocolVersion::kV3; } - LOGGER_DEBUG(logger_, - "SDL Supported protocol version " << ProtocolVersion::kV2); + SDL_DEBUG("SDL Supported protocol version " << ProtocolVersion::kV2); return ProtocolVersion::kV2; } @@ -3489,16 +3430,13 @@ bool ApplicationManagerImpl::InitDirectory( const std::string& path, ApplicationManagerImpl::DirectoryType type) const { const std::string directory_type = DirectoryTypeToString(type); if (!file_system::DirectoryExists(path)) { - LOGGER_WARN(logger_, directory_type << " directory doesn't exist."); + SDL_WARN(directory_type << " directory doesn't exist."); // if storage directory doesn't exist try to create it if (!file_system::CreateDirectoryRecursively(path)) { - LOGGER_ERROR(logger_, - "Unable to create " << directory_type << " directory " - << path); + SDL_ERROR("Unable to create " << directory_type << " directory " << path); return false; } - LOGGER_DEBUG(logger_, - directory_type << " directory has been created: " << path); + SDL_DEBUG(directory_type << " directory has been created: " << path); } return true; @@ -3509,27 +3447,25 @@ bool ApplicationManagerImpl::IsReadWriteAllowed(const std::string& path, const std::string directory_type = DirectoryTypeToString(type); if (!(file_system::IsWritingAllowed(path) && file_system::IsReadingAllowed(path))) { - LOGGER_ERROR(logger_, - directory_type - << " directory doesn't have read/write permissions."); + SDL_ERROR(directory_type + << " directory doesn't have read/write permissions."); return false; } - LOGGER_DEBUG(logger_, - directory_type << " directory has read/write permissions."); + SDL_DEBUG(directory_type << " directory has read/write permissions."); return true; } void ApplicationManagerImpl::ClearTTSGlobalPropertiesList() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_); tts_global_properties_app_list_.clear(); } bool ApplicationManagerImpl::IsAppSubscribedForWayPoints( const uint32_t app_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); if (subscribed_way_points_apps_list_.find(app_id) == subscribed_way_points_apps_list_.end()) { @@ -3539,27 +3475,27 @@ bool ApplicationManagerImpl::IsAppSubscribedForWayPoints( } void ApplicationManagerImpl::SubscribeAppForWayPoints(const uint32_t app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); subscribed_way_points_apps_list_.insert(app_id); } void ApplicationManagerImpl::UnsubscribeAppFromWayPoints( const uint32_t app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); subscribed_way_points_apps_list_.erase(app_id); } bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); return !subscribed_way_points_apps_list_.empty(); } const std::set<int32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); return subscribed_way_points_apps_list_; } diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc index 9450621b61..99645272dc 100644 --- a/src/components/application_manager/src/application_state.cc +++ b/src/components/application_manager/src/application_state.cc @@ -49,12 +49,12 @@ struct StateIDComparator { namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOGGER("ApplicationManager") ApplicationState::ApplicationState() {} void ApplicationState::InitState(HmiStatePtr state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); sync_primitives::AutoLock auto_lock(hmi_states_lock_); hmi_states_.clear(); @@ -62,7 +62,7 @@ void ApplicationState::InitState(HmiStatePtr state) { } void ApplicationState::AddState(HmiStatePtr state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); switch (state->state_id()) { case HmiState::StateID::STATE_ID_REGULAR: @@ -72,7 +72,7 @@ void ApplicationState::AddState(HmiStatePtr state) { SetPostponedState(state); return; case HmiState::StateID::STATE_ID_CURRENT: - LOGGER_ERROR(logger_, "State of type '" << state << "' can't be added."); + SDL_ERROR("State of type '" << state << "' can't be added."); return; default: AddHMIState(state); @@ -83,12 +83,12 @@ void ApplicationState::AddState(HmiStatePtr state) { } void ApplicationState::RemoveState(HmiState::StateID state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); switch (state) { case HmiState::StateID::STATE_ID_CURRENT: case HmiState::StateID::STATE_ID_REGULAR: - LOGGER_ERROR(logger_, "State of type '" << state << "'can't be removed."); + SDL_ERROR("State of type '" << state << "'can't be removed."); break; case HmiState::StateID::STATE_ID_POSTPONED: RemovePostponedState(); @@ -100,33 +100,31 @@ void ApplicationState::RemoveState(HmiState::StateID state) { } HmiStatePtr ApplicationState::GetState(HmiState::StateID state_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); switch (state_id) { case HmiState::StateID::STATE_ID_REGULAR: - LOGGER_DEBUG(logger_, "Getting regular state."); + SDL_DEBUG("Getting regular state."); return RegularHmiState(); case HmiState::StateID::STATE_ID_POSTPONED: - LOGGER_DEBUG(logger_, "Getting postponed state."); + SDL_DEBUG("Getting postponed state."); return PostponedHmiState(); default: - LOGGER_DEBUG(logger_, "Getting current state."); + SDL_DEBUG("Getting current state."); return CurrentHmiState(); } } void ApplicationState::AddHMIState(HmiStatePtr state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); sync_primitives::AutoLock auto_lock(hmi_states_lock_); HmiStates::iterator it = std::find_if(hmi_states_.begin(), hmi_states_.end(), StateIDComparator(state->state_id())); if (hmi_states_.end() != it) { - LOGGER_WARN( - logger_, - "Hmi state with ID " - << state->state_id() - << "has been already applied to this application. Ignoring"); + SDL_WARN("Hmi state with ID " + << state->state_id() + << "has been already applied to this application. Ignoring"); return; } @@ -134,12 +132,12 @@ void ApplicationState::AddHMIState(HmiStatePtr state) { } void ApplicationState::RemoveHMIState(HmiState::StateID state_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(hmi_states_lock_); HmiStates::iterator it = std::find_if( hmi_states_.begin(), hmi_states_.end(), StateIDComparator(state_id)); if (it == hmi_states_.end()) { - LOGGER_ERROR(logger_, "Unsuccesful remove HmiState: " << state_id); + SDL_ERROR("Unsuccesful remove HmiState: " << state_id); return; } @@ -158,7 +156,7 @@ void ApplicationState::RemoveHMIState(HmiState::StateID state_id) { } void ApplicationState::RemovePostponedState() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(hmi_states_lock_); DCHECK_OR_RETURN_VOID(!hmi_states_.empty()); @@ -168,14 +166,14 @@ void ApplicationState::RemovePostponedState() { std::find_if(hmi_states_.begin(), hmi_states_.end(), finder); if (hmi_states_.end() == postponed_state) { - LOGGER_ERROR(logger_, "No postponed state is set for app."); + SDL_ERROR("No postponed state is set for app."); return; } hmi_states_.erase(postponed_state); } void ApplicationState::SetRegularState(HmiStatePtr state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::StateID::STATE_ID_REGULAR); @@ -203,7 +201,7 @@ void ApplicationState::SetRegularState(HmiStatePtr state) { } void ApplicationState::SetPostponedState(HmiStatePtr state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::StateID::STATE_ID_POSTPONED); diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index 1811cf6b58..9a77cd891e 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -37,7 +37,8 @@ namespace application_manager { namespace commands { -CREATE_LOGGERPTR_LOCAL(CommandImpl::logger_, "Commands") +logger::LoggerType CommandImpl::logger_module_ptr( + log4cxx::Logger::getLogger("Commands")); const int32_t CommandImpl::hmi_protocol_type_ = 1; const int32_t CommandImpl::mobile_protocol_type_ = 0; @@ -100,10 +101,9 @@ void CommandImpl::ReplaceMobileByHMIAppId( ApplicationSharedPtr application = application_manager_.application(message[strings::app_id].asUInt()); if (application.valid()) { - LOGGER_DEBUG(logger_, - "ReplaceMobileByHMIAppId from " - << message[strings::app_id].asInt() << " to " - << application->hmi_app_id()); + SDL_DEBUG("ReplaceMobileByHMIAppId from " + << message[strings::app_id].asInt() << " to " + << application->hmi_app_id()); message[strings::app_id] = application->hmi_app_id(); } } else { @@ -138,10 +138,9 @@ void CommandImpl::ReplaceHMIByMobileAppId( message[strings::app_id].asUInt()); if (application.valid()) { - LOGGER_DEBUG(logger_, - "ReplaceHMIByMobileAppId from " - << message[strings::app_id].asInt() << " to " - << application->app_id()); + SDL_DEBUG("ReplaceHMIByMobileAppId from " + << message[strings::app_id].asInt() << " to " + << application->app_id()); message[strings::app_id] = application->app_id(); } } else { diff --git a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc index 254bdd2cff..341700ab66 100644 --- a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc +++ b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc @@ -60,7 +60,7 @@ void CommandNotificationFromMobileImpl::SendNotification() { (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); - LOGGER_INFO(logger_, "SendNotification"); + SDL_INFO("SendNotification"); MessageHelper::PrintSmartObject(*message_); application_manager_.SendMessageToMobile(message_); diff --git a/src/components/application_manager/src/commands/command_notification_impl.cc b/src/components/application_manager/src/commands/command_notification_impl.cc index 05e8d5ca89..e9c7169aba 100644 --- a/src/components/application_manager/src/commands/command_notification_impl.cc +++ b/src/components/application_manager/src/commands/command_notification_impl.cc @@ -60,7 +60,7 @@ void CommandNotificationImpl::SendNotification() { (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); - LOGGER_INFO(logger_, "SendNotification"); + SDL_INFO("SendNotification"); MessageHelper::PrintSmartObject(*message_); application_manager_.SendMessageToMobile(message_); diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index f0ccc92092..caa0521858 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -89,14 +89,14 @@ bool CommandRequestImpl::CleanUp() { void CommandRequestImpl::Run() {} void CommandRequestImpl::onTimeOut() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); unsubscribe_from_all_events(); { // FIXME (dchmerev@luxoft.com): atomic_xchg fits better sync_primitives::AutoLock auto_lock(state_lock_); if (kCompleted == current_state_) { - LOGGER_DEBUG(logger_, "current_state_ = kCompleted"); + SDL_DEBUG("current_state_ = kCompleted"); // don't send timeout if request completed return; } @@ -132,7 +132,7 @@ void CommandRequestImpl::SendResponse( smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; if (!result) { - LOGGER_ERROR(logger_, "Memory allocation failed."); + SDL_ERROR("Memory allocation failed."); return; } smart_objects::SmartObject& response = *result; @@ -178,12 +178,12 @@ void CommandRequestImpl::SendResponse( bool CommandRequestImpl::CheckSyntax(const std::string& str, bool allow_empty_line) { if (std::string::npos != str.find_first_of("\t\n")) { - LOGGER_ERROR(logger_, "CheckSyntax failed! :" << str); + SDL_ERROR("CheckSyntax failed! :" << str); return false; } if (std::string::npos != str.find("\\n") || std::string::npos != str.find("\\t")) { - LOGGER_ERROR(logger_, "CheckSyntax failed! :" << str); + SDL_ERROR("CheckSyntax failed! :" << str); return false; } if (!allow_empty_line) { @@ -203,9 +203,8 @@ uint32_t CommandRequestImpl::SendHMIRequest( const uint32_t hmi_correlation_id = application_manager_.GetNextHMICorrelationID(); if (use_events) { - LOGGER_DEBUG(logger_, - "subscribe_on_event " << function_id << " " - << hmi_correlation_id); + SDL_DEBUG("subscribe_on_event " << function_id << " " + << hmi_correlation_id); subscribe_on_event(function_id, hmi_correlation_id); } @@ -223,7 +222,7 @@ uint32_t CommandRequestImpl::SendHMIRequest( } if (!application_manager_.ManageHMICommand(result)) { - LOGGER_ERROR(logger_, "Unable to send request"); + SDL_ERROR("Unable to send request"); SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY); } return hmi_correlation_id; @@ -234,7 +233,7 @@ void CommandRequestImpl::CreateHMINotification( const NsSmart::SmartObject& msg_params) const { smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; if (!result) { - LOGGER_ERROR(logger_, "Memory allocation failed."); + SDL_ERROR("Memory allocation failed."); return; } smart_objects::SmartObject& notify = *result; @@ -249,7 +248,7 @@ void CommandRequestImpl::CreateHMINotification( notify[strings::msg_params] = msg_params; if (!application_manager_.ManageHMICommand(result)) { - LOGGER_ERROR(logger_, "Unable to send HMI notification"); + SDL_ERROR("Unable to send HMI notification"); } } @@ -358,7 +357,7 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode( break; } default: { - LOGGER_ERROR(logger_, "Unknown HMI result code " << hmi_code); + SDL_ERROR("Unknown HMI result code " << hmi_code); break; } } @@ -367,7 +366,7 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode( } bool CommandRequestImpl::CheckAllowedParameters() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // RegisterAppInterface should always be allowed if (mobile_apis::FunctionID::RegisterAppInterfaceID == @@ -391,7 +390,7 @@ bool CommandRequestImpl::CheckAllowedParameters() { for (; iter != iter_end; ++iter) { if (true == iter->second.asBool()) { - LOGGER_DEBUG(logger_, "Request's param: " << iter->first); + SDL_DEBUG("Request's param: " << iter->first); params.push_back(iter->first); } } @@ -433,7 +432,7 @@ bool CommandRequestImpl::CheckAllowedParameters() { } void CommandRequestImpl::RemoveDisallowedParameters() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& params = (*message_)[strings::msg_params]; @@ -447,9 +446,7 @@ void CommandRequestImpl::RemoveDisallowedParameters() { params.erase(*it_disallowed); removed_parameters_permissions_.disallowed_params.push_back( *it_disallowed); - LOGGER_INFO( - logger_, - "Following parameter is disallowed by user: " << *it_disallowed); + SDL_INFO("Following parameter is disallowed by user: " << *it_disallowed); } } @@ -462,8 +459,7 @@ void CommandRequestImpl::RemoveDisallowedParameters() { if (params.keyExists(*it_undefined)) { params.erase(*it_undefined); removed_parameters_permissions_.undefined_params.push_back(*it_undefined); - LOGGER_INFO( - logger_, + SDL_INFO( "Following parameter is disallowed by policy: " << *it_undefined); } } @@ -483,9 +479,8 @@ void CommandRequestImpl::RemoveDisallowedParameters() { key)) { params.erase(key); removed_parameters_permissions_.undefined_params.push_back(key); - LOGGER_INFO(logger_, - "Following parameter is not found among allowed parameters '" - << key << "' and will be treated as disallowed."); + SDL_INFO("Following parameter is not found among allowed parameters '" + << key << "' and will be treated as disallowed."); } } } diff --git a/src/components/application_manager/src/commands/command_response_impl.cc b/src/components/application_manager/src/commands/command_response_impl.cc index 54b98af025..76ae804792 100644 --- a/src/components/application_manager/src/commands/command_response_impl.cc +++ b/src/components/application_manager/src/commands/command_response_impl.cc @@ -57,7 +57,7 @@ void CommandResponseImpl::SendResponse( bool success, const mobile_apis::Result::eType& result_code, bool final_message) { - LOGGER_INFO(logger_, "Trying to send response"); + SDL_INFO("Trying to send response"); (*message_)[strings::params][strings::protocol_type] = mobile_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/src/commands/hmi/activate_app_request.cc b/src/components/application_manager/src/commands/hmi/activate_app_request.cc index c572e29e19..f28d0c8ae9 100644 --- a/src/components/application_manager/src/commands/hmi/activate_app_request.cc +++ b/src/components/application_manager/src/commands/hmi/activate_app_request.cc @@ -42,11 +42,11 @@ ActivateAppRequest::ActivateAppRequest(const MessageSharedPtr& message, : RequestToHMI(message, application_manager) {} ActivateAppRequest::~ActivateAppRequest() { - LOGGER_TRACE(logger_, "~ActivateAppRequest"); + SDL_TRACE("~ActivateAppRequest"); } void ActivateAppRequest::Run() { - LOGGER_TRACE(logger_, "enter " << correlation_id()); + SDL_TRACE("enter " << correlation_id()); uint32_t app_id = RequestToHMI::application_id(); application_manager_.set_application_id(correlation_id(), app_id); #ifdef ENABLE_LOG @@ -56,11 +56,11 @@ void ActivateAppRequest::Run() { static_cast<mobile_apis::HMILevel::eType>( (*message_)[strings::msg_params][strings::activate_app_hmi_level] .asInt()); - LOGGER_TRACE(logger_, "requested_hmi_level = " << requested_hmi_level); + SDL_TRACE("requested_hmi_level = " << requested_hmi_level); } #endif SendRequest(); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/activate_app_response.cc b/src/components/application_manager/src/commands/hmi/activate_app_response.cc index ff6a42a900..9844cb28a1 100644 --- a/src/components/application_manager/src/commands/hmi/activate_app_response.cc +++ b/src/components/application_manager/src/commands/hmi/activate_app_response.cc @@ -43,12 +43,12 @@ ActivateAppResponse::ActivateAppResponse( ActivateAppResponse::~ActivateAppResponse() {} void ActivateAppResponse::Run() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_ActivateApp); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc b/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc index 3f89d962ff..92b24f8bb7 100644 --- a/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc +++ b/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc @@ -45,7 +45,7 @@ AddStatisticsInfoNotification::AddStatisticsInfoNotification( AddStatisticsInfoNotification::~AddStatisticsInfoNotification() {} void AddStatisticsInfoNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); int type = (*message_)[strings::msg_params][hmi_notification::statistic_type] .asInt(); diff --git a/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc b/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc index 5dbfafbb29..6dcc668aa3 100644 --- a/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc +++ b/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc @@ -43,7 +43,7 @@ AllowAllAppsRequest::AllowAllAppsRequest( AllowAllAppsRequest::~AllowAllAppsRequest() {} void AllowAllAppsRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc b/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc index 8fd5ef2223..bf149d9b06 100644 --- a/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc +++ b/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc @@ -42,7 +42,7 @@ AllowAllAppsResponse::AllowAllAppsResponse( AllowAllAppsResponse::~AllowAllAppsResponse() {} void AllowAllAppsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SetAllAppsAllowed( (*message_)[strings::msg_params][hmi_response::allowed].asBool()); diff --git a/src/components/application_manager/src/commands/hmi/allow_app_request.cc b/src/components/application_manager/src/commands/hmi/allow_app_request.cc index a5b053d088..9e500b320f 100644 --- a/src/components/application_manager/src/commands/hmi/allow_app_request.cc +++ b/src/components/application_manager/src/commands/hmi/allow_app_request.cc @@ -43,7 +43,7 @@ AllowAppRequest::AllowAppRequest(const MessageSharedPtr& message, AllowAppRequest::~AllowAppRequest() {} void AllowAppRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/allow_app_response.cc b/src/components/application_manager/src/commands/hmi/allow_app_response.cc index 548931f9ba..c6e72ba280 100644 --- a/src/components/application_manager/src/commands/hmi/allow_app_response.cc +++ b/src/components/application_manager/src/commands/hmi/allow_app_response.cc @@ -43,7 +43,7 @@ AllowAppResponse::AllowAppResponse(const MessageSharedPtr& message, AllowAppResponse::~AllowAppResponse() {} void AllowAppResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t connection_key = (*message_)[strings::params][strings::connection_key].asInt(); @@ -51,7 +51,7 @@ void AllowAppResponse::Run() { ApplicationSharedPtr app = application_manager_.application(connection_key); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } app->set_app_allowed( diff --git a/src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc b/src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc index 3b2e3a6b99..5c3f4a0d5f 100644 --- a/src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc +++ b/src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc @@ -43,7 +43,7 @@ BasicCommunicationSystemRequest::BasicCommunicationSystemRequest( BasicCommunicationSystemRequest::~BasicCommunicationSystemRequest() {} void BasicCommunicationSystemRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc b/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc index c073542330..ce643c32d5 100644 --- a/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc +++ b/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc @@ -44,7 +44,7 @@ BasicCommunicationSystemResponse::BasicCommunicationSystemResponse( BasicCommunicationSystemResponse::~BasicCommunicationSystemResponse() {} void BasicCommunicationSystemResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_SystemRequest); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc index 4760bab634..241e2e4951 100644 --- a/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc +++ b/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc @@ -44,7 +44,7 @@ ButtonGetCapabilitiesRequest::ButtonGetCapabilitiesRequest( ButtonGetCapabilitiesRequest::~ButtonGetCapabilitiesRequest() {} void ButtonGetCapabilitiesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc index 059b33b055..b278996dcd 100644 --- a/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc +++ b/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc @@ -43,13 +43,13 @@ ButtonGetCapabilitiesResponse::ButtonGetCapabilitiesResponse( ButtonGetCapabilitiesResponse::~ButtonGetCapabilitiesResponse() {} void ButtonGetCapabilitiesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); if (hmi_apis::Common_Result::SUCCESS != code) { - LOGGER_ERROR(logger_, "Error is returned. Capabilities won't be updated."); + SDL_ERROR("Error is returned. Capabilities won't be updated."); return; } diff --git a/src/components/application_manager/src/commands/hmi/close_popup_request.cc b/src/components/application_manager/src/commands/hmi/close_popup_request.cc index af00c66e35..08b8a2a5e7 100644 --- a/src/components/application_manager/src/commands/hmi/close_popup_request.cc +++ b/src/components/application_manager/src/commands/hmi/close_popup_request.cc @@ -43,7 +43,7 @@ ClosePopupRequest::ClosePopupRequest(const MessageSharedPtr& message, ClosePopupRequest::~ClosePopupRequest() {} void ClosePopupRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/close_popup_response.cc b/src/components/application_manager/src/commands/hmi/close_popup_response.cc index d009d226b5..a4622a3e4d 100644 --- a/src/components/application_manager/src/commands/hmi/close_popup_response.cc +++ b/src/components/application_manager/src/commands/hmi/close_popup_response.cc @@ -42,7 +42,7 @@ ClosePopupResponse::ClosePopupResponse(const MessageSharedPtr& message, ClosePopupResponse::~ClosePopupResponse() {} void ClosePopupResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO(VS): Process response from HMI } diff --git a/src/components/application_manager/src/commands/hmi/get_system_info_request.cc b/src/components/application_manager/src/commands/hmi/get_system_info_request.cc index 91260a78b4..4ce0c75bf3 100644 --- a/src/components/application_manager/src/commands/hmi/get_system_info_request.cc +++ b/src/components/application_manager/src/commands/hmi/get_system_info_request.cc @@ -43,7 +43,7 @@ GetSystemInfoRequest::GetSystemInfoRequest( GetSystemInfoRequest::~GetSystemInfoRequest() {} void GetSystemInfoRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t correlation_id = RequestToHMI::correlation_id(); uint32_t app_id = RequestToHMI::application_id(); application_manager_.set_application_id(correlation_id, app_id); diff --git a/src/components/application_manager/src/commands/hmi/get_system_info_response.cc b/src/components/application_manager/src/commands/hmi/get_system_info_response.cc index 5c630f3e17..7b307feb7b 100644 --- a/src/components/application_manager/src/commands/hmi/get_system_info_response.cc +++ b/src/components/application_manager/src/commands/hmi/get_system_info_response.cc @@ -42,7 +42,7 @@ GetSystemInfoResponse::GetSystemInfoResponse( GetSystemInfoResponse::~GetSystemInfoResponse() {} void GetSystemInfoResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( @@ -61,7 +61,7 @@ const SystemInfo GetSystemInfoResponse::GetSystemInfo( SystemInfo info; if (hmi_apis::Common_Result::SUCCESS != code) { - LOGGER_WARN(logger_, "GetSystemError returns an error code " << code); + SDL_WARN("GetSystemError returns an error code " << code); return info; } info.ccpu_version = diff --git a/src/components/application_manager/src/commands/hmi/get_urls.cc b/src/components/application_manager/src/commands/hmi/get_urls.cc index 6a32df4546..230786bd6d 100644 --- a/src/components/application_manager/src/commands/hmi/get_urls.cc +++ b/src/components/application_manager/src/commands/hmi/get_urls.cc @@ -45,7 +45,7 @@ GetUrls::GetUrls(const MessageSharedPtr& message, GetUrls::~GetUrls() {} void GetUrls::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace smart_objects; using namespace application_manager; using namespace strings; @@ -64,7 +64,7 @@ void GetUrls::Run() { application_manager_.GetPolicyHandler().GetServiceUrls( object[strings::msg_params][hmi_request::service].asString(), endpoints); if (endpoints.empty()) { - LOGGER_ERROR(logger_, "No URLs for service " << service_to_check); + SDL_ERROR("No URLs for service " << service_to_check); SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE); return; } @@ -82,7 +82,7 @@ void GetUrls::Run() { #ifdef EXTENDED_POLICY void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace smart_objects; using namespace application_manager; using namespace strings; @@ -92,8 +92,7 @@ void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) { application_manager_.GetPolicyHandler().GetAppIdForSending(); if (!app_id_to_send_to) { - LOGGER_ERROR(logger_, - "There are no available applications for processing."); + SDL_ERROR("There are no available applications for processing."); application_manager_.ManageHMICommand(message_); return; } @@ -102,10 +101,10 @@ void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) { application_manager_.application(app_id_to_send_to); if (!app.valid()) { - LOGGER_WARN(logger_, - "There is no registered application with " - "connection key '" - << app_id_to_send_to << "'"); + SDL_WARN( + "There is no registered application with " + "connection key '" + << app_id_to_send_to << "'"); SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE); return; } diff --git a/src/components/application_manager/src/commands/hmi/get_urls_response.cc b/src/components/application_manager/src/commands/hmi/get_urls_response.cc index 983dc4aea8..e637edfb57 100644 --- a/src/components/application_manager/src/commands/hmi/get_urls_response.cc +++ b/src/components/application_manager/src/commands/hmi/get_urls_response.cc @@ -42,7 +42,7 @@ GetUrlsResponse::GetUrlsResponse(const MessageSharedPtr& message, GetUrlsResponse::~GetUrlsResponse() {} void GetUrlsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc b/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc index 56f84398db..896a020eb5 100644 --- a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc +++ b/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc @@ -43,7 +43,7 @@ MixingAudioSupportedRequest::MixingAudioSupportedRequest( MixingAudioSupportedRequest::~MixingAudioSupportedRequest() {} void MixingAudioSupportedRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc b/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc index a736ac3ef7..181ec2f049 100644 --- a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc +++ b/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc @@ -42,7 +42,7 @@ MixingAudioSupportedResponse::MixingAudioSupportedResponse( MixingAudioSupportedResponse::~MixingAudioSupportedResponse() {} void MixingAudioSupportedResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); hmi_capabilities.set_attenuated_supported( diff --git a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc b/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc index 7dfc368b8d..1eb08f8144 100644 --- a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc @@ -43,7 +43,7 @@ NaviAlertManeuverRequest::NaviAlertManeuverRequest( NaviAlertManeuverRequest::~NaviAlertManeuverRequest() {} void NaviAlertManeuverRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc b/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc index ccad3a029d..e0330fdde2 100644 --- a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc @@ -44,7 +44,7 @@ NaviAlertManeuverResponse::NaviAlertManeuverResponse( NaviAlertManeuverResponse::~NaviAlertManeuverResponse() {} void NaviAlertManeuverResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_AlertManeuver); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc index a7eedc6c34..c74fba0ca5 100644 --- a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc @@ -43,20 +43,19 @@ AudioStartStreamRequest::AudioStartStreamRequest( : RequestToHMI(message, application_manager) , EventObserver(application_manager.event_dispatcher()) , retry_number_(0) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::pair<uint32_t, int32_t> stream_retry = application_manager_.get_settings().start_stream_retry_amount(); default_timeout_ = stream_retry.second; retry_number_ = stream_retry.first; - LOGGER_DEBUG(logger_, - "default_timeout_ = " << default_timeout_ - << "; retry_number_ = " << retry_number_); + SDL_DEBUG("default_timeout_ = " << default_timeout_ + << "; retry_number_ = " << retry_number_); } AudioStartStreamRequest::~AudioStartStreamRequest() {} void AudioStartStreamRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SetAllowedToTerminate(false); subscribe_on_event(hmi_apis::FunctionID::Navigation_StartAudioStream, @@ -68,47 +67,44 @@ void AudioStartStreamRequest::Run() { app->set_audio_streaming_allowed(true); SendRequest(); } else { - LOGGER_ERROR(logger_, - "Applcation with hmi_app_id " << application_id() - << " does not exist"); + SDL_ERROR("Applcation with hmi_app_id " << application_id() + << " does not exist"); } } void AudioStartStreamRequest::on_event(const event_engine::Event& event) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOGGER_ERROR(logger_, - "StartAudioStreamRequest aborted. Application not found"); + SDL_ERROR("StartAudioStreamRequest aborted. Application not found"); return; } const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_StartAudioStream: { - LOGGER_DEBUG(logger_, "Received StartStream event"); + SDL_DEBUG("Received StartStream event"); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); if (hmi_apis::Common_Result::SUCCESS == code) { - LOGGER_INFO(logger_, "AudioStartStream response SUCCESS"); + SDL_INFO("AudioStartStream response SUCCESS"); if (application_manager_.HMILevelAllowsStreaming(app->app_id(), ServiceType::kAudio)) { app->set_audio_streaming_approved(true); } else { - LOGGER_WARN( - logger_, + SDL_WARN( "StartAudioStreamRequest aborted. Application can not stream"); } break; } if (hmi_apis::Common_Result::REJECTED == code) { - LOGGER_INFO(logger_, "StartAudioStream response REJECTED"); + SDL_INFO("StartAudioStream response REJECTED"); RetryStartSession(); application_manager_.TerminateRequest(connection_key(), correlation_id()); @@ -116,7 +112,7 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) { } } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } @@ -128,40 +124,36 @@ void AudioStartStreamRequest::onTimeOut() { } void AudioStartStreamRequest::RetryStartSession() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOGGER_ERROR(logger_, - "StartAudioStreamRequest aborted. Application not found"); + SDL_ERROR("StartAudioStreamRequest aborted. Application not found"); return; } if (!app->audio_streaming_allowed()) { - LOGGER_WARN(logger_, "Audio streaming not allowed"); + SDL_WARN("Audio streaming not allowed"); return; } if (app->audio_streaming_approved()) { - LOGGER_DEBUG(logger_, - "AudioStartStream retry sequence stopped. " - << "Audio streaming is approved"); + SDL_INFO("AudioStartStream retry sequence stopped. " + << "Audio streaming is approved"); app->set_audio_stream_retry_number(0); return; } uint32_t curr_retry_number = app->audio_stream_retry_number(); if (curr_retry_number < retry_number_ - 1) { - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "Send AudioStartStream retry. retry_number = " << curr_retry_number); MessageHelper::SendAudioStartStream(app->app_id(), application_manager_); app->set_audio_stream_retry_number(++curr_retry_number); } else { - LOGGER_DEBUG(logger_, - "Audio start stream retry sequence stopped. " - << "Attempts expired."); + SDL_DEBUG("Audio start stream retry sequence stopped. " + << "Attempts expired."); application_manager_.EndNaviServices(app->app_id()); } } diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc index 3840645c83..e27e86d9a7 100644 --- a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc @@ -42,7 +42,7 @@ AudioStartStreamResponse::AudioStartStreamResponse( AudioStartStreamResponse::~AudioStartStreamResponse() {} void AudioStartStreamResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_StartAudioStream); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc index 06fdec0aeb..b326326d5e 100644 --- a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc @@ -42,7 +42,7 @@ AudioStopStreamRequest::AudioStopStreamRequest( AudioStopStreamRequest::~AudioStopStreamRequest() {} void AudioStopStreamRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc index df946da0d1..96e69741f7 100644 --- a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc @@ -42,7 +42,7 @@ AudioStopStreamResponse::AudioStopStreamResponse( AudioStopStreamResponse::~AudioStopStreamResponse() {} void AudioStopStreamResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc b/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc index 7c9bafe818..52d7ef32cc 100644 --- a/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc @@ -43,7 +43,7 @@ NaviGetWayPointsRequest::NaviGetWayPointsRequest( NaviGetWayPointsRequest::~NaviGetWayPointsRequest() {} void NaviGetWayPointsRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc b/src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc index 7a49568194..bcfc34f3d5 100644 --- a/src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc @@ -45,7 +45,7 @@ NaviGetWayPointsResponse::NaviGetWayPointsResponse( NaviGetWayPointsResponse::~NaviGetWayPointsResponse() {} void NaviGetWayPointsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_GetWayPoints); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc index 37b5b11cec..c54b6af572 100644 --- a/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc @@ -43,7 +43,7 @@ NaviIsReadyRequest::NaviIsReadyRequest(const MessageSharedPtr& message, NaviIsReadyRequest::~NaviIsReadyRequest() {} void NaviIsReadyRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc index 17103fba97..13cdfd22e8 100644 --- a/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc @@ -42,7 +42,7 @@ NaviIsReadyResponse::NaviIsReadyResponse( NaviIsReadyResponse::~NaviIsReadyResponse() {} void NaviIsReadyResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& object = *message_; bool is_available = false; diff --git a/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc b/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc index 492180f9d4..85bb03724c 100644 --- a/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc @@ -43,7 +43,7 @@ NaviSendLocationRequest::NaviSendLocationRequest( NaviSendLocationRequest::~NaviSendLocationRequest() {} void NaviSendLocationRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc b/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc index 51dd0cc6ed..b704e09953 100644 --- a/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc @@ -43,7 +43,7 @@ NaviSendLocationResponse::NaviSendLocationResponse( NaviSendLocationResponse::~NaviSendLocationResponse() {} void NaviSendLocationResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_SendLocation); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc b/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc index 36382b6906..8a9731a1e0 100644 --- a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc @@ -43,7 +43,7 @@ NaviShowConstantTBTRequest::NaviShowConstantTBTRequest( NaviShowConstantTBTRequest::~NaviShowConstantTBTRequest() {} void NaviShowConstantTBTRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc b/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc index b9a8226f62..4577bf95d1 100644 --- a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc @@ -44,7 +44,7 @@ NaviShowConstantTBTResponse::NaviShowConstantTBTResponse( NaviShowConstantTBTResponse::~NaviShowConstantTBTResponse() {} void NaviShowConstantTBTResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_ShowConstantTBT); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc index 8ec299f504..a07b6e208e 100644 --- a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc @@ -43,20 +43,19 @@ NaviStartStreamRequest::NaviStartStreamRequest( : RequestToHMI(message, application_manager) , EventObserver(application_manager.event_dispatcher()) , retry_number_(0) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::pair<uint32_t, int32_t> stream_retry = application_manager_.get_settings().start_stream_retry_amount(); default_timeout_ = stream_retry.second; retry_number_ = stream_retry.first; - LOGGER_DEBUG(logger_, - "default_timeout_ = " << default_timeout_ - << "; retry_number_ = " << retry_number_); + SDL_DEBUG("default_timeout_ = " << default_timeout_ + << "; retry_number_ = " << retry_number_); } NaviStartStreamRequest::~NaviStartStreamRequest() {} void NaviStartStreamRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SetAllowedToTerminate(false); subscribe_on_event(hmi_apis::FunctionID::Navigation_StartStream, @@ -68,47 +67,44 @@ void NaviStartStreamRequest::Run() { app->set_video_streaming_allowed(true); SendRequest(); } else { - LOGGER_ERROR(logger_, - "Applcation with hmi_app_id " << application_id() - << "does not exist"); + SDL_ERROR("Applcation with hmi_app_id " << application_id() + << "does not exist"); } } void NaviStartStreamRequest::on_event(const event_engine::Event& event) { using namespace protocol_handler; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOGGER_ERROR(logger_, - "NaviStartStreamRequest aborted. Application not found"); + SDL_ERROR("NaviStartStreamRequest aborted. Application not found"); return; } const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_StartStream: { - LOGGER_DEBUG(logger_, "Received StartStream event"); + SDL_DEBUG("Received StartStream event"); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); if (hmi_apis::Common_Result::SUCCESS == code) { - LOGGER_INFO(logger_, "NaviStartStreamResponse SUCCESS"); + SDL_INFO("NaviStartStreamResponse SUCCESS"); if (application_manager_.HMILevelAllowsStreaming( app->app_id(), ServiceType::kMobileNav)) { app->set_video_streaming_approved(true); } else { - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "NaviStartStreamRequest aborted. Application can not stream"); } break; } if (hmi_apis::Common_Result::REJECTED == code) { - LOGGER_INFO(logger_, "StartStream response REJECTED "); + SDL_INFO("StartStream response REJECTED "); RetryStartSession(); application_manager_.TerminateRequest(connection_key(), correlation_id()); @@ -116,7 +112,7 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) { } } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } @@ -128,40 +124,36 @@ void NaviStartStreamRequest::onTimeOut() { } void NaviStartStreamRequest::RetryStartSession() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOGGER_ERROR(logger_, - "NaviStartStreamRequest aborted. Application not found"); + SDL_ERROR("NaviStartStreamRequest aborted. Application not found"); return; } if (!app->video_streaming_allowed()) { - LOGGER_WARN(logger_, "Video streaming not allowed"); + SDL_WARN("Video streaming not allowed"); return; } if (app->video_streaming_approved()) { - LOGGER_DEBUG(logger_, - "NaviStartStream retry sequence stopped. " - << "Video streaming is approved"); + SDL_DEBUG("NaviStartStream retry sequence stopped. " + << "Video streaming is approved"); app->set_video_stream_retry_number(0); return; } uint32_t curr_retry_number = app->video_stream_retry_number(); if (curr_retry_number < retry_number_ - 1) { - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "Send NaviStartStream retry. retry_number = " << curr_retry_number); MessageHelper::SendNaviStartStream(app->app_id(), application_manager_); app->set_video_stream_retry_number(++curr_retry_number); } else { - LOGGER_DEBUG(logger_, - "NaviStartStream retry sequence stopped. " - << "Attempts expired"); + SDL_DEBUG("NaviStartStream retry sequence stopped. " + << "Attempts expired"); application_manager_.EndNaviServices(app->app_id()); } } diff --git a/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc index e6ad5fc28b..a865ae7043 100644 --- a/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc @@ -42,7 +42,7 @@ NaviStartStreamResponse::NaviStartStreamResponse( NaviStartStreamResponse::~NaviStartStreamResponse() {} void NaviStartStreamResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_StartStream); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc index 55804b2400..a7c9de59f8 100644 --- a/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc @@ -11,7 +11,7 @@ NaviStopStreamRequest::NaviStopStreamRequest( NaviStopStreamRequest::~NaviStopStreamRequest() {} void NaviStopStreamRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc index d3c09c4c58..fe33bd7e77 100644 --- a/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc @@ -42,7 +42,7 @@ NaviStopStreamResponse::NaviStopStreamResponse( NaviStopStreamResponse::~NaviStopStreamResponse() {} void NaviStopStreamResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_request.cc b/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_request.cc index 786572a3ff..57ac6b7eb5 100644 --- a/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_request.cc @@ -43,7 +43,7 @@ NaviSubscribeWayPointsRequest::NaviSubscribeWayPointsRequest( NaviSubscribeWayPointsRequest::~NaviSubscribeWayPointsRequest() {} void NaviSubscribeWayPointsRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_response.cc b/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_response.cc index 9ac46e196a..bfe119a897 100644 --- a/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_response.cc @@ -45,7 +45,7 @@ NaviSubscribeWayPointsResponse::NaviSubscribeWayPointsResponse( NaviSubscribeWayPointsResponse::~NaviSubscribeWayPointsResponse() {} void NaviSubscribeWayPointsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::Navigation_SubscribeWayPoints); diff --git a/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc index 6803e17a02..6fcc1939b3 100644 --- a/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc @@ -43,7 +43,7 @@ NaviUnSubscribeWayPointsRequest::NaviUnSubscribeWayPointsRequest( NaviUnSubscribeWayPointsRequest::~NaviUnSubscribeWayPointsRequest() {} void NaviUnSubscribeWayPointsRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc b/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc index dca4cac89d..17b0e30112 100644 --- a/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc @@ -46,7 +46,7 @@ NaviUnsubscribeWayPointsResponse::NaviUnsubscribeWayPointsResponse( NaviUnsubscribeWayPointsResponse::~NaviUnsubscribeWayPointsResponse() {} void NaviUnsubscribeWayPointsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints); diff --git a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc b/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc index a59db29942..3e1ce66b93 100644 --- a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc @@ -43,7 +43,7 @@ NaviUpdateTurnListRequest::NaviUpdateTurnListRequest( NaviUpdateTurnListRequest::~NaviUpdateTurnListRequest() {} void NaviUpdateTurnListRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc b/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc index dc022ac733..b3e6ed1149 100644 --- a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc +++ b/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc @@ -44,7 +44,7 @@ NaviUpdateTurnListResponse::NaviUpdateTurnListResponse( NaviUpdateTurnListResponse::~NaviUpdateTurnListResponse() {} void NaviUpdateTurnListResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc b/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc index ba4aac6a86..1c329181b0 100644 --- a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc @@ -69,7 +69,7 @@ void NotificationFromHMI::CreateHMIRequest( const smart_objects::SmartObject& msg_params) const { smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; if (!result) { - LOGGER_ERROR(logger_, "Memory allocation failed."); + SDL_ERROR("Memory allocation failed."); return; } @@ -91,7 +91,7 @@ void NotificationFromHMI::CreateHMIRequest( request[strings::msg_params] = msg_params; if (!application_manager_.ManageHMICommand(result)) { - LOGGER_ERROR(logger_, "Unable to send request"); + SDL_ERROR("Unable to send request"); return; } } diff --git a/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc b/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc index f9f778dc18..90d564c7f6 100644 --- a/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc @@ -45,7 +45,7 @@ OnAllowSDLFunctionalityNotification::OnAllowSDLFunctionalityNotification( OnAllowSDLFunctionalityNotification::~OnAllowSDLFunctionalityNotification() {} void OnAllowSDLFunctionalityNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::string device_id; if ((*message_)[strings::msg_params].keyExists("device")) { device_id = (*message_)[strings::msg_params]["device"]["id"].asString(); diff --git a/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc index d0927bdfb9..ae84767c25 100644 --- a/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc @@ -45,7 +45,7 @@ OnAppActivatedNotification::OnAppActivatedNotification( OnAppActivatedNotification::~OnAppActivatedNotification() {} void OnAppActivatedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_OnAppActivated); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc index a3ed174689..2ed5ab471e 100644 --- a/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc @@ -46,7 +46,7 @@ OnAppDeactivatedNotification::OnAppDeactivatedNotification( OnAppDeactivatedNotification::~OnAppDeactivatedNotification() {} void OnAppDeactivatedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc index 8b49f7dc57..c411893e02 100644 --- a/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc @@ -43,7 +43,7 @@ OnAppPermissionChangedNotification::OnAppPermissionChangedNotification( OnAppPermissionChangedNotification::~OnAppPermissionChangedNotification() {} void OnAppPermissionChangedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc index 70b934ffe4..e9e2fbfb50 100644 --- a/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc @@ -47,7 +47,7 @@ OnAppPermissionConsentNotification::OnAppPermissionConsentNotification( OnAppPermissionConsentNotification::~OnAppPermissionConsentNotification() {} void OnAppPermissionConsentNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; uint32_t connection_key = 0; diff --git a/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc index 14e5888871..a82b08140f 100644 --- a/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc @@ -43,7 +43,7 @@ OnAppRegisteredNotification::OnAppRegisteredNotification( OnAppRegisteredNotification::~OnAppRegisteredNotification() {} void OnAppRegisteredNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // SDL must notify system about app registration before any dependent actions // will be started SendNotification(); diff --git a/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc index 5c8d075836..080ae915ca 100644 --- a/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc @@ -44,7 +44,7 @@ OnAppUnregisteredNotification::OnAppUnregisteredNotification( OnAppUnregisteredNotification::~OnAppUnregisteredNotification() {} void OnAppUnregisteredNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // sending event for delete VRCommand on PerformInteraction event_engine::Event event( diff --git a/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc b/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc index 8ed4b9091b..4626b43c05 100644 --- a/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc @@ -43,7 +43,7 @@ OnAudioDataStreamingNotification::OnAudioDataStreamingNotification( OnAudioDataStreamingNotification::~OnAudioDataStreamingNotification() {} void OnAudioDataStreamingNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc b/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc index c871316abf..e7d6bc18f9 100644 --- a/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc @@ -45,7 +45,7 @@ OnButtonEventNotification::OnButtonEventNotification( : NotificationFromHMI(message, application_manager) {} void OnButtonEventNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::OnButtonEventID); diff --git a/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc b/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc index 759f5f3dee..5cf181d9dd 100644 --- a/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc @@ -46,7 +46,7 @@ OnButtonPressNotification::OnButtonPressNotification( : NotificationFromHMI(message, application_manager) {} void OnButtonPressNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Buttons_OnButtonPress); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc b/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc index b0eca331fa..55d02de869 100644 --- a/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc @@ -45,7 +45,7 @@ OnButtonSubscriptionNotification::OnButtonSubscriptionNotification( OnButtonSubscriptionNotification::~OnButtonSubscriptionNotification() {} void OnButtonSubscriptionNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc b/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc index 6975a39182..266a70e847 100644 --- a/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc @@ -43,7 +43,7 @@ OnDeviceChosenNotification::OnDeviceChosenNotification( OnDeviceChosenNotification::~OnDeviceChosenNotification() {} void OnDeviceChosenNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if ((*message_)[strings::msg_params].keyExists(strings::device_info)) { application_manager_.ConnectToDevice( diff --git a/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc index 823baad7e6..ce3e43af66 100644 --- a/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc @@ -85,7 +85,7 @@ OnDeviceStateChangedNotification::OnDeviceStateChangedNotification( OnDeviceStateChangedNotification::~OnDeviceStateChangedNotification() {} void OnDeviceStateChangedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if ((*message_)[strings::msg_params]["deviceState"] == hmi_apis::Common_DeviceState::UNPAIRED) { @@ -100,11 +100,11 @@ void OnDeviceStateChangedNotification::Run() { } } else { // Policy uses hashed MAC address as device_id - LOGGER_DEBUG(logger_, "Device_id from HMI: " << device_id); + SDL_DEBUG("Device_id from HMI: " << device_id); std::string bt_mac = convert_to_bt_mac(device_id); - LOGGER_DEBUG(logger_, "Device_id as BT MAC: " << bt_mac); + SDL_DEBUG("Device_id as BT MAC: " << bt_mac); device_id = encryption::MakeHash(bt_mac); - LOGGER_DEBUG(logger_, "Device_id hashed as BT MAC : " << device_id); + SDL_DEBUG("Device_id hashed as BT MAC : " << device_id); } application_manager_.GetPolicyHandler().RemoveDevice(device_id); } diff --git a/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc index 9b68f80ded..0ee8f51cd7 100644 --- a/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc @@ -50,7 +50,7 @@ OnDriverDistractionNotification::OnDriverDistractionNotification( OnDriverDistractionNotification::~OnDriverDistractionNotification() {} void OnDriverDistractionNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const hmi_apis::Common_DriverDistractionState::eType state = static_cast<hmi_apis::Common_DriverDistractionState::eType>( @@ -61,7 +61,7 @@ void OnDriverDistractionNotification::Run() { new smart_objects::SmartObject(); if (!on_driver_distraction) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } diff --git a/src/components/application_manager/src/commands/hmi/on_event_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_event_changed_notification.cc index 097549752b..bf552b2f4d 100644 --- a/src/components/application_manager/src/commands/hmi/on_event_changed_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_event_changed_notification.cc @@ -43,7 +43,7 @@ OnEventChangedNotification::OnEventChangedNotification( OnEventChangedNotification::~OnEventChangedNotification() {} void OnEventChangedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_OnEventChanged); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc index d52f51ddca..652d8884b5 100644 --- a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc @@ -55,12 +55,12 @@ OnExitAllApplicationsNotification::OnExitAllApplicationsNotification( OnExitAllApplicationsNotification::~OnExitAllApplicationsNotification() {} void OnExitAllApplicationsNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const hmi_apis::Common_ApplicationsCloseReason::eType reason = static_cast<hmi_apis::Common_ApplicationsCloseReason::eType>( (*message_)[strings::msg_params][hmi_request::reason].asInt()); - LOGGER_DEBUG(logger_, "Reason " << reason); + SDL_DEBUG("Reason " << reason); mobile_api::AppInterfaceUnregisteredReason::eType mob_reason = mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM; @@ -83,7 +83,7 @@ void OnExitAllApplicationsNotification::Run() { return; } default: { - LOGGER_ERROR(logger_, "Unknown Application close reason" << reason); + SDL_ERROR("Unknown Application close reason" << reason); return; } } @@ -103,7 +103,7 @@ void OnExitAllApplicationsNotification::Run() { } void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(smart_objects::SmartType_Map); diff --git a/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc index b9224f4bd9..b21487d6d0 100644 --- a/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc @@ -48,7 +48,7 @@ OnExitApplicationNotification::OnExitApplicationNotification( OnExitApplicationNotification::~OnExitApplicationNotification() {} void OnExitApplicationNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis; using namespace hmi_apis; @@ -57,7 +57,7 @@ void OnExitApplicationNotification::Run() { ApplicationSharedPtr app_impl = application_manager_.application(app_id); if (!(app_impl.valid())) { - LOGGER_ERROR(logger_, "Application does not exist"); + SDL_ERROR("Application does not exist"); return; } @@ -95,7 +95,7 @@ void OnExitApplicationNotification::Run() { return; } default: { - LOGGER_WARN(logger_, "Unhandled reason"); + SDL_WARN("Unhandled reason"); return; } } @@ -105,7 +105,7 @@ void OnExitApplicationNotification::Run() { application_manager_.state_controller().SetRegularState( app, HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE, false); } else { - LOGGER_ERROR(logger_, "Unable to find appication " << app_id); + SDL_ERROR("Unable to find appication " << app_id); } } diff --git a/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc b/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc index f4eb7dce34..0ea565373a 100644 --- a/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc @@ -43,7 +43,7 @@ OnFileRemovedNotification::OnFileRemovedNotification( OnFileRemovedNotification::~OnFileRemovedNotification() {} void OnFileRemovedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_find_applications.cc b/src/components/application_manager/src/commands/hmi/on_find_applications.cc index d69dd4c839..816997b16b 100644 --- a/src/components/application_manager/src/commands/hmi/on_find_applications.cc +++ b/src/components/application_manager/src/commands/hmi/on_find_applications.cc @@ -43,7 +43,7 @@ OnFindApplications::OnFindApplications(const MessageSharedPtr& message, OnFindApplications::~OnFindApplications() {} void OnFindApplications::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO(PV): add UpdateAppsOnDevice to ApplicationManager } diff --git a/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc b/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc index 2bfba6bbd6..f37ad31688 100644 --- a/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc @@ -44,7 +44,7 @@ OnIgnitionCycleOverNotification::OnIgnitionCycleOverNotification( OnIgnitionCycleOverNotification::~OnIgnitionCycleOverNotification() {} void OnIgnitionCycleOverNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.GetPolicyHandler().OnIgnitionCycleOver(); } diff --git a/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc b/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc index 5e30285a6d..8bfc2a5b9c 100644 --- a/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc @@ -44,7 +44,7 @@ OnNaviTBTClientStateNotification::OnNaviTBTClientStateNotification( OnNaviTBTClientStateNotification::~OnNaviTBTClientStateNotification() {} void OnNaviTBTClientStateNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc index 75d06b335f..2e3074fffc 100644 --- a/src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc @@ -43,7 +43,7 @@ OnNaviWayPointChangeNotification::OnNaviWayPointChangeNotification( OnNaviWayPointChangeNotification::~OnNaviWayPointChangeNotification() {} void OnNaviWayPointChangeNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_policy_update.cc b/src/components/application_manager/src/commands/hmi/on_policy_update.cc index 068cb45826..fc083c798e 100644 --- a/src/components/application_manager/src/commands/hmi/on_policy_update.cc +++ b/src/components/application_manager/src/commands/hmi/on_policy_update.cc @@ -43,7 +43,7 @@ OnPolicyUpdate::OnPolicyUpdate(const MessageSharedPtr& message, OnPolicyUpdate::~OnPolicyUpdate() {} void OnPolicyUpdate::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.GetPolicyHandler().OnPTExchangeNeeded(); } diff --git a/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc b/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc index 5fce25da7a..e6cb5c5eaa 100644 --- a/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc @@ -44,7 +44,7 @@ OnPutFileNotification::OnPutFileNotification( OnPutFileNotification::~OnPutFileNotification() {} void OnPutFileNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_ready_notification.cc b/src/components/application_manager/src/commands/hmi/on_ready_notification.cc index a9565995e2..b8bb0eed13 100644 --- a/src/components/application_manager/src/commands/hmi/on_ready_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_ready_notification.cc @@ -43,7 +43,7 @@ OnReadyNotification::OnReadyNotification( OnReadyNotification::~OnReadyNotification() {} void OnReadyNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.OnHMIStartedCooperation(); event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnReady); diff --git a/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc b/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc index 543e70f8e3..a73f9c6b1e 100644 --- a/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc +++ b/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc @@ -46,21 +46,21 @@ OnReceivedPolicyUpdate::OnReceivedPolicyUpdate( OnReceivedPolicyUpdate::~OnReceivedPolicyUpdate() {} void OnReceivedPolicyUpdate::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); #ifdef EXTENDED_POLICY const std::string& file_path = (*message_)[strings::msg_params][hmi_notification::policyfile].asString(); policy::BinaryMessage file_content; if (!file_system::ReadBinaryFile(file_path, file_content)) { - LOGGER_ERROR(logger_, "Failed to read Update file."); + SDL_ERROR("Failed to read Update file."); return; } application_manager_.GetPolicyHandler().ReceiveMessageFromSDK(file_path, file_content); #else - LOG4CXX_WARN(logger_, - "This RPC is part of extended policy flow." - "Please re-build with extended policy mode enabled."); + LOG4CXX_WARN( + "This RPC is part of extended policy flow." + "Please re-build with extended policy mode enabled."); #endif } diff --git a/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc b/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc index 173205416c..acfa31d5a6 100644 --- a/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc @@ -43,7 +43,7 @@ OnRecordStartdNotification::OnRecordStartdNotification( OnRecordStartdNotification::~OnRecordStartdNotification() {} void OnRecordStartdNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc b/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc index 08267e1593..f9b0e4d415 100644 --- a/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc @@ -44,7 +44,7 @@ OnResumeAudioSourceNotification::OnResumeAudioSourceNotification( OnResumeAudioSourceNotification::~OnResumeAudioSourceNotification() {} void OnResumeAudioSourceNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc b/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc index 029e84ef11..eb293484cd 100644 --- a/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc @@ -43,7 +43,7 @@ OnSDLCloseNotification::OnSDLCloseNotification( OnSDLCloseNotification::~OnSDLCloseNotification() {} void OnSDLCloseNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc b/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc index 79854dae6c..7b0b71fda1 100644 --- a/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc @@ -44,7 +44,7 @@ OnSDLConsentNeededNotification::OnSDLConsentNeededNotification( OnSDLConsentNeededNotification::~OnSDLConsentNeededNotification() {} void OnSDLConsentNeededNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc b/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc index e2c02577da..3bb10f1ff8 100644 --- a/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc @@ -43,7 +43,7 @@ OnSDLPersistenceCompleteNotification::OnSDLPersistenceCompleteNotification( OnSDLPersistenceCompleteNotification::~OnSDLPersistenceCompleteNotification() {} void OnSDLPersistenceCompleteNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc b/src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc index e8033b6523..6d7d8ad250 100644 --- a/src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc +++ b/src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc @@ -43,7 +43,7 @@ OnStartDeviceDiscovery::OnStartDeviceDiscovery( OnStartDeviceDiscovery::~OnStartDeviceDiscovery() {} void OnStartDeviceDiscovery::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.StartDevicesDiscovery(); } diff --git a/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc b/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc index 72e3d43f80..f56d4d7d64 100644 --- a/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc @@ -43,7 +43,7 @@ OnStatusUpdateNotification::OnStatusUpdateNotification( OnStatusUpdateNotification::~OnStatusUpdateNotification() {} void OnStatusUpdateNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc index 080f31568a..1604297941 100644 --- a/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc @@ -45,7 +45,7 @@ OnSystemContextNotification::OnSystemContextNotification( OnSystemContextNotification::~OnSystemContextNotification() {} void OnSystemContextNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); mobile_api::SystemContext::eType system_context = static_cast<mobile_api::SystemContext::eType>( @@ -69,7 +69,7 @@ void OnSystemContextNotification::Run() { application_manager_.state_controller().SetRegularState(app, system_context); } else { - LOGGER_ERROR(logger_, "Application does not exist"); + SDL_ERROR("Application does not exist"); } } diff --git a/src/components/application_manager/src/commands/hmi/on_system_error_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_error_notification.cc index 98d53f1012..9922ca9a44 100644 --- a/src/components/application_manager/src/commands/hmi/on_system_error_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_system_error_notification.cc @@ -45,7 +45,7 @@ OnSystemErrorNotification::OnSystemErrorNotification( OnSystemErrorNotification::~OnSystemErrorNotification() {} void OnSystemErrorNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const int code = (*message_)[strings::msg_params][hmi_notification::error].asInt(); diff --git a/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc index d3bb4981e7..c22b3eba87 100644 --- a/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc @@ -45,7 +45,7 @@ OnSystemInfoChangedNotification::OnSystemInfoChangedNotification( OnSystemInfoChangedNotification::~OnSystemInfoChangedNotification() {} void OnSystemInfoChangedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t lang_code = (*message_)[strings::msg_params][strings::language].asUInt(); const std::string language = diff --git a/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc index 3a43fddfce..3d82f5d55a 100644 --- a/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc @@ -49,7 +49,7 @@ OnSystemRequestNotification::OnSystemRequestNotification( OnSystemRequestNotification::~OnSystemRequestNotification() {} void OnSystemRequestNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& params = (*message_)[strings::params]; smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -63,33 +63,30 @@ void OnSystemRequestNotification::Run() { ApplicationSharedPtr app; if (msg_params.keyExists(strings::app_id)) { const uint32_t app_id = msg_params[strings::app_id].asUInt(); - LOGGER_DEBUG(logger_, "Received OnSystemRequest for appID " << app_id); - LOGGER_DEBUG(logger_, "Searching app to send OnSystemRequest by appID."); + SDL_DEBUG("Received OnSystemRequest for appID " << app_id); + SDL_DEBUG("Searching app to send OnSystemRequest by appID."); app = application_manager_.application(app_id); } else { - LOGGER_DEBUG(logger_, - "Received OnSystemRequest without appID." - " One of registered apps will be used."); - LOGGER_DEBUG(logger_, "Searching registered app to send OnSystemRequest."); + SDL_DEBUG( + "Received OnSystemRequest without appID." + " One of registered apps will be used."); + SDL_DEBUG("Searching registered app to send OnSystemRequest."); const PolicyHandlerInterface& policy_handler = application_manager_.GetPolicyHandler(); const uint32_t selected_app_id = policy_handler.GetAppIdForSending(); if (0 == selected_app_id) { - LOGGER_WARN(logger_, - "Can't select application to forward OnSystemRequest."); + SDL_WARN("Can't select application to forward OnSystemRequest."); return; } app = application_manager_.application(selected_app_id); } if (!app.valid()) { - LOGGER_WARN(logger_, - "No valid application found to forward OnSystemRequest."); + SDL_WARN("No valid application found to forward OnSystemRequest."); return; } - LOGGER_DEBUG(logger_, - "Sending request with application id " << app->policy_app_id()); + SDL_DEBUG("Sending request with application id " << app->policy_app_id()); params[strings::connection_key] = app->app_id(); SendNotificationToMobile(message_); diff --git a/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc index 17441f4383..95d1d14ec8 100644 --- a/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc @@ -47,7 +47,7 @@ OnTTSLanguageChangeNotification::OnTTSLanguageChangeNotification( OnTTSLanguageChangeNotification::~OnTTSLanguageChangeNotification() {} void OnTTSLanguageChangeNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); diff --git a/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc index 06aca0fabc..9bdfdab9aa 100644 --- a/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc @@ -15,7 +15,7 @@ OnTTSResetTimeoutNotification::OnTTSResetTimeoutNotification( OnTTSResetTimeoutNotification::~OnTTSResetTimeoutNotification() {} void OnTTSResetTimeoutNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_OnResetTimeout); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc index db47f2753c..7abebca4f6 100644 --- a/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc @@ -43,7 +43,7 @@ OnTTSStartedNotification::OnTTSStartedNotification( OnTTSStartedNotification::~OnTTSStartedNotification() {} void OnTTSStartedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_Started); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc index cd07d73882..d2f51a5d6f 100644 --- a/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc @@ -44,7 +44,7 @@ OnTTSStoppedNotification::OnTTSStoppedNotification( OnTTSStoppedNotification::~OnTTSStoppedNotification() {} void OnTTSStoppedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_Stopped); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc index 6a5b6d4af7..3140f5f56a 100644 --- a/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc @@ -44,7 +44,7 @@ OnUICommandNotification::OnUICommandNotification( OnUICommandNotification::~OnUICommandNotification() {} void OnUICommandNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::eType::OnCommandID); diff --git a/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc index 9632537c72..96049774a4 100644 --- a/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc @@ -46,7 +46,7 @@ OnUIKeyBoardInputNotification::OnUIKeyBoardInputNotification( OnUIKeyBoardInputNotification::~OnUIKeyBoardInputNotification() {} void OnUIKeyBoardInputNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc index 229c0952c0..4746c745d0 100644 --- a/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc @@ -47,7 +47,7 @@ OnUILanguageChangeNotification::OnUILanguageChangeNotification( OnUILanguageChangeNotification::~OnUILanguageChangeNotification() {} void OnUILanguageChangeNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); diff --git a/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc index b56d7da843..c5e6189733 100644 --- a/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc @@ -47,7 +47,7 @@ OnUIResetTimeoutNotification::OnUIResetTimeoutNotification( OnUIResetTimeoutNotification::~OnUIResetTimeoutNotification() {} void OnUIResetTimeoutNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_OnResetTimeout); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc index 9405d55135..3490d2b990 100644 --- a/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc @@ -46,7 +46,7 @@ OnUITouchEventNotification::OnUITouchEventNotification( OnUITouchEventNotification::~OnUITouchEventNotification() {} void OnUITouchEventNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_update_device_list.cc b/src/components/application_manager/src/commands/hmi/on_update_device_list.cc index 6fd2333c29..d4831a74bd 100644 --- a/src/components/application_manager/src/commands/hmi/on_update_device_list.cc +++ b/src/components/application_manager/src/commands/hmi/on_update_device_list.cc @@ -42,7 +42,7 @@ OnUpdateDeviceList::OnUpdateDeviceList(const MessageSharedPtr& message, OnUpdateDeviceList::~OnUpdateDeviceList() {} void OnUpdateDeviceList::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc index d9a362855b..04259a12c3 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc @@ -44,7 +44,7 @@ OnVIAccPedalPositionNotification::OnVIAccPedalPositionNotification( OnVIAccPedalPositionNotification::~OnVIAccPedalPositionNotification() {} void OnVIAccPedalPositionNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc index 903eaad6e8..85d4e09490 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc @@ -44,7 +44,7 @@ OnVIBeltStatusNotification::OnVIBeltStatusNotification( OnVIBeltStatusNotification::~OnVIBeltStatusNotification() {} void OnVIBeltStatusNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc index 359a3d2ac4..241a231e5c 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc @@ -44,7 +44,7 @@ OnVIBodyInformationNotification::OnVIBodyInformationNotification( OnVIBodyInformationNotification::~OnVIBodyInformationNotification() {} void OnVIBodyInformationNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc index df4991d1f6..6e48834e9c 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc @@ -44,7 +44,7 @@ OnVIDeviceStatusNotification::OnVIDeviceStatusNotification( OnVIDeviceStatusNotification::~OnVIDeviceStatusNotification() {} void OnVIDeviceStatusNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc index 083cec1c91..ee6bf9017f 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc @@ -44,7 +44,7 @@ OnVIDriverBrakingNotification::OnVIDriverBrakingNotification( OnVIDriverBrakingNotification::~OnVIDriverBrakingNotification() {} void OnVIDriverBrakingNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc index d28a5b5904..1b72b6aab2 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc @@ -44,7 +44,7 @@ OnVIEngineTorqueNotification::OnVIEngineTorqueNotification( OnVIEngineTorqueNotification::~OnVIEngineTorqueNotification() {} void OnVIEngineTorqueNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc index 23867d58cc..89c75445a3 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc @@ -44,7 +44,7 @@ OnVIExternalTemperatureNotification::OnVIExternalTemperatureNotification( OnVIExternalTemperatureNotification::~OnVIExternalTemperatureNotification() {} void OnVIExternalTemperatureNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc index 060ce07d97..ae04ab0b9b 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc @@ -44,7 +44,7 @@ OnVIFuelLevelNotification::OnVIFuelLevelNotification( OnVIFuelLevelNotification::~OnVIFuelLevelNotification() {} void OnVIFuelLevelNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc index c26c7b2e2e..fd5850f605 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc @@ -44,7 +44,7 @@ OnVIFuelLevelStateNotification::OnVIFuelLevelStateNotification( OnVIFuelLevelStateNotification::~OnVIFuelLevelStateNotification() {} void OnVIFuelLevelStateNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc index 144ac3c2b0..00781a7ffc 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc @@ -44,7 +44,7 @@ OnVIGpsDataNotification::OnVIGpsDataNotification( OnVIGpsDataNotification::~OnVIGpsDataNotification() {} void OnVIGpsDataNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc index 6087fe0a40..e0c1102a72 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc @@ -44,7 +44,7 @@ OnVIHeadLampStatusNotification::OnVIHeadLampStatusNotification( OnVIHeadLampStatusNotification::~OnVIHeadLampStatusNotification() {} void OnVIHeadLampStatusNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc index ffae182259..78cabe2328 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc @@ -45,7 +45,7 @@ OnVIInstantFuelConsumptionNotification:: ~OnVIInstantFuelConsumptionNotification() {} void OnVIInstantFuelConsumptionNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc index ea43216056..a061446564 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc @@ -44,7 +44,7 @@ OnVIMyKeyNotification::OnVIMyKeyNotification( OnVIMyKeyNotification::~OnVIMyKeyNotification() {} void OnVIMyKeyNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc index b0c122afdb..09d9d251e3 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc @@ -44,7 +44,7 @@ OnVIOdometerNotification::OnVIOdometerNotification( OnVIOdometerNotification::~OnVIOdometerNotification() {} void OnVIOdometerNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc index 67f90e360c..7e8b235150 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc @@ -44,7 +44,7 @@ OnVIPrndlNotification::OnVIPrndlNotification( OnVIPrndlNotification::~OnVIPrndlNotification() {} void OnVIPrndlNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc index ba88c97ee2..4da7632331 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc @@ -44,7 +44,7 @@ OnVIRpmNotification::OnVIRpmNotification( OnVIRpmNotification::~OnVIRpmNotification() {} void OnVIRpmNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc index d11688e7d1..6e668a5b29 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc @@ -44,7 +44,7 @@ OnVISpeedNotification::OnVISpeedNotification( OnVISpeedNotification::~OnVISpeedNotification() {} void OnVISpeedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc index fce5730995..ac4f471ae5 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc @@ -44,7 +44,7 @@ OnVISteeringWheelAngleNotification::OnVISteeringWheelAngleNotification( OnVISteeringWheelAngleNotification::~OnVISteeringWheelAngleNotification() {} void OnVISteeringWheelAngleNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc index 7c2a0aec15..29b234d32b 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc @@ -44,7 +44,7 @@ OnVITirePressureNotification::OnVITirePressureNotification( OnVITirePressureNotification::~OnVITirePressureNotification() {} void OnVITirePressureNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc index 9a52a3b3d7..f867ea9d2c 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc @@ -44,7 +44,7 @@ OnVIVehicleDataNotification::OnVIVehicleDataNotification( OnVIVehicleDataNotification::~OnVIVehicleDataNotification() {} void OnVIVehicleDataNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc index 7cc38491b6..2a1e9a63db 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc @@ -44,7 +44,7 @@ OnVIVinNotification::OnVIVinNotification( OnVIVinNotification::~OnVIVinNotification() {} void OnVIVinNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc index ddc91045a5..7e625876d0 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc @@ -44,7 +44,7 @@ OnVIWiperStatusNotification::OnVIWiperStatusNotification( OnVIWiperStatusNotification::~OnVIWiperStatusNotification() {} void OnVIWiperStatusNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc b/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc index 4d96899df5..630ca0f881 100644 --- a/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc @@ -44,7 +44,7 @@ OnVideoDataStreamingNotification::OnVideoDataStreamingNotification( OnVideoDataStreamingNotification::~OnVideoDataStreamingNotification() {} void OnVideoDataStreamingNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc index b7abaef9c4..471c693b6d 100644 --- a/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc @@ -49,21 +49,21 @@ OnVRCommandNotification::OnVRCommandNotification( OnVRCommandNotification::~OnVRCommandNotification() {} void OnVRCommandNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const uint32_t cmd_id = (*message_)[strings::msg_params][strings::cmd_id].asUInt(); uint32_t max_cmd_id = application_manager_.get_settings().max_cmd_id(); // Check if this is one of standart VR commands (i.e. "Help") if (cmd_id > max_cmd_id + 1) { - LOGGER_INFO(logger_, "Switched App"); + SDL_INFO("Switched App"); const uint32_t app_id = cmd_id - max_cmd_id; ApplicationSharedPtr app = application_manager_.application(app_id); if (app) { application_manager_.state_controller().SetRegularState( app, mobile_apis::HMILevel::HMI_FULL, true); } else { - LOGGER_ERROR(logger_, "Unable to find appication " << app_id); + SDL_ERROR("Unable to find appication " << app_id); } return; } @@ -76,7 +76,7 @@ void OnVRCommandNotification::Run() { (*message_)[strings::msg_params][strings::app_id].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } /* check if perform interaction is active diff --git a/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc index d06a912f52..c41808b20a 100644 --- a/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc @@ -48,7 +48,7 @@ OnVRLanguageChangeNotification::OnVRLanguageChangeNotification( OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {} void OnVRLanguageChangeNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); diff --git a/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc index 733dfc633d..71dc62021f 100644 --- a/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc @@ -43,7 +43,7 @@ OnVRStartedNotification::OnVRStartedNotification( OnVRStartedNotification::~OnVRStartedNotification() {} void OnVRStartedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_Started); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc index 4b636898b6..5d629254cd 100644 --- a/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc @@ -43,7 +43,7 @@ OnVRStoppedNotification::OnVRStoppedNotification( OnVRStoppedNotification::~OnVRStoppedNotification() {} void OnVRStoppedNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_Stopped); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc b/src/components/application_manager/src/commands/hmi/response_from_hmi.cc index 5f18d95efe..0dccd0cbf7 100644 --- a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/response_from_hmi.cc @@ -75,7 +75,7 @@ void ResponseFromHMI::CreateHMIRequest( smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; if (!result) { - LOGGER_ERROR(logger_, "Memory allocation failed."); + SDL_ERROR("Memory allocation failed."); return; } @@ -95,7 +95,7 @@ void ResponseFromHMI::CreateHMIRequest( request[strings::msg_params] = msg_params; if (!application_manager_.ManageHMICommand(result)) { - LOGGER_ERROR(logger_, "Unable to send request"); + SDL_ERROR("Unable to send request"); return; } } diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc index a08644322c..7240b3bde3 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc @@ -45,7 +45,7 @@ SDLActivateAppRequest::SDLActivateAppRequest( SDLActivateAppRequest::~SDLActivateAppRequest() {} void SDLActivateAppRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace hmi_apis::FunctionID; using namespace hmi_apis::Common_Result; @@ -55,24 +55,23 @@ void SDLActivateAppRequest::Run() { application_manager_.application(application_id); if (!app) { - LOGGER_INFO(logger_, "Can't find app_id in applications list"); - LOGGER_DEBUG(logger_, "Try find app_id in app_to_register list"); + SDL_INFO("Can't find app_id in applications list"); + SDL_DEBUG("Try find app_id in app_to_register list"); app = application_manager_.FindAppToRegister(application_id); } if (!app) { - LOGGER_ERROR(logger_, - "Can't find application in any lists within regular apps: " - << application_id); + SDL_ERROR("Can't find application in any lists within regular apps: " + << application_id); return; } DevicesApps devices_apps = FindAllAppOnParticularDevice(app->device()); if (!devices_apps.first && devices_apps.second.empty()) { - LOGGER_ERROR(logger_, - "Can't find regular foreground app with the same " - "connection id:" - << app->device()); + SDL_ERROR( + "Can't find regular foreground app with the same " + "connection id:" + << app->device()); SendResponse(false, correlation_id(), SDL_ActivateApp, NO_APPS_REGISTERED); return; } @@ -131,8 +130,7 @@ void SDLActivateAppRequest::on_event(const event_engine::Event& event) { ApplicationSharedPtr app = application_manager_.application_by_hmi_app(hmi_application_id); if (!app) { - LOGGER_ERROR(logger_, - "Application not found by HMI app id: " << hmi_application_id); + SDL_ERROR("Application not found by HMI app id: " << hmi_application_id); return; } application_manager_.GetPolicyHandler().OnActivateApp(app->app_id(), @@ -145,7 +143,7 @@ uint32_t SDLActivateAppRequest::app_id() const { return (*message_)[strings::msg_params][strings::app_id].asUInt(); } } - LOGGER_DEBUG(logger_, "app_id section is absent in the message."); + SDL_DEBUG("app_id section is absent in the message."); return 0; } @@ -160,7 +158,7 @@ uint32_t SDLActivateAppRequest::hmi_app_id( } } } - LOGGER_DEBUG(logger_, "Can't find app_id section is absent in the message."); + SDL_DEBUG("Can't find app_id section is absent in the message."); return 0; } diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc index ca9341a5d6..9636235b14 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc @@ -43,7 +43,7 @@ SDLActivateAppResponse::SDLActivateAppResponse( SDLActivateAppResponse::~SDLActivateAppResponse() {} void SDLActivateAppResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc b/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc index 36bfb2fd8c..189b98d3d7 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc @@ -44,7 +44,7 @@ SDLGetListOfPermissionsRequest::SDLGetListOfPermissionsRequest( SDLGetListOfPermissionsRequest::~SDLGetListOfPermissionsRequest() {} void SDLGetListOfPermissionsRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t connection_key = 0; if ((*message_)[strings::msg_params].keyExists(strings::app_id)) { connection_key = (*message_)[strings::msg_params][strings::app_id].asUInt(); diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc b/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc index d882ebabf1..35c0250dbf 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc @@ -43,7 +43,7 @@ SDLGetListOfPermissionsResponse::SDLGetListOfPermissionsResponse( SDLGetListOfPermissionsResponse::~SDLGetListOfPermissionsResponse() {} void SDLGetListOfPermissionsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc b/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc index e501c41e64..c93d3b1d57 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc @@ -44,7 +44,7 @@ SDLGetStatusUpdateRequest::SDLGetStatusUpdateRequest( SDLGetStatusUpdateRequest::~SDLGetStatusUpdateRequest() {} void SDLGetStatusUpdateRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.GetPolicyHandler().OnGetStatusUpdate( (*message_)[strings::params][strings::correlation_id].asUInt()); } diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc b/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc index 218f311ea2..07d0e0d87c 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc @@ -43,7 +43,7 @@ SDLGetStatusUpdateResponse::SDLGetStatusUpdateResponse( SDLGetStatusUpdateResponse::~SDLGetStatusUpdateResponse() {} void SDLGetStatusUpdateResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc b/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc index 68e3b4dfeb..4d1b563f07 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc @@ -44,11 +44,10 @@ SDLGetUserFriendlyMessageRequest::SDLGetUserFriendlyMessageRequest( SDLGetUserFriendlyMessageRequest::~SDLGetUserFriendlyMessageRequest() {} void SDLGetUserFriendlyMessageRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const std::string messageCodes = "messageCodes"; if (!(*message_)[strings::msg_params].keyExists(messageCodes)) { - LOGGER_WARN(logger_, - "Mandatory parameter '" + messageCodes + "'' is missing"); + SDL_WARN("Mandatory parameter '" + messageCodes + "'' is missing"); return; } smart_objects::SmartArray* msg = diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc b/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc index 667248f8e0..ba96af4488 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc @@ -43,7 +43,7 @@ SDLGetUserFriendlyMessageResponse::SDLGetUserFriendlyMessageResponse( SDLGetUserFriendlyMessageResponse::~SDLGetUserFriendlyMessageResponse() {} void SDLGetUserFriendlyMessageResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc b/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc index 1ef59000d9..30f066a3d0 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc @@ -43,13 +43,13 @@ SDLPolicyUpdate::SDLPolicyUpdate(const MessageSharedPtr& message, SDLPolicyUpdate::~SDLPolicyUpdate() {} void SDLPolicyUpdate::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); #ifdef EXTENDED_POLICY SendRequest(); #else - LOG4CXX_WARN(logger_, - "This RPC is part of extended policy flow." - "Please re-build with extended policy mode enabled."); + LOG4CXX_WARN( + "This RPC is part of extended policy flow." + "Please re-build with extended policy mode enabled."); #endif } diff --git a/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc b/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc index 0c09fd1b41..c2587fd549 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc @@ -42,7 +42,7 @@ SDLPolicyUpdateResponse::SDLPolicyUpdateResponse( SDLPolicyUpdateResponse::~SDLPolicyUpdateResponse() {} void SDLPolicyUpdateResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO(PV): add some logic here } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc b/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc index 88e666ca15..89d78a6bc5 100644 --- a/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc +++ b/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc @@ -43,7 +43,7 @@ TTSChangeRegistrationRequest::TTSChangeRegistrationRequest( TTSChangeRegistrationRequest::~TTSChangeRegistrationRequest() {} void TTSChangeRegistrationRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc b/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc index ebeab78363..248e8b923b 100644 --- a/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc +++ b/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc @@ -44,7 +44,7 @@ TTSChangeRegistratioResponse::TTSChangeRegistratioResponse( TTSChangeRegistratioResponse::~TTSChangeRegistratioResponse() {} void TTSChangeRegistratioResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_ChangeRegistration); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc index eb6e4d5766..e6df926d5d 100644 --- a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc +++ b/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc @@ -43,7 +43,7 @@ TTSGetCapabilitiesRequest::TTSGetCapabilitiesRequest( TTSGetCapabilitiesRequest::~TTSGetCapabilitiesRequest() {} void TTSGetCapabilitiesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc index 5015d0cd8d..39aa22ce57 100644 --- a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc +++ b/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc @@ -42,7 +42,7 @@ TTSGetCapabilitiesResponse::TTSGetCapabilitiesResponse( TTSGetCapabilitiesResponse::~TTSGetCapabilitiesResponse() {} void TTSGetCapabilitiesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); if ((*message_)[strings::msg_params].keyExists( diff --git a/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc b/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc index b5f98b1fc3..b8d4722077 100644 --- a/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc +++ b/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc @@ -43,7 +43,7 @@ TTSGetLanguageRequest::TTSGetLanguageRequest( TTSGetLanguageRequest::~TTSGetLanguageRequest() {} void TTSGetLanguageRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc b/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc index 9643ecb6e0..82b0ce0db4 100644 --- a/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc +++ b/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc @@ -43,7 +43,7 @@ TTSGetLanguageResponse::TTSGetLanguageResponse( TTSGetLanguageResponse::~TTSGetLanguageResponse() {} void TTSGetLanguageResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace hmi_apis; Common_Language::eType language = Common_Language::INVALID_ENUM; @@ -56,10 +56,8 @@ void TTSGetLanguageResponse::Run() { application_manager_.hmi_capabilities().set_active_tts_language(language); - LOGGER_DEBUG(logger_, - "Raising event for function_id " << function_id() - << " and correlation_id " - << correlation_id()); + SDL_DEBUG("Raising event for function_id " + << function_id() << " and correlation_id " << correlation_id()); event_engine::Event event(FunctionID::TTS_GetLanguage); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc b/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc index cf12d2b673..6edafcc636 100644 --- a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc +++ b/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc @@ -43,7 +43,7 @@ TTSGetSupportedLanguagesRequest::TTSGetSupportedLanguagesRequest( TTSGetSupportedLanguagesRequest::~TTSGetSupportedLanguagesRequest() {} void TTSGetSupportedLanguagesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc b/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc index f400c8801c..cd262daab0 100644 --- a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc +++ b/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc @@ -43,7 +43,7 @@ TTSGetSupportedLanguagesResponse::TTSGetSupportedLanguagesResponse( TTSGetSupportedLanguagesResponse::~TTSGetSupportedLanguagesResponse() {} void TTSGetSupportedLanguagesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( diff --git a/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc index 658f82b87d..dbc8b25d58 100644 --- a/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc +++ b/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc @@ -43,7 +43,7 @@ TTSIsReadyRequest::TTSIsReadyRequest(const MessageSharedPtr& message, TTSIsReadyRequest::~TTSIsReadyRequest() {} void TTSIsReadyRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc index 0ea54cb273..24ee0fa00b 100644 --- a/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc +++ b/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc @@ -42,7 +42,7 @@ TTSIsReadyResponse::TTSIsReadyResponse(const MessageSharedPtr& message, TTSIsReadyResponse::~TTSIsReadyResponse() {} void TTSIsReadyResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& object = *message_; bool is_available = false; diff --git a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc b/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc index a18c9e7a4b..035ed83703 100644 --- a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc +++ b/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc @@ -43,7 +43,7 @@ TTSSetGlobalPropertiesRequest::TTSSetGlobalPropertiesRequest( TTSSetGlobalPropertiesRequest::~TTSSetGlobalPropertiesRequest() {} void TTSSetGlobalPropertiesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc b/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc index 75c969e7d2..124736fe4f 100644 --- a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc +++ b/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc @@ -44,7 +44,7 @@ TTSSetGlobalPropertiesResponse::TTSSetGlobalPropertiesResponse( TTSSetGlobalPropertiesResponse::~TTSSetGlobalPropertiesResponse() {} void TTSSetGlobalPropertiesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/tts_speak_request.cc b/src/components/application_manager/src/commands/hmi/tts_speak_request.cc index 06e8171b33..c2dfba3951 100644 --- a/src/components/application_manager/src/commands/hmi/tts_speak_request.cc +++ b/src/components/application_manager/src/commands/hmi/tts_speak_request.cc @@ -43,7 +43,7 @@ TTSSpeakRequest::TTSSpeakRequest(const MessageSharedPtr& message, TTSSpeakRequest::~TTSSpeakRequest() {} void TTSSpeakRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/tts_speak_response.cc b/src/components/application_manager/src/commands/hmi/tts_speak_response.cc index fd6e86de17..fb2caec0bd 100644 --- a/src/components/application_manager/src/commands/hmi/tts_speak_response.cc +++ b/src/components/application_manager/src/commands/hmi/tts_speak_response.cc @@ -45,7 +45,7 @@ TTSSpeakResponse::TTSSpeakResponse(const MessageSharedPtr& message, TTSSpeakResponse::~TTSSpeakResponse() {} void TTSSpeakResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_Speak); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc b/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc index edb5d75574..0a634d4928 100644 --- a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc +++ b/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc @@ -43,7 +43,7 @@ TTSStopSpeakingRequest::TTSStopSpeakingRequest( TTSStopSpeakingRequest::~TTSStopSpeakingRequest() {} void TTSStopSpeakingRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc b/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc index 44efabc9d9..bad8d6a4bb 100644 --- a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc +++ b/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc @@ -44,7 +44,7 @@ TTSStopSpeakingResponse::TTSStopSpeakingResponse( TTSStopSpeakingResponse::~TTSStopSpeakingResponse() {} void TTSStopSpeakingResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_StopSpeaking); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc b/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc index 1869bd7f14..1ec07278c5 100644 --- a/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc @@ -43,7 +43,7 @@ UIAddCommandRequest::UIAddCommandRequest( UIAddCommandRequest::~UIAddCommandRequest() {} void UIAddCommandRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc b/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc index 02bfbdc978..a0af2f38d4 100644 --- a/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc @@ -44,7 +44,7 @@ UIAddCommandResponse::UIAddCommandResponse( UIAddCommandResponse::~UIAddCommandResponse() {} void UIAddCommandResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_AddCommand); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc b/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc index 81189ffd19..291df60971 100644 --- a/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc @@ -43,7 +43,7 @@ UIAddSubmenuRequest::UIAddSubmenuRequest( UIAddSubmenuRequest::~UIAddSubmenuRequest() {} void UIAddSubmenuRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc b/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc index 5aa3195f06..05dc50261b 100644 --- a/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc @@ -44,7 +44,7 @@ UIAddSubmenuResponse::UIAddSubmenuResponse( UIAddSubmenuResponse::~UIAddSubmenuResponse() {} void UIAddSubmenuResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_AddSubMenu); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_alert_request.cc b/src/components/application_manager/src/commands/hmi/ui_alert_request.cc index cd61ed39d5..a6d8cce686 100644 --- a/src/components/application_manager/src/commands/hmi/ui_alert_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_alert_request.cc @@ -43,7 +43,7 @@ UIAlertRequest::UIAlertRequest(const MessageSharedPtr& message, UIAlertRequest::~UIAlertRequest() {} void UIAlertRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_alert_response.cc b/src/components/application_manager/src/commands/hmi/ui_alert_response.cc index ae8bd07fed..421bb6f708 100644 --- a/src/components/application_manager/src/commands/hmi/ui_alert_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_alert_response.cc @@ -44,7 +44,7 @@ UIAlertResponse::UIAlertResponse(const MessageSharedPtr& message, UIAlertResponse::~UIAlertResponse() {} void UIAlertResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_Alert); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc b/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc index 262006e87a..ee3557f2c3 100644 --- a/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc @@ -43,7 +43,7 @@ UIChangeRegistrationRequest::UIChangeRegistrationRequest( UIChangeRegistrationRequest::~UIChangeRegistrationRequest() {} void UIChangeRegistrationRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc b/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc index 72dd27c768..f4cb89f5a5 100644 --- a/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc @@ -44,7 +44,7 @@ UIChangeRegistratioResponse::UIChangeRegistratioResponse( UIChangeRegistratioResponse::~UIChangeRegistratioResponse() {} void UIChangeRegistratioResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_ChangeRegistration); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc b/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc index 27da056ca1..cd65da6b72 100644 --- a/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc @@ -43,7 +43,7 @@ UIDeleteCommandRequest::UIDeleteCommandRequest( UIDeleteCommandRequest::~UIDeleteCommandRequest() {} void UIDeleteCommandRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc b/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc index 734d203874..2b6968599b 100644 --- a/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc @@ -44,7 +44,7 @@ UIDeleteCommandResponse::UIDeleteCommandResponse( UIDeleteCommandResponse::~UIDeleteCommandResponse() {} void UIDeleteCommandResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_DeleteCommand); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc b/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc index e5e4cf1ff3..a6a1cec5d5 100644 --- a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc @@ -43,7 +43,7 @@ UIDeleteSubmenuRequest::UIDeleteSubmenuRequest( UIDeleteSubmenuRequest::~UIDeleteSubmenuRequest() {} void UIDeleteSubmenuRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc b/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc index 31cf4069f9..950ff07ed7 100644 --- a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc @@ -44,7 +44,7 @@ UIDeleteSubmenuResponse::UIDeleteSubmenuResponse( UIDeleteSubmenuResponse::~UIDeleteSubmenuResponse() {} void UIDeleteSubmenuResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_DeleteSubMenu); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc index 41964c2a96..7a84ef6242 100644 --- a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc @@ -43,7 +43,7 @@ UIEndAudioPassThruRequest::UIEndAudioPassThruRequest( UIEndAudioPassThruRequest::~UIEndAudioPassThruRequest() {} void UIEndAudioPassThruRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc index ed4a6ca004..29357831c7 100644 --- a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc @@ -44,7 +44,7 @@ UIEndAudioPassThruResponse::UIEndAudioPassThruResponse( UIEndAudioPassThruResponse::~UIEndAudioPassThruResponse() {} void UIEndAudioPassThruResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_EndAudioPassThru); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc index 7ca6b6b583..0425f8eb16 100644 --- a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc @@ -43,7 +43,7 @@ UIGetCapabilitiesRequest::UIGetCapabilitiesRequest( UIGetCapabilitiesRequest::~UIGetCapabilitiesRequest() {} void UIGetCapabilitiesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc index d5d0a9e950..d5d9cf3c0f 100644 --- a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc @@ -42,7 +42,7 @@ UIGetCapabilitiesResponse::UIGetCapabilitiesResponse( UIGetCapabilitiesResponse::~UIGetCapabilitiesResponse() {} void UIGetCapabilitiesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); diff --git a/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc b/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc index 0459a33bf6..6a02685c17 100644 --- a/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc @@ -43,7 +43,7 @@ UIGetLanguageRequest::UIGetLanguageRequest( UIGetLanguageRequest::~UIGetLanguageRequest() {} void UIGetLanguageRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc index ec059db196..f65b27cc1e 100644 --- a/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc @@ -44,7 +44,7 @@ UIGetLanguageResponse::UIGetLanguageResponse( UIGetLanguageResponse::~UIGetLanguageResponse() {} void UIGetLanguageResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace hmi_apis; Common_Language::eType language = Common_Language::INVALID_ENUM; @@ -57,10 +57,8 @@ void UIGetLanguageResponse::Run() { application_manager_.hmi_capabilities().set_active_ui_language(language); - LOGGER_DEBUG(logger_, - "Raising event for function_id " << function_id() - << " and correlation_id " - << correlation_id()); + SDL_DEBUG("Raising event for function_id " + << function_id() << " and correlation_id " << correlation_id()); event_engine::Event event(FunctionID::UI_GetLanguage); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc b/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc index e223c42663..12af42863d 100644 --- a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc @@ -43,7 +43,7 @@ UIGetSupportedLanguagesRequest::UIGetSupportedLanguagesRequest( UIGetSupportedLanguagesRequest::~UIGetSupportedLanguagesRequest() {} void UIGetSupportedLanguagesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc index 5897801c0f..eadbebec19 100644 --- a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc @@ -43,7 +43,7 @@ UIGetSupportedLanguagesResponse::UIGetSupportedLanguagesResponse( UIGetSupportedLanguagesResponse::~UIGetSupportedLanguagesResponse() {} void UIGetSupportedLanguagesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( diff --git a/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc index acf3ec5df2..67a666d9de 100644 --- a/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc @@ -43,7 +43,7 @@ UIIsReadyRequest::UIIsReadyRequest(const MessageSharedPtr& message, UIIsReadyRequest::~UIIsReadyRequest() {} void UIIsReadyRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc index 0ea1a48ca1..1cc9bdfafb 100644 --- a/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc @@ -42,7 +42,7 @@ UIIsReadyResponse::UIIsReadyResponse(const MessageSharedPtr& message, UIIsReadyResponse::~UIIsReadyResponse() {} void UIIsReadyResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& object = *message_; bool is_available = false; diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc index bfd384d86f..b6b925747a 100644 --- a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc @@ -43,7 +43,7 @@ UIPerformAudioPassThruRequest::UIPerformAudioPassThruRequest( UIPerformAudioPassThruRequest::~UIPerformAudioPassThruRequest() {} void UIPerformAudioPassThruRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc index e6fc6d7c12..c53677adbf 100644 --- a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc @@ -44,7 +44,7 @@ UIPerformAudioPassThruResponse::UIPerformAudioPassThruResponse( UIPerformAudioPassThruResponse::~UIPerformAudioPassThruResponse() {} void UIPerformAudioPassThruResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc b/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc index bfda71db9e..6cfff642e3 100644 --- a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc @@ -43,7 +43,7 @@ UIPerformInteractionRequest::UIPerformInteractionRequest( UIPerformInteractionRequest::~UIPerformInteractionRequest() {} void UIPerformInteractionRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc b/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc index a9b2179d7f..3096ea89b7 100644 --- a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc @@ -44,7 +44,7 @@ UIPerformInteractionResponse::UIPerformInteractionResponse( UIPerformInteractionResponse::~UIPerformInteractionResponse() {} void UIPerformInteractionResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_PerformInteraction); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc b/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc index 642b69e31a..2bb71d6852 100644 --- a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc @@ -43,7 +43,7 @@ UIScrollableMessageRequest::UIScrollableMessageRequest( UIScrollableMessageRequest::~UIScrollableMessageRequest() {} void UIScrollableMessageRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc b/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc index 9ca1fe5a04..f6cbac93d8 100644 --- a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc @@ -44,7 +44,7 @@ UIScrollableMessageResponse::UIScrollableMessageResponse( UIScrollableMessageResponse::~UIScrollableMessageResponse() {} void UIScrollableMessageResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_ScrollableMessage); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc index c2bd1602a2..3f6edb4655 100644 --- a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc @@ -43,7 +43,7 @@ UISetAppIconRequest::UISetAppIconRequest( UISetAppIconRequest::~UISetAppIconRequest() {} void UISetAppIconRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc index 91a543665c..402743bd43 100644 --- a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc @@ -44,7 +44,7 @@ UISetAppIconResponse::UISetAppIconResponse( UISetAppIconResponse::~UISetAppIconResponse() {} void UISetAppIconResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_SetAppIcon); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc index 31c2b9e426..5171d31350 100644 --- a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc @@ -43,7 +43,7 @@ UiSetDisplayLayoutRequest::UiSetDisplayLayoutRequest( UiSetDisplayLayoutRequest::~UiSetDisplayLayoutRequest() {} void UiSetDisplayLayoutRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc index bb42f2197d..4c084105e6 100644 --- a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc @@ -45,7 +45,7 @@ UiSetDisplayLayoutResponse::UiSetDisplayLayoutResponse( UiSetDisplayLayoutResponse::~UiSetDisplayLayoutResponse() {} void UiSetDisplayLayoutResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc index 24413983e8..c3b4fa6f8e 100644 --- a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc @@ -43,7 +43,7 @@ UISetGlobalPropertiesRequest::UISetGlobalPropertiesRequest( UISetGlobalPropertiesRequest::~UISetGlobalPropertiesRequest() {} void UISetGlobalPropertiesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc index b2c320051c..9056f93d3a 100644 --- a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc @@ -44,7 +44,7 @@ UISetGlobalPropertiesResponse::UISetGlobalPropertiesResponse( UISetGlobalPropertiesResponse::~UISetGlobalPropertiesResponse() {} void UISetGlobalPropertiesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc index 357fbbdd98..98002ffe19 100644 --- a/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc @@ -43,7 +43,7 @@ UISetIconRequest::UISetIconRequest(const MessageSharedPtr& message, UISetIconRequest::~UISetIconRequest() {} void UISetIconRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc index ba68a828ff..b4c0e341b4 100644 --- a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc @@ -43,7 +43,7 @@ UISetMediaClockTimerRequest::UISetMediaClockTimerRequest( UISetMediaClockTimerRequest::~UISetMediaClockTimerRequest() {} void UISetMediaClockTimerRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc index d08bb9cd90..4744c00a80 100644 --- a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc @@ -44,7 +44,7 @@ UISetMediaClockTimerResponse::UISetMediaClockTimerResponse( UISetMediaClockTimerResponse::~UISetMediaClockTimerResponse() {} void UISetMediaClockTimerResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_show_request.cc b/src/components/application_manager/src/commands/hmi/ui_show_request.cc index e7d942ebb5..dd1cd54a21 100644 --- a/src/components/application_manager/src/commands/hmi/ui_show_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_show_request.cc @@ -43,7 +43,7 @@ UIShowRequest::UIShowRequest(const MessageSharedPtr& message, UIShowRequest::~UIShowRequest() {} void UIShowRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_show_response.cc b/src/components/application_manager/src/commands/hmi/ui_show_response.cc index fa83caaa58..0e7e03f561 100644 --- a/src/components/application_manager/src/commands/hmi/ui_show_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_show_response.cc @@ -43,7 +43,7 @@ UIShowResponse::UIShowResponse(const MessageSharedPtr& message, UIShowResponse::~UIShowResponse() {} void UIShowResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_Show); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/ui_slider_request.cc b/src/components/application_manager/src/commands/hmi/ui_slider_request.cc index 6add775915..7002ec38e7 100644 --- a/src/components/application_manager/src/commands/hmi/ui_slider_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_slider_request.cc @@ -43,7 +43,7 @@ UISliderRequest::UISliderRequest(const MessageSharedPtr& message, UISliderRequest::~UISliderRequest() {} void UISliderRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/ui_slider_response.cc b/src/components/application_manager/src/commands/hmi/ui_slider_response.cc index 3d33ed3424..b95b69984d 100644 --- a/src/components/application_manager/src/commands/hmi/ui_slider_response.cc +++ b/src/components/application_manager/src/commands/hmi/ui_slider_response.cc @@ -44,7 +44,7 @@ UISliderResponse::UISliderResponse(const MessageSharedPtr& message, UISliderResponse::~UISliderResponse() {} void UISliderResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_Slider); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/update_app_list_request.cc b/src/components/application_manager/src/commands/hmi/update_app_list_request.cc index 1224c5be0b..e437fb6379 100644 --- a/src/components/application_manager/src/commands/hmi/update_app_list_request.cc +++ b/src/components/application_manager/src/commands/hmi/update_app_list_request.cc @@ -43,7 +43,7 @@ UpdateAppListRequest::UpdateAppListRequest( UpdateAppListRequest::~UpdateAppListRequest() {} void UpdateAppListRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/update_app_list_response.cc b/src/components/application_manager/src/commands/hmi/update_app_list_response.cc index 9a8cd398d0..c52a149e8e 100644 --- a/src/components/application_manager/src/commands/hmi/update_app_list_response.cc +++ b/src/components/application_manager/src/commands/hmi/update_app_list_response.cc @@ -43,7 +43,7 @@ UpdateAppListResponse::UpdateAppListResponse( UpdateAppListResponse::~UpdateAppListResponse() {} void UpdateAppListResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO(PV): add check } diff --git a/src/components/application_manager/src/commands/hmi/update_device_list_request.cc b/src/components/application_manager/src/commands/hmi/update_device_list_request.cc index c3b5903689..29cd91f7db 100644 --- a/src/components/application_manager/src/commands/hmi/update_device_list_request.cc +++ b/src/components/application_manager/src/commands/hmi/update_device_list_request.cc @@ -45,7 +45,7 @@ UpdateDeviceListRequest::UpdateDeviceListRequest( UpdateDeviceListRequest::~UpdateDeviceListRequest() {} void UpdateDeviceListRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(wait_hmi_lock); // Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA. // Flag conditional compilation for specific customer is used in order to @@ -53,10 +53,10 @@ void UpdateDeviceListRequest::Run() { // hit code to RTC if (true == application_manager_.get_settings().launch_hmi()) { if (!application_manager_.IsHMICooperating()) { - LOGGER_INFO(logger_, "Wait for HMI Cooperation"); + SDL_INFO("Wait for HMI Cooperation"); subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnReady); termination_condition_.Wait(auto_lock); - LOGGER_DEBUG(logger_, "HMI Cooperation OK"); + SDL_DEBUG("HMI Cooperation OK"); } } @@ -64,17 +64,17 @@ void UpdateDeviceListRequest::Run() { } void UpdateDeviceListRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(wait_hmi_lock); switch (event.id()) { case hmi_apis::FunctionID::BasicCommunication_OnReady: { - LOGGER_INFO(logger_, "received OnReady"); + SDL_INFO("received OnReady"); unsubscribe_from_event(hmi_apis::FunctionID::BasicCommunication_OnReady); termination_condition_.Broadcast(); break; }; default: { - LOGGER_ERROR(logger_, "Unknown event "); + SDL_ERROR("Unknown event "); break; }; } diff --git a/src/components/application_manager/src/commands/hmi/update_device_list_response.cc b/src/components/application_manager/src/commands/hmi/update_device_list_response.cc index 47811d8a14..fdc83ed29b 100644 --- a/src/components/application_manager/src/commands/hmi/update_device_list_response.cc +++ b/src/components/application_manager/src/commands/hmi/update_device_list_response.cc @@ -42,7 +42,7 @@ UpdateDeviceListResponse::UpdateDeviceListResponse( UpdateDeviceListResponse::~UpdateDeviceListResponse() {} void UpdateDeviceListResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO(PV): add check for correctness. } diff --git a/src/components/application_manager/src/commands/hmi/update_sdl_request.cc b/src/components/application_manager/src/commands/hmi/update_sdl_request.cc index ad643b4ad5..043d6193e1 100644 --- a/src/components/application_manager/src/commands/hmi/update_sdl_request.cc +++ b/src/components/application_manager/src/commands/hmi/update_sdl_request.cc @@ -44,7 +44,7 @@ UpdateSDLRequest::UpdateSDLRequest(const MessageSharedPtr& message, UpdateSDLRequest::~UpdateSDLRequest() {} void UpdateSDLRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.GetPolicyHandler().PTExchangeAtUserRequest( (*message_)[strings::params][strings::correlation_id].asInt()); diff --git a/src/components/application_manager/src/commands/hmi/update_sdl_response.cc b/src/components/application_manager/src/commands/hmi/update_sdl_response.cc index 83cc936c6c..279af94a7e 100644 --- a/src/components/application_manager/src/commands/hmi/update_sdl_response.cc +++ b/src/components/application_manager/src/commands/hmi/update_sdl_response.cc @@ -42,7 +42,7 @@ UpdateSDLResponse::UpdateSDLResponse(const MessageSharedPtr& message, UpdateSDLResponse::~UpdateSDLResponse() {} void UpdateSDLResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc b/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc index 37023c3179..36bf0b746b 100644 --- a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc +++ b/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc @@ -43,7 +43,7 @@ VIDiagnosticMessageRequest::VIDiagnosticMessageRequest( VIDiagnosticMessageRequest::~VIDiagnosticMessageRequest() {} void VIDiagnosticMessageRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc b/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc index 9dced0f41f..232865f595 100644 --- a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc +++ b/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc @@ -44,7 +44,7 @@ VIDiagnosticMessageResponse::VIDiagnosticMessageResponse( VIDiagnosticMessageResponse::~VIDiagnosticMessageResponse() {} void VIDiagnosticMessageResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage); diff --git a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc b/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc index 21ebcbe6d1..aa96750586 100644 --- a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc +++ b/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc @@ -43,7 +43,7 @@ VIGetDTCsRequest::VIGetDTCsRequest(const MessageSharedPtr& message, VIGetDTCsRequest::~VIGetDTCsRequest() {} void VIGetDTCsRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc b/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc index 4e1250f763..fc9fc0d708 100644 --- a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc +++ b/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc @@ -44,7 +44,7 @@ VIGetDTCsResponse::VIGetDTCsResponse(const MessageSharedPtr& message, VIGetDTCsResponse::~VIGetDTCsResponse() {} void VIGetDTCsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetDTCs); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc index 398654c48c..0fa4543f03 100644 --- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc @@ -43,7 +43,7 @@ VIGetVehicleDataRequest::VIGetVehicleDataRequest( VIGetVehicleDataRequest::~VIGetVehicleDataRequest() {} void VIGetVehicleDataRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc index 75edea657e..8bc0850028 100644 --- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc @@ -43,7 +43,7 @@ VIGetVehicleDataResponse::VIGetVehicleDataResponse( VIGetVehicleDataResponse::~VIGetVehicleDataResponse() {} void VIGetVehicleDataResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData); diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc index e0cf0d0ab3..efcc041297 100644 --- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc +++ b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc @@ -43,7 +43,7 @@ VIGetVehicleTypeRequest::VIGetVehicleTypeRequest( VIGetVehicleTypeRequest::~VIGetVehicleTypeRequest() {} void VIGetVehicleTypeRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc index 1b1b502013..b689686a2d 100644 --- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc +++ b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc @@ -42,7 +42,7 @@ VIGetVehicleTypeResponse::VIGetVehicleTypeResponse( VIGetVehicleTypeResponse::~VIGetVehicleTypeResponse() {} void VIGetVehicleTypeResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); diff --git a/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc index 12cb33cd0e..68d51ef509 100644 --- a/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc +++ b/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc @@ -43,7 +43,7 @@ VIIsReadyRequest::VIIsReadyRequest(const MessageSharedPtr& message, VIIsReadyRequest::~VIIsReadyRequest() {} void VIIsReadyRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc index 3731129d26..0fa4904f11 100644 --- a/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc +++ b/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc @@ -42,7 +42,7 @@ VIIsReadyResponse::VIIsReadyResponse(const MessageSharedPtr& message, VIIsReadyResponse::~VIIsReadyResponse() {} void VIIsReadyResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& object = *message_; bool is_available = false; diff --git a/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc b/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc index aced2e4492..e8d7089a8d 100644 --- a/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc +++ b/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc @@ -43,7 +43,7 @@ VIReadDIDRequest::VIReadDIDRequest(const MessageSharedPtr& message, VIReadDIDRequest::~VIReadDIDRequest() {} void VIReadDIDRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc b/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc index f7040268a1..c305235d21 100644 --- a/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc +++ b/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc @@ -43,7 +43,7 @@ VIReadDIDResponse::VIReadDIDResponse(const MessageSharedPtr& message, VIReadDIDResponse::~VIReadDIDResponse() {} void VIReadDIDResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_ReadDID); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc index ab3c35a016..118aa34dd9 100644 --- a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc @@ -43,7 +43,7 @@ VISubscribeVehicleDataRequest::VISubscribeVehicleDataRequest( VISubscribeVehicleDataRequest::~VISubscribeVehicleDataRequest() {} void VISubscribeVehicleDataRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc index 2dced1b78c..ce9b4257f9 100644 --- a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc @@ -43,7 +43,7 @@ VISubscribeVehicleDataResponse::VISubscribeVehicleDataResponse( VISubscribeVehicleDataResponse::~VISubscribeVehicleDataResponse() {} void VISubscribeVehicleDataResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc index 2925cbf290..09d6363cce 100644 --- a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc @@ -43,7 +43,7 @@ VIUnsubscribeVehicleDataRequest::VIUnsubscribeVehicleDataRequest( VIUnsubscribeVehicleDataRequest::~VIUnsubscribeVehicleDataRequest() {} void VIUnsubscribeVehicleDataRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc index 14c1795afb..ab1672736c 100644 --- a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc @@ -43,7 +43,7 @@ VIUnsubscribeVehicleDataResponse::VIUnsubscribeVehicleDataResponse( VIUnsubscribeVehicleDataResponse::~VIUnsubscribeVehicleDataResponse() {} void VIUnsubscribeVehicleDataResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc b/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc index cdee0108ca..6e052485a7 100644 --- a/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc +++ b/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc @@ -43,7 +43,7 @@ VRAddCommandRequest::VRAddCommandRequest( VRAddCommandRequest::~VRAddCommandRequest() {} void VRAddCommandRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc b/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc index 8a0afaf44d..b2a05f45e2 100644 --- a/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc +++ b/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc @@ -44,7 +44,7 @@ VRAddCommandResponse::VRAddCommandResponse( VRAddCommandResponse::~VRAddCommandResponse() {} void VRAddCommandResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_AddCommand); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc b/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc index b9ee93222b..fe62fd6214 100644 --- a/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc +++ b/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc @@ -43,7 +43,7 @@ VRChangeRegistrationRequest::VRChangeRegistrationRequest( VRChangeRegistrationRequest::~VRChangeRegistrationRequest() {} void VRChangeRegistrationRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc b/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc index 0cf0576e32..3e80b01e60 100644 --- a/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc +++ b/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc @@ -44,7 +44,7 @@ VRChangeRegistrationResponse::VRChangeRegistrationResponse( VRChangeRegistrationResponse::~VRChangeRegistrationResponse() {} void VRChangeRegistrationResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_ChangeRegistration); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc b/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc index 5749cfbe77..58d84ff0c7 100644 --- a/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc +++ b/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc @@ -43,7 +43,7 @@ VRDeleteCommandRequest::VRDeleteCommandRequest( VRDeleteCommandRequest::~VRDeleteCommandRequest() {} void VRDeleteCommandRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc b/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc index 6591b3bbde..ca339909b1 100644 --- a/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc +++ b/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc @@ -44,7 +44,7 @@ VRDeleteCommandResponse::VRDeleteCommandResponse( VRDeleteCommandResponse::~VRDeleteCommandResponse() {} void VRDeleteCommandResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_DeleteCommand); event.set_smart_object(*message_); diff --git a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc index 5e1dac0c95..2692f78e7c 100644 --- a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc +++ b/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc @@ -43,7 +43,7 @@ VRGetCapabilitiesRequest::VRGetCapabilitiesRequest( VRGetCapabilitiesRequest::~VRGetCapabilitiesRequest() {} void VRGetCapabilitiesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc index ba25c12528..4a246c8934 100644 --- a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc +++ b/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc @@ -42,7 +42,7 @@ VRGetCapabilitiesResponse::VRGetCapabilitiesResponse( VRGetCapabilitiesResponse::~VRGetCapabilitiesResponse() {} void VRGetCapabilitiesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); diff --git a/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc b/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc index 8a767fba5a..45823bf23c 100644 --- a/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc +++ b/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc @@ -43,7 +43,7 @@ VRGetLanguageRequest::VRGetLanguageRequest( VRGetLanguageRequest::~VRGetLanguageRequest() {} void VRGetLanguageRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc b/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc index 9e85027308..6e1ac34f77 100644 --- a/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc +++ b/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc @@ -44,7 +44,7 @@ VRGetLanguageResponse::VRGetLanguageResponse( VRGetLanguageResponse::~VRGetLanguageResponse() {} void VRGetLanguageResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace hmi_apis; Common_Language::eType language = Common_Language::INVALID_ENUM; @@ -57,10 +57,8 @@ void VRGetLanguageResponse::Run() { application_manager_.hmi_capabilities().set_active_vr_language(language); - LOGGER_DEBUG(logger_, - "Raising event for function_id " << function_id() - << " and correlation_id " - << correlation_id()); + SDL_DEBUG("Raising event for function_id " + << function_id() << " and correlation_id " << correlation_id()); event_engine::Event event(FunctionID::VR_GetLanguage); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc b/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc index 57c3913dfe..777b1934c2 100644 --- a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc +++ b/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc @@ -43,7 +43,7 @@ VRGetSupportedLanguagesRequest::VRGetSupportedLanguagesRequest( VRGetSupportedLanguagesRequest::~VRGetSupportedLanguagesRequest() {} void VRGetSupportedLanguagesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc b/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc index e52dedea12..dc48374523 100644 --- a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc +++ b/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc @@ -44,7 +44,7 @@ VRGetSupportedLanguagesResponse::VRGetSupportedLanguagesResponse( VRGetSupportedLanguagesResponse::~VRGetSupportedLanguagesResponse() {} void VRGetSupportedLanguagesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( diff --git a/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc index 52857453f0..e84165d579 100644 --- a/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc +++ b/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc @@ -43,7 +43,7 @@ VRIsReadyRequest::VRIsReadyRequest(const MessageSharedPtr& message, VRIsReadyRequest::~VRIsReadyRequest() {} void VRIsReadyRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc index 757e143386..c8ca2fc709 100644 --- a/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc +++ b/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc @@ -42,7 +42,7 @@ VRIsReadyResponse::VRIsReadyResponse(const MessageSharedPtr& message, VRIsReadyResponse::~VRIsReadyResponse() {} void VRIsReadyResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& object = *message_; bool is_available = false; diff --git a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc b/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc index 4581d8eb01..6593152d3e 100644 --- a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc +++ b/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc @@ -43,7 +43,7 @@ VRPerformInteractionRequest::VRPerformInteractionRequest( VRPerformInteractionRequest::~VRPerformInteractionRequest() {} void VRPerformInteractionRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc b/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc index 0e3d7b4a90..598c6a4b9b 100644 --- a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc +++ b/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc @@ -43,7 +43,7 @@ VRPerformInteractionResponse::VRPerformInteractionResponse( VRPerformInteractionResponse::~VRPerformInteractionResponse() {} void VRPerformInteractionResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_PerformInteraction); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc index 881acc0595..4c2bc76fa7 100644 --- a/src/components/application_manager/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_command_request.cc @@ -58,19 +58,19 @@ AddCommandRequest::AddCommandRequest(const MessageSharedPtr& message, AddCommandRequest::~AddCommandRequest() {} void AddCommandRequest::onTimeOut() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); RemoveCommand(); CommandRequestImpl::onTimeOut(); } void AddCommandRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { - LOGGER_ERROR(logger_, "No application associated with session key"); + SDL_ERROR("No application associated with session key"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -82,22 +82,21 @@ void AddCommandRequest::Run() { application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { - LOGGER_ERROR(logger_, - "MessageHelper::VerifyImage return " << verification_result); + SDL_ERROR("MessageHelper::VerifyImage return " << verification_result); SendResponse(false, verification_result); return; } } if (!((*message_)[strings::msg_params].keyExists(strings::cmd_id))) { - LOGGER_ERROR(logger_, "INVALID_DATA"); + SDL_ERROR("INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } if (app->FindCommand( (*message_)[strings::msg_params][strings::cmd_id].asUInt())) { - LOGGER_ERROR(logger_, "INVALID_ID"); + SDL_ERROR("INVALID_ID"); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -134,13 +133,13 @@ void AddCommandRequest::Run() { } if (!data_exist) { - LOGGER_ERROR(logger_, "INVALID_DATA"); + SDL_ERROR("INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } if (IsWhiteSpaceExist()) { - LOGGER_ERROR(logger_, "Incoming add command has contains \t\n \\t \\n"); + SDL_ERROR("Incoming add command has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -224,9 +223,9 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) { (*message_)[strings::msg_params][strings::menu_params] [strings::menu_name].asString()) && (saved_parent_id == parent_id)) { - LOGGER_INFO(logger_, - "AddCommandRequest::CheckCommandName received" - " command name already exist in same level menu"); + SDL_INFO( + "AddCommandRequest::CheckCommandName received" + " command name already exist in same level menu"); return false; } } @@ -258,9 +257,9 @@ bool AddCommandRequest::CheckCommandVRSynonym(ApplicationConstSharedPtr app) { .asCustomString(); if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) { - LOGGER_INFO(logger_, - "AddCommandRequest::CheckCommandVRSynonym" - " received command vr synonym already exist"); + SDL_INFO( + "AddCommandRequest::CheckCommandVRSynonym" + " received command vr synonym already exist"); return false; } } @@ -280,16 +279,16 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) { smart_objects::SmartObject* parent = app->FindSubMenu(parent_id); if (!parent) { - LOGGER_INFO(logger_, - "AddCommandRequest::CheckCommandParentId received" - " submenu doesn't exist"); + SDL_INFO( + "AddCommandRequest::CheckCommandParentId received" + " submenu doesn't exist"); return false; } return true; } void AddCommandRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -298,7 +297,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -309,7 +308,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_AddCommand: { - LOGGER_INFO(logger_, "Received UI_AddCommand event"); + SDL_INFO("Received UI_AddCommand event"); is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -320,7 +319,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::VR_AddCommand: { - LOGGER_INFO(logger_, "Received VR_AddCommand event"); + SDL_INFO("Received VR_AddCommand event"); is_vr_received_ = true; vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -331,7 +330,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } @@ -437,14 +436,14 @@ bool AddCommandRequest::IsPendingResponseExist() { } bool AddCommandRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { str = (*message_)[strings::msg_params][strings::menu_params] [strings::menu_name].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid menu name syntax check failed."); + SDL_ERROR("Invalid menu name syntax check failed."); return true; } } @@ -457,7 +456,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::vr_commands][i] .asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid vr_commands syntax check failed"); + SDL_ERROR("Invalid vr_commands syntax check failed"); return true; } } @@ -467,7 +466,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::cmd_icon][strings::value] .asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid cmd_icon value syntax check failed"); + SDL_ERROR("Invalid cmd_icon value syntax check failed"); return true; } } @@ -479,10 +478,10 @@ bool AddCommandRequest::BothSend() const { } void AddCommandRequest::RemoveCommand() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app.valid()) { - LOGGER_ERROR(logger_, "No application associated with session key"); + SDL_ERROR("No application associated with session key"); return; } diff --git a/src/components/application_manager/src/commands/mobile/add_command_response.cc b/src/components/application_manager/src/commands/mobile/add_command_response.cc index 7795f1c01f..57b1987dd5 100644 --- a/src/components/application_manager/src/commands/mobile/add_command_response.cc +++ b/src/components/application_manager/src/commands/mobile/add_command_response.cc @@ -44,7 +44,7 @@ AddCommandResponse::AddCommandResponse(const MessageSharedPtr& message, AddCommandResponse::~AddCommandResponse() {} void AddCommandResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc index cda1c8cb85..ed64716d37 100644 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc @@ -47,12 +47,12 @@ AddSubMenuRequest::AddSubMenuRequest(const MessageSharedPtr& message, AddSubMenuRequest::~AddSubMenuRequest() {} void AddSubMenuRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -60,7 +60,7 @@ void AddSubMenuRequest::Run() { const int32_t menu_id = (*message_)[strings::msg_params][strings::menu_id].asInt(); if (app->FindSubMenu(menu_id)) { - LOGGER_ERROR(logger_, "Menu with id " << menu_id << " is not found."); + SDL_ERROR("Menu with id " << menu_id << " is not found."); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -69,13 +69,13 @@ void AddSubMenuRequest::Run() { (*message_)[strings::msg_params][strings::menu_name].asString(); if (app->IsSubMenuNameAlreadyExist(menu_name)) { - LOGGER_ERROR(logger_, "Menu name " << menu_name << " is duplicated."); + SDL_ERROR("Menu name " << menu_name << " is duplicated."); SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); return; } if (!CheckSubMenuName()) { - LOGGER_ERROR(logger_, "Sub-menu name is not valid."); + SDL_ERROR("Sub-menu name is not valid."); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -97,7 +97,7 @@ void AddSubMenuRequest::Run() { } void AddSubMenuRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -116,7 +116,7 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -132,19 +132,19 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } } bool AddSubMenuRequest::CheckSubMenuName() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; str = (*message_)[strings::msg_params][strings::menu_name].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_INFO(logger_, "Invalid subMenu name."); + SDL_INFO("Invalid subMenu name."); return false; } return true; diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc index b9860f8cf9..44265f1fa0 100644 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc +++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc @@ -45,7 +45,7 @@ AddSubMenuResponse::AddSubMenuResponse(const MessageSharedPtr& message, AddSubMenuResponse::~AddSubMenuResponse() {} void AddSubMenuResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc index ee57084e9f..c8c7917f02 100644 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc @@ -53,11 +53,11 @@ AlertManeuverRequest::AlertManeuverRequest( AlertManeuverRequest::~AlertManeuverRequest() {} void AlertManeuverRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if ((!(*message_)[strings::msg_params].keyExists(strings::soft_buttons)) && (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks))) { - LOGGER_ERROR(logger_, "AlertManeuverRequest::Request without parameters!"); + SDL_ERROR("AlertManeuverRequest::Request without parameters!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -66,15 +66,15 @@ void AlertManeuverRequest::Run() { (*message_)[strings::params][strings::connection_key].asUInt()); if (NULL == app.get()) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if (IsWhiteSpaceExist()) { - LOGGER_ERROR(logger_, - "Incoming alert maneuver has contains \\t\\n \\\\t \\\\n" - "text contains only whitespace in ttsChunks"); + SDL_ERROR( + "Incoming alert maneuver has contains \\t\\n \\\\t \\\\n" + "text contains only whitespace in ttsChunks"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -88,7 +88,7 @@ void AlertManeuverRequest::Run() { application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOGGER_ERROR(logger_, "Wrong soft buttons parameters!"); + SDL_ERROR("Wrong soft buttons parameters!"); SendResponse(false, processing_result); return; } @@ -134,7 +134,7 @@ void AlertManeuverRequest::Run() { } void AlertManeuverRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); bool is_tts_ok; @@ -144,7 +144,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { hmi_apis::FunctionID::eType event_id = event.id(); switch (event_id) { case hmi_apis::FunctionID::Navigation_AlertManeuver: { - LOGGER_INFO(logger_, "Received Navigation_AlertManeuver event"); + SDL_INFO("Received Navigation_AlertManeuver event"); pending_requests_.Remove(event_id); @@ -170,7 +170,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_Speak: { - LOGGER_INFO(logger_, "Received TTS_Speak event"); + SDL_INFO("Received TTS_Speak event"); pending_requests_.Remove(event_id); @@ -198,14 +198,14 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_OnResetTimeout: { - LOGGER_INFO(logger_, "Received TTS_OnResetTimeout event"); + SDL_INFO("Received TTS_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); SendResponse( false, mobile_apis::Result::INVALID_ENUM, "Received unknown event"); return; @@ -213,9 +213,9 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { } if (!pending_requests_.IsFinal(event_id)) { - LOGGER_DEBUG(logger_, - "There are some pending responses from HMI." - "AlertManeuverRequest still waiting."); + SDL_DEBUG( + "There are some pending responses from HMI." + "AlertManeuverRequest still waiting."); return; } @@ -256,7 +256,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { } bool AlertManeuverRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) { @@ -269,7 +269,7 @@ bool AlertManeuverRequest::IsWhiteSpaceExist() { for (; it_tc != it_tc_end; ++it_tc) { str = (*it_tc)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid tts_chunks syntax check failed"); + SDL_ERROR("Invalid tts_chunks syntax check failed"); return true; } } diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc index 5739e8d8d7..f9081fdf8c 100644 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc +++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc @@ -45,7 +45,7 @@ AlertManeuverResponse::AlertManeuverResponse( AlertManeuverResponse::~AlertManeuverResponse() {} void AlertManeuverResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/alert_request.cc b/src/components/application_manager/src/commands/mobile/alert_request.cc index e6badefa24..b388ea4072 100644 --- a/src/components/application_manager/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_request.cc @@ -76,9 +76,9 @@ bool AlertRequest::Init() { // If soft buttons are present, SDL will not use initiate timeout tracking for // response. if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - LOGGER_INFO(logger_, - "Request contains soft buttons - request timeout " - "will be set to 0."); + SDL_INFO( + "Request contains soft buttons - request timeout " + "will be set to 0."); default_timeout_ = 0; } @@ -86,7 +86,7 @@ bool AlertRequest::Init() { } void AlertRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asInt(); @@ -117,19 +117,19 @@ void AlertRequest::Run() { } void AlertRequest::onTimeOut() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (false == (*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { CommandRequestImpl::onTimeOut(); return; } - LOGGER_INFO(logger_, - "Default timeout ignored. " - "AlertRequest with soft buttons wait timeout on HMI side"); + SDL_INFO( + "Default timeout ignored. " + "AlertRequest with soft buttons wait timeout on HMI side"); } void AlertRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -137,18 +137,18 @@ void AlertRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::TTS_OnResetTimeout: case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOGGER_INFO(logger_, - "Received UI_OnResetTimeout event " - " or TTS_OnResetTimeout event" - << awaiting_tts_speak_response_ << " " - << awaiting_tts_stop_speaking_response_ << " " - << awaiting_ui_alert_response_); + SDL_INFO( + "Received UI_OnResetTimeout event " + " or TTS_OnResetTimeout event" + << awaiting_tts_speak_response_ << " " + << awaiting_tts_stop_speaking_response_ << " " + << awaiting_ui_alert_response_); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::UI_Alert: { - LOGGER_INFO(logger_, "Received UI_Alert event"); + SDL_INFO("Received UI_Alert event"); // Unsubscribe from event to avoid unwanted messages unsubscribe_from_event(hmi_apis::FunctionID::UI_Alert); awaiting_ui_alert_response_ = false; @@ -175,7 +175,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_Speak: { - LOGGER_INFO(logger_, "Received TTS_Speak event"); + SDL_INFO("Received TTS_Speak event"); // Unsubscribe from event to avoid unwanted messages unsubscribe_from_event(hmi_apis::FunctionID::TTS_Speak); awaiting_tts_speak_response_ = false; @@ -184,14 +184,14 @@ void AlertRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_StopSpeaking: { - LOGGER_INFO(logger_, "Received TTS_StopSpeaking event"); + SDL_INFO("Received TTS_StopSpeaking event"); // Unsubscribe from event to avoid unwanted messages unsubscribe_from_event(hmi_apis::FunctionID::TTS_StopSpeaking); awaiting_tts_stop_speaking_response_ = false; break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } @@ -252,11 +252,11 @@ void AlertRequest::on_event(const event_engine::Event& event) { } bool AlertRequest::Validate(uint32_t app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOGGER_ERROR(logger_, "No application associated with session key"); + SDL_ERROR("No application associated with session key"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } @@ -265,7 +265,7 @@ bool AlertRequest::Validate(uint32_t app_id) { app->IsCommandLimitsExceeded( static_cast<mobile_apis::FunctionID::eType>(function_id()), application_manager::TLimitSource::POLICY_TABLE)) { - LOGGER_ERROR(logger_, "Alert frequency is too high."); + SDL_ERROR("Alert frequency is too high."); SendResponse(false, mobile_apis::Result::REJECTED); return false; } @@ -284,7 +284,7 @@ bool AlertRequest::Validate(uint32_t app_id) { application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOGGER_ERROR(logger_, "INVALID_DATA!"); + SDL_ERROR("INVALID_DATA!"); SendResponse(false, processing_result); return false; } @@ -294,7 +294,7 @@ bool AlertRequest::Validate(uint32_t app_id) { (!(*message_)[strings::msg_params].keyExists(strings::alert_text2)) && (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks) && (1 > (*message_)[strings::msg_params][strings::tts_chunks].length()))) { - LOGGER_ERROR(logger_, "Mandatory parameters are missing"); + SDL_ERROR("Mandatory parameters are missing"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Mandatory parameters are missing"); @@ -305,7 +305,7 @@ bool AlertRequest::Validate(uint32_t app_id) { } void AlertRequest::SendAlertRequest(int32_t app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(app_id); smart_objects::SmartObject msg_params = @@ -371,7 +371,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) { void AlertRequest::SendSpeakRequest(int32_t app_id, bool tts_chunks_exists, size_t length_tts_chunks) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace hmi_apis; using namespace smart_objects; // crate HMI speak request @@ -392,13 +392,13 @@ void AlertRequest::SendSpeakRequest(int32_t app_id, } bool AlertRequest::CheckStringsOfAlertRequest() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) { str = (*message_)[strings::msg_params][strings::alert_text1].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid alert_text_1 syntax check failed"); + SDL_ERROR("Invalid alert_text_1 syntax check failed"); return false; } } @@ -406,7 +406,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() { if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) { str = (*message_)[strings::msg_params][strings::alert_text2].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid alert_text_2 syntax check failed"); + SDL_ERROR("Invalid alert_text_2 syntax check failed"); return false; } } @@ -414,7 +414,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() { if ((*message_)[strings::msg_params].keyExists(strings::alert_text3)) { str = (*message_)[strings::msg_params][strings::alert_text3].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid alert_text_3 syntax check failed"); + SDL_ERROR("Invalid alert_text_3 syntax check failed"); return false; } } @@ -425,7 +425,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() { for (size_t i = 0; i < tts_chunks_array.length(); ++i) { str = tts_chunks_array[i][strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid tts_chunks text syntax check failed"); + SDL_ERROR("Invalid tts_chunks text syntax check failed"); return false; } } @@ -434,7 +434,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() { } bool AlertRequest::HasHmiResponsesToWait() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ || awaiting_tts_stop_speaking_response_; } diff --git a/src/components/application_manager/src/commands/mobile/alert_response.cc b/src/components/application_manager/src/commands/mobile/alert_response.cc index 4a1f80aadb..0ef4f6caac 100644 --- a/src/components/application_manager/src/commands/mobile/alert_response.cc +++ b/src/components/application_manager/src/commands/mobile/alert_response.cc @@ -47,7 +47,7 @@ AlertResponse::AlertResponse(const MessageSharedPtr& message, AlertResponse::~AlertResponse() {} void AlertResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/src/commands/mobile/change_registration_request.cc index 8f721b8783..526e146eaa 100644 --- a/src/components/application_manager/src/commands/mobile/change_registration_request.cc +++ b/src/components/application_manager/src/commands/mobile/change_registration_request.cc @@ -66,7 +66,7 @@ ChangeRegistrationRequest::ChangeRegistrationRequest( ChangeRegistrationRequest::~ChangeRegistrationRequest() {} void ChangeRegistrationRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace smart_objects; const HMICapabilities& hmi_capabilities = @@ -74,14 +74,13 @@ void ChangeRegistrationRequest::Run() { ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if (IsWhiteSpaceExist()) { - LOGGER_INFO(logger_, - "Incoming request contains \t\n \\t \\n or whitespace"); + SDL_INFO("Incoming request contains \t\n \\t \\n or whitespace"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -113,14 +112,14 @@ void ChangeRegistrationRequest::Run() { if (false == (IsLanguageSupportedByUI(hmi_language) && IsLanguageSupportedByVR(language) && IsLanguageSupportedByTTS(language))) { - LOGGER_ERROR(logger_, "Language is not supported"); + SDL_ERROR("Language is not supported"); SendResponse(false, mobile_apis::Result::REJECTED); return; } if (msg_params.keyExists(strings::app_name) && !IsNicknameAllowed(msg_params[strings::app_name].asCustomString())) { - LOGGER_ERROR(logger_, "Nickname is not allowed."); + SDL_ERROR("Nickname is not allowed."); SendResponse(false, mobile_apis::Result::DISALLOWED); return; } @@ -184,35 +183,35 @@ bool ChangeRegistrationRequest::AllHmiResponsesSuccess( } void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); hmi_apis::FunctionID::eType event_id = event.id(); switch (event_id) { case hmi_apis::FunctionID::UI_ChangeRegistration: { - LOGGER_INFO(logger_, "Received UI_ChangeRegistration event"); + SDL_INFO("Received UI_ChangeRegistration event"); pending_requests_.Remove(event_id); ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); break; } case hmi_apis::FunctionID::VR_ChangeRegistration: { - LOGGER_INFO(logger_, "Received VR_ChangeRegistration event"); + SDL_INFO("Received VR_ChangeRegistration event"); pending_requests_.Remove(event_id); vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); break; } case hmi_apis::FunctionID::TTS_ChangeRegistration: { - LOGGER_INFO(logger_, "Received TTS_ChangeRegistration event"); + SDL_INFO("Received TTS_ChangeRegistration event"); pending_requests_.Remove(event_id); tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event_id); + SDL_ERROR("Received unknown event" << event_id); return; } } @@ -222,7 +221,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -249,9 +248,9 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { NULL, &(message[strings::msg_params])); } else { - LOGGER_INFO(logger_, - "There are some pending responses from HMI." - "ChangeRegistrationRequest still waiting."); + SDL_INFO( + "There are some pending responses from HMI." + "ChangeRegistrationRequest still waiting."); } } @@ -263,7 +262,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI( hmi_capabilities.ui_supported_languages(); if (!ui_languages) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return false; } @@ -273,7 +272,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI( } } - LOGGER_ERROR(logger_, "Language isn't supported by UI"); + SDL_ERROR("Language isn't supported by UI"); return false; } @@ -286,7 +285,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR( hmi_capabilities.vr_supported_languages(); if (!vr_languages) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return false; } @@ -296,7 +295,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR( } } - LOGGER_ERROR(logger_, "Language isn't supported by VR"); + SDL_ERROR("Language isn't supported by VR"); return false; } @@ -309,7 +308,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByTTS( hmi_capabilities.tts_supported_languages(); if (!tts_languages) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return false; } @@ -320,7 +319,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByTTS( } } - LOGGER_ERROR(logger_, "Language isn't supported by TTS"); + SDL_ERROR("Language isn't supported by TTS"); return false; } @@ -330,7 +329,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::app_name)) { str = (*message_)[strings::msg_params][strings::app_name].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid app_name syntax check failed"); + SDL_ERROR("Invalid app_name syntax check failed"); return true; } } @@ -345,7 +344,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { for (; it_tn != it_tn_end; ++it_tn) { str = (*it_tn)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid tts_name syntax check failed"); + SDL_ERROR("Invalid tts_name syntax check failed"); return true; } } @@ -356,8 +355,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name] .asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid ngn_media_screen_app_name syntax check failed"); + SDL_ERROR("Invalid ngn_media_screen_app_name syntax check failed"); return true; } } @@ -372,7 +370,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { for (; it_vs != it_vs_end; ++it_vs) { str = (*it_vs).asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid vr_synonyms syntax check failed"); + SDL_ERROR("Invalid vr_synonyms syntax check failed"); return true; } } @@ -381,7 +379,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { } mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -402,7 +400,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { const custom_str::CustomString& cur_name = (*it)->name(); if (msg_params.keyExists(strings::app_name)) { if (app_name.CompareIgnoreCase(cur_name)) { - LOGGER_ERROR(logger_, "Application name is known already."); + SDL_ERROR("Application name is known already."); return mobile_apis::Result::DUPLICATE_NAME; } @@ -413,7 +411,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { CoincidencePredicateVR v(app_name); if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { - LOGGER_ERROR(logger_, "Application name is known already."); + SDL_ERROR("Application name is known already."); return mobile_apis::Result::DUPLICATE_NAME; } } @@ -426,7 +424,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { CoincidencePredicateVR v(cur_name); if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { - LOGGER_ERROR(logger_, "vr_synonyms duplicated with app_name ."); + SDL_ERROR("vr_synonyms duplicated with app_name ."); return mobile_apis::Result::DUPLICATE_NAME; } } // end vr check @@ -436,13 +434,11 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { bool ChangeRegistrationRequest::IsNicknameAllowed( const custom_str::CustomString& app_name) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, - "Can't find appication with connection key " - << connection_key()); + SDL_ERROR("Can't find appication with connection key " << connection_key()); return false; } @@ -455,9 +451,8 @@ bool ChangeRegistrationRequest::IsNicknameAllowed( policy_app_id, &app_nicknames, &app_hmi_types); if (!init_result) { - LOGGER_ERROR(logger_, - "Error during getting of nickname list for application " - << policy_app_id); + SDL_ERROR("Error during getting of nickname list for application " + << policy_app_id); return false; } @@ -466,7 +461,7 @@ bool ChangeRegistrationRequest::IsNicknameAllowed( policy::StringArray::const_iterator it = std::find_if(app_nicknames.begin(), app_nicknames.end(), compare); if (app_nicknames.end() == it) { - LOGGER_WARN(logger_, "Application name was not found in nicknames list."); + SDL_WARN("Application name was not found in nicknames list."); usage_statistics::AppCounter count_of_rejections_nickname_mismatch( application_manager_.GetPolicyHandler().GetStatisticManager(), diff --git a/src/components/application_manager/src/commands/mobile/change_registration_response.cc b/src/components/application_manager/src/commands/mobile/change_registration_response.cc index 00cdc9ce6c..79faccb711 100644 --- a/src/components/application_manager/src/commands/mobile/change_registration_response.cc +++ b/src/components/application_manager/src/commands/mobile/change_registration_response.cc @@ -44,7 +44,7 @@ ChangeRegistrationResponse::ChangeRegistrationResponse( ChangeRegistrationResponse::~ChangeRegistrationResponse() {} void ChangeRegistrationResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc index 8f9537763c..39bc997a7f 100644 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc @@ -52,16 +52,16 @@ CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest( , error_from_hmi_(false) {} CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } void CreateInteractionChoiceSetRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis; ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -88,7 +88,7 @@ void CreateInteractionChoiceSetRequest::Run() { } if (verification_result_image == Result::INVALID_DATA || verification_result_secondary_image == Result::INVALID_DATA) { - LOGGER_ERROR(logger_, "Image verification failed."); + SDL_ERROR("Image verification failed."); SendResponse(false, Result::INVALID_DATA); return; } @@ -99,8 +99,7 @@ void CreateInteractionChoiceSetRequest::Run() { .asInt(); if (app->FindChoiceSet(choice_set_id_)) { - LOGGER_ERROR(logger_, - "Choice set with id " << choice_set_id_ << " is not found."); + SDL_ERROR("Choice set with id " << choice_set_id_ << " is not found."); SendResponse(false, Result::INVALID_ID); return; } @@ -119,7 +118,7 @@ void CreateInteractionChoiceSetRequest::Run() { mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( ApplicationConstSharedPtr app) { using namespace smart_objects; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::set<uint32_t> choice_id_set; @@ -132,15 +131,14 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( std::pair<std::set<uint32_t>::iterator, bool> ins_res = choice_id_set.insert((*choice_set_it)[strings::choice_id].asInt()); if (!ins_res.second) { - LOGGER_ERROR(logger_, - "Choise with ID " - << (*choice_set_it)[strings::choice_id].asInt() - << " already exists"); + SDL_ERROR("Choise with ID " + << (*choice_set_it)[strings::choice_id].asInt() + << " already exists"); return mobile_apis::Result::INVALID_ID; } if (IsWhiteSpaceExist(*choice_set_it)) { - LOGGER_ERROR(logger_, "Incoming choice set has contains \t\n \\t \\n"); + SDL_ERROR("Incoming choice set has contains \t\n \\t \\n"); return mobile_apis::Result::INVALID_DATA; } } @@ -165,9 +163,8 @@ bool CreateInteractionChoiceSetRequest::compareSynonyms( CreateInteractionChoiceSetRequest::compareStr); if (it != vr_cmds_1->end()) { - LOGGER_INFO(logger_, - "Incoming choice set has duplicated VR synonyms " - << it->asString()); + SDL_INFO("Incoming choice set has duplicated VR synonyms " + << it->asString()); return true; } @@ -182,19 +179,19 @@ bool CreateInteractionChoiceSetRequest::compareStr( bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( const smart_objects::SmartObject& choice_set) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; str = choice_set[strings::menu_name].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid menu_name syntax check failed"); + SDL_ERROR("Invalid menu_name syntax check failed"); return true; } if (choice_set.keyExists(strings::secondary_text)) { str = choice_set[strings::secondary_text].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid secondary_text syntax check failed"); + SDL_ERROR("Invalid secondary_text syntax check failed"); return true; } } @@ -202,7 +199,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( if (choice_set.keyExists(strings::tertiary_text)) { str = choice_set[strings::tertiary_text].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid tertiary_text syntax check failed"); + SDL_ERROR("Invalid tertiary_text syntax check failed"); return true; } } @@ -213,7 +210,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( for (size_t i = 0; i < len; ++i) { str = choice_set[strings::vr_commands][i].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid vr_commands syntax check failed"); + SDL_ERROR("Invalid vr_commands syntax check failed"); return true; } } @@ -222,7 +219,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( if (choice_set.keyExists(strings::image)) { str = choice_set[strings::image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid image value syntax check failed"); + SDL_ERROR("Invalid image value syntax check failed"); return true; } } @@ -230,9 +227,9 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( if (choice_set.keyExists(strings::secondary_image)) { str = choice_set[strings::secondary_image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid secondary_image value. " - "Syntax check failed"); + SDL_ERROR( + "Invalid secondary_image value. " + "Syntax check failed"); return true; } } @@ -241,7 +238,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( application_manager::ApplicationSharedPtr const app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& choice_set = (*message_)[strings::msg_params]; smart_objects::SmartObject msg_params = @@ -258,8 +255,7 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( { sync_primitives::AutoLock error_lock(error_from_hmi_lock_); if (error_from_hmi_) { - LOGGER_WARN(logger_, - "Error from HMI received. Stop sending VRCommands"); + SDL_WARN("Error from HMI received. Stop sending VRCommands"); break; } } @@ -278,27 +274,24 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( VRCommandInfo vr_command(vr_cmd_id); sent_commands_map_[vr_corr_id] = vr_command; - LOGGER_DEBUG(logger_, - "VR_command sent corr_id " << vr_corr_id << " cmd_id " - << vr_corr_id); + SDL_DEBUG("VR_command sent corr_id " << vr_corr_id << " cmd_id " + << vr_corr_id); } expected_chs_count_ = chs_num; - LOGGER_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_); + SDL_DEBUG("expected_chs_count_ = " << expected_chs_count_); } void CreateInteractionChoiceSetRequest::on_event( const event_engine::Event& event) { using namespace hmi_apis; using namespace helpers; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); if (event.id() == hmi_apis::FunctionID::VR_AddCommand) { received_chs_count_++; - LOGGER_DEBUG(logger_, - "Got VR.AddCommand response, there are " - << expected_chs_count_ - received_chs_count_ - << " more to wait."); + SDL_DEBUG("Got VR.AddCommand response, there are " + << expected_chs_count_ - received_chs_count_ << " more to wait."); uint32_t corr_id = static_cast<uint32_t>( message[strings::params][strings::correlation_id].asUInt()); @@ -306,7 +299,7 @@ void CreateInteractionChoiceSetRequest::on_event( sync_primitives::AutoLock commands_lock(vr_commands_lock_); SentCommandsMap::iterator it = sent_commands_map_.find(corr_id); if (sent_commands_map_.end() == it) { - LOGGER_WARN(logger_, "HMI response for unknown VR command received"); + SDL_WARN("HMI response for unknown VR command received"); return; } @@ -320,10 +313,8 @@ void CreateInteractionChoiceSetRequest::on_event( VRCommandInfo& vr_command = it->second; vr_command.succesful_response_received_ = true; } else { - LOGGER_DEBUG(logger_, - "Hmi response is not Success: " - << vr_result - << ". Stop sending VRAddCommand requests"); + SDL_DEBUG("Hmi response is not Success: " + << vr_result << ". Stop sending VRAddCommand requests"); if (!error_from_hmi_) { error_from_hmi_ = true; SendResponse(false, GetMobileResultCode(vr_result)); @@ -334,7 +325,7 @@ void CreateInteractionChoiceSetRequest::on_event( if (received_chs_count_ < expected_chs_count_) { application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); - LOGGER_DEBUG(logger_, "Timeout for request was updated"); + SDL_DEBUG("Timeout for request was updated"); return; } OnAllHMIResponsesReceived(); @@ -342,7 +333,7 @@ void CreateInteractionChoiceSetRequest::on_event( } void CreateInteractionChoiceSetRequest::onTimeOut() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!error_from_hmi_) { SendResponse(false, mobile_apis::Result::GENERIC_ERROR); @@ -357,12 +348,12 @@ void CreateInteractionChoiceSetRequest::onTimeOut() { } void CreateInteractionChoiceSetRequest::DeleteChoices() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } application->RemoveChoiceSet(choice_set_id_); @@ -378,16 +369,15 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() { msg_param[strings::cmd_id] = vr_command_info.cmd_id_; SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_param); } else { - LOGGER_WARN(logger_, - "Succesfull response has not been received for cmd_id = " - << vr_command_info.cmd_id_); + SDL_WARN("Succesfull response has not been received for cmd_id = " + << vr_command_info.cmd_id_); } } sent_commands_map_.clear(); } void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!error_from_hmi_) { SendResponse(true, mobile_apis::Result::SUCCESS); @@ -395,7 +385,7 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } application->UpdateHash(); diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc index d785038de8..e4f6df73df 100644 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc +++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc @@ -46,12 +46,12 @@ CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse( CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse() {} void CreateInteractionChoiceSetResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // check if response false if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOGGER_ERROR(logger_, "Success = false"); + SDL_ERROR("Success = false"); SendResponse(false); return; } diff --git a/src/components/application_manager/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/src/commands/mobile/delete_command_request.cc index 6f867be042..e4419a9188 100644 --- a/src/components/application_manager/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_command_request.cc @@ -55,13 +55,13 @@ DeleteCommandRequest::DeleteCommandRequest( DeleteCommandRequest::~DeleteCommandRequest() {} void DeleteCommandRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -72,7 +72,7 @@ void DeleteCommandRequest::Run() { smart_objects::SmartObject* command = application->FindCommand(cmd_id); if (!command) { - LOGGER_ERROR(logger_, "Command with id " << cmd_id << " is not found."); + SDL_ERROR("Command with id " << cmd_id << " is not found."); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -111,7 +111,7 @@ void DeleteCommandRequest::Run() { } void DeleteCommandRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -121,28 +121,26 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { is_ui_received_ = true; const int result = message[strings::params][hmi_response::code].asInt(); ui_result_ = static_cast<hmi_apis::Common_Result::eType>(result); - LOGGER_DEBUG(logger_, - "Received UI_DeleteCommand event with result " - << MessageHelper::HMIResultToString(ui_result_)); + SDL_DEBUG("Received UI_DeleteCommand event with result " + << MessageHelper::HMIResultToString(ui_result_)); break; } case hmi_apis::FunctionID::VR_DeleteCommand: { is_vr_received_ = true; const int result = message[strings::params][hmi_response::code].asInt(); vr_result_ = static_cast<hmi_apis::Common_Result::eType>(result); - LOGGER_DEBUG(logger_, - "Received VR_DeleteCommand event with result " - << MessageHelper::HMIResultToString(vr_result_)); + SDL_DEBUG("Received VR_DeleteCommand event with result " + << MessageHelper::HMIResultToString(vr_result_)); break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } if (IsPendingResponseExist()) { - LOGGER_DEBUG(logger_, "Still awaiting for other responses."); + SDL_DEBUG("Still awaiting for other responses."); return; } @@ -150,7 +148,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); return; } smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -160,10 +158,9 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { smart_objects::SmartObject* command = application->FindCommand(cmd_id); if (!command) { - LOGGER_ERROR(logger_, - "Command id " << cmd_id << " not found for " - "application with connection key " - << connection_key()); + SDL_ERROR("Command id " << cmd_id << " not found for " + "application with connection key " + << connection_key()); return; } @@ -193,7 +190,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { // or one of them is WARNINGS is_vr_or_ui_warning; - LOGGER_DEBUG(logger_, "Result code is " << (result ? "true" : "false")); + SDL_DEBUG("Result code is " << (result ? "true" : "false")); if (result) { application->RemoveCommand(msg_params[strings::cmd_id].asInt()); @@ -203,7 +200,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { if (!result && hmi_apis::Common_Result::REJECTED == ui_result_) { result_code = MessageHelper::HMIToMobileResult(vr_result_); } else if (is_vr_or_ui_warning) { - LOGGER_DEBUG(logger_, "VR or UI result is warning"); + SDL_DEBUG("VR or UI result is warning"); result_code = mobile_apis::Result::WARNINGS; } else { result_code = @@ -217,7 +214,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { } bool DeleteCommandRequest::IsPendingResponseExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return is_ui_send_ != is_ui_received_ || is_vr_send_ != is_vr_received_; } diff --git a/src/components/application_manager/src/commands/mobile/delete_command_response.cc b/src/components/application_manager/src/commands/mobile/delete_command_response.cc index 8ecdccecdf..c8a5354e68 100644 --- a/src/components/application_manager/src/commands/mobile/delete_command_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_command_response.cc @@ -44,7 +44,7 @@ DeleteCommandResponse::DeleteCommandResponse( DeleteCommandResponse::~DeleteCommandResponse() {} void DeleteCommandResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/src/commands/mobile/delete_file_request.cc index df736a082b..9f3c8bcd9b 100644 --- a/src/components/application_manager/src/commands/mobile/delete_file_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_file_request.cc @@ -46,14 +46,14 @@ DeleteFileRequest::DeleteFileRequest(const MessageSharedPtr& message, DeleteFileRequest::~DeleteFileRequest() {} void DeleteFileRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); return; } @@ -62,8 +62,7 @@ void DeleteFileRequest::Run() { application->delete_file_in_none_count())) { // If application is in the HMI_NONE level the quantity of allowed // DeleteFile request is limited by the configuration profile - LOGGER_ERROR(logger_, - "Too many requests from the app with HMILevel HMI_NONE "); + SDL_ERROR("Too many requests from the app with HMILevel HMI_NONE "); SendResponse(false, mobile_apis::Result::REJECTED); return; } diff --git a/src/components/application_manager/src/commands/mobile/delete_file_response.cc b/src/components/application_manager/src/commands/mobile/delete_file_response.cc index f5c90e3ad6..f2e77b2aa9 100644 --- a/src/components/application_manager/src/commands/mobile/delete_file_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_file_response.cc @@ -45,12 +45,12 @@ DeleteFileResponse::DeleteFileResponse(const MessageSharedPtr& message, DeleteFileResponse::~DeleteFileResponse() {} void DeleteFileResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOGGER_ERROR(logger_, "Application not registered"); + SDL_ERROR("Application not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc index b392656a49..d95fd690c2 100644 --- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -48,14 +48,13 @@ DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest( DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {} void DeleteInteractionChoiceSetRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, - "No application associated with connection key " - << connection_key()); + SDL_ERROR("No application associated with connection key " + << connection_key()); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -65,14 +64,13 @@ void DeleteInteractionChoiceSetRequest::Run() { .asInt(); if (!app->FindChoiceSet(choice_set_id)) { - LOGGER_ERROR(logger_, - "Choice set with id " << choice_set_id << " is not found."); + SDL_ERROR("Choice set with id " << choice_set_id << " is not found."); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } if (ChoiceSetInUse(app)) { - LOGGER_ERROR(logger_, "Choice set currently in use."); + SDL_ERROR("Choice set currently in use."); SendResponse(false, mobile_apis::Result::IN_USE); return; } @@ -96,7 +94,7 @@ void DeleteInteractionChoiceSetRequest::Run() { bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( ApplicationConstSharedPtr app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!app->is_perform_interaction_active()) { return false; } @@ -114,8 +112,7 @@ bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( PerformChoice::const_iterator choice_it = choice.begin(); for (; choice.end() != choice_it; ++choice_it) { if (choice_it->first == choice_set_id) { - LOGGER_ERROR(logger_, - "Choice set with id " << choice_set_id << " is in use."); + SDL_ERROR("Choice set with id " << choice_set_id << " is in use."); return true; } } @@ -125,7 +122,7 @@ bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand( application_manager::ApplicationSharedPtr app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const uint32_t choice_set_id = (*message_)[strings::msg_params][strings::interaction_choice_set_id] @@ -134,8 +131,7 @@ void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand( smart_objects::SmartObject* choice_set = app->FindChoiceSet(choice_set_id); if (!choice_set) { - LOGGER_ERROR(logger_, - "Choice set with id " << choice_set_id << " is not found."); + SDL_ERROR("Choice set with id " << choice_set_id << " is not found."); return; } diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc index 1c22e2cfcd..de1dcd6ad1 100644 --- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc @@ -47,12 +47,12 @@ DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse( DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse() {} void DeleteInteractionChoiceSetResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // check if response false if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOGGER_ERROR(logger_, "Success = false"); + SDL_ERROR("Success = false"); SendResponse(false); return; } diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc index 33c4fcb5db..e7e2c0ef24 100644 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc @@ -47,13 +47,13 @@ DeleteSubMenuRequest::DeleteSubMenuRequest( DeleteSubMenuRequest::~DeleteSubMenuRequest() {} void DeleteSubMenuRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); return; } @@ -61,7 +61,7 @@ void DeleteSubMenuRequest::Run() { (*message_)[strings::msg_params][strings::menu_id].asInt(); if (!app->FindSubMenu(menu_id)) { - LOGGER_ERROR(logger_, "Menu with id " << menu_id << " is not found."); + SDL_ERROR("Menu with id " << menu_id << " is not found."); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -78,7 +78,7 @@ void DeleteSubMenuRequest::Run() { void DeleteSubMenuRequest::DeleteSubMenuVRCommands( ApplicationConstSharedPtr app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const DataAccessor<CommandsMap> accessor = app->commands_map(); const CommandsMap& commands = accessor.GetData(); @@ -105,7 +105,7 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands( void DeleteSubMenuRequest::DeleteSubMenuUICommands( ApplicationSharedPtr const app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const DataAccessor<CommandsMap> accessor(app->commands_map()); const CommandsMap& commands = accessor.GetData(); @@ -113,7 +113,7 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands( while (commands.end() != it) { if (!(*it->second).keyExists(strings::menu_params)) { - LOGGER_ERROR(logger_, "menu_params not exist"); + SDL_ERROR("menu_params not exist"); ++it; continue; } @@ -136,7 +136,7 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands( } void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -155,7 +155,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -174,7 +174,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc index b9a33a9e58..fd037136c1 100644 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc +++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc @@ -44,7 +44,7 @@ DeleteSubMenuResponse::DeleteSubMenuResponse( DeleteSubMenuResponse::~DeleteSubMenuResponse() {} void DeleteSubMenuResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc index 9cdfff5222..29241cfe60 100644 --- a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc +++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc @@ -47,12 +47,12 @@ DiagnosticMessageRequest::DiagnosticMessageRequest( DiagnosticMessageRequest::~DiagnosticMessageRequest() {} void DiagnosticMessageRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "Application is not registered."); + SDL_ERROR("Application is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -68,9 +68,8 @@ void DiagnosticMessageRequest::Run() { if (supported_diag_modes.end() == std::find(supported_diag_modes.begin(), supported_diag_modes.end(), msg_diagnostic_mode)) { - LOGGER_ERROR(logger_, - "Received diagnostic mode " << msg_diagnostic_mode - << " is not supported."); + SDL_ERROR("Received diagnostic mode " << msg_diagnostic_mode + << " is not supported."); SendResponse(false, mobile_apis::Result::REJECTED, "Received diagnostic mode is not supported."); @@ -86,7 +85,7 @@ void DiagnosticMessageRequest::Run() { } void DiagnosticMessageRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -101,7 +100,7 @@ void DiagnosticMessageRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc index f56aa48675..6c6000f1af 100644 --- a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc +++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc @@ -44,7 +44,7 @@ DiagnosticMessageResponse::DiagnosticMessageResponse( DiagnosticMessageResponse::~DiagnosticMessageResponse() {} void DiagnosticMessageResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/src/commands/mobile/dial_number_request.cc index 6a6d7f7b08..db73550cd2 100644 --- a/src/components/application_manager/src/commands/mobile/dial_number_request.cc +++ b/src/components/application_manager/src/commands/mobile/dial_number_request.cc @@ -47,7 +47,7 @@ DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message, DialNumberRequest::~DialNumberRequest() {} bool DialNumberRequest::Init() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); default_timeout_ = 0; @@ -55,27 +55,26 @@ bool DialNumberRequest::Init() { } void DialNumberRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } std::string number = (*message_)[strings::msg_params][strings::number].asString(); if (!CheckSyntax(number)) { - LOGGER_ERROR(logger_, "Invalid incoming data"); + SDL_ERROR("Invalid incoming data"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } StripNumberParam(number); if (number.empty()) { - LOGGER_ERROR(logger_, - "After strip number param is empty. Invalid incoming data"); + SDL_ERROR("After strip number param is empty. Invalid incoming data"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -90,12 +89,12 @@ void DialNumberRequest::Run() { } void DialNumberRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -103,14 +102,14 @@ void DialNumberRequest::on_event(const event_engine::Event& event) { mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; switch (event.id()) { case hmi_apis::FunctionID::BasicCommunication_DialNumber: { - LOGGER_INFO(logger_, "Received DialNumber event"); + SDL_INFO("Received DialNumber event"); result_code = CommandRequestImpl::GetMobileResultCode( static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt())); break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/dial_number_response.cc b/src/components/application_manager/src/commands/mobile/dial_number_response.cc index c8c693e1db..1fded0eebd 100644 --- a/src/components/application_manager/src/commands/mobile/dial_number_response.cc +++ b/src/components/application_manager/src/commands/mobile/dial_number_response.cc @@ -44,7 +44,7 @@ DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message, DialNumberResponse::~DialNumberResponse() {} void DialNumberResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc index 85eb44e2f6..62cec53650 100644 --- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc @@ -44,13 +44,13 @@ EndAudioPassThruRequest::EndAudioPassThruRequest( EndAudioPassThruRequest::~EndAudioPassThruRequest() {} void EndAudioPassThruRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendHMIRequest(hmi_apis::FunctionID::UI_EndAudioPassThru, NULL, true); } void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -72,7 +72,7 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc index 956383ef91..58cb45c50d 100644 --- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc +++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc @@ -44,7 +44,7 @@ EndAudioPassThruResponse::EndAudioPassThruResponse( EndAudioPassThruResponse::~EndAudioPassThruResponse() {} void EndAudioPassThruResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc index 9bad9ca669..1d4ce81785 100644 --- a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc @@ -46,13 +46,13 @@ GetDTCsRequest::GetDTCsRequest(const MessageSharedPtr& message, GetDTCsRequest::~GetDTCsRequest() {} void GetDTCsRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -74,7 +74,7 @@ void GetDTCsRequest::Run() { } void GetDTCsRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -89,7 +89,7 @@ void GetDTCsRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc index bdfbb4a13a..3e21b1c09b 100644 --- a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc +++ b/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc @@ -44,7 +44,7 @@ GetDTCsResponse::GetDTCsResponse(const MessageSharedPtr& message, GetDTCsResponse::~GetDTCsResponse() {} void GetDTCsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc index 181172bf88..4fc028eac5 100644 --- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc @@ -53,14 +53,14 @@ GetVehicleDataRequest::GetVehicleDataRequest( GetVehicleDataRequest::~GetVehicleDataRequest() {} void GetVehicleDataRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); int32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = appplication_manager.application(app_id); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -136,8 +136,7 @@ void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) { } } - LOGGER_INFO(logger_, - hmi_requests_.size() << " requests are going to be sent to HMI"); + SDL_INFO(hmi_requests_.size() << " requests are going to be sent to HMI"); for (HmiRequests::const_iterator it = hmi_requests_.begin(); it != hmi_requests_.end(); @@ -147,7 +146,7 @@ void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) { } void GetVehicleDataRequest::on_event(const event_engine::Event& event) { - LOGGER_INFO(logger_, "GetVehicleDataRequest::on_event " << event.id()); + SDL_INFO("GetVehicleDataRequest::on_event " << event.id()); const smart_objects::SmartObject& message = event.smart_object(); @@ -182,10 +181,8 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { static_cast<mobile_apis::Result::eType>(it->status)) { status = mobile_api::Result::eType::GENERIC_ERROR; } - LOGGER_TRACE(logger_, - "Status from HMI: " << it->status - << ", so response status become " - << status); + SDL_TRACE("Status from HMI: " + << it->status << ", so response status become " << status); } else { any_arg_success = true; } @@ -200,7 +197,7 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { response_params[it->str] = it->value; } } - LOGGER_INFO(logger_, "All HMI requests are complete"); + SDL_INFO("All HMI requests are complete"); const char* info = NULL; std::string error_message; if (true == message[strings::params].keyExists(strings::error_msg)) { @@ -218,14 +215,14 @@ GetVehicleDataRequest::GetVehicleDataRequest( GetVehicleDataRequest::~GetVehicleDataRequest() {} void GetVehicleDataRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); int32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -233,7 +230,7 @@ void GetVehicleDataRequest::Run() { if (app->IsCommandLimitsExceeded( static_cast<mobile_apis::FunctionID::eType>(function_id()), application_manager::TLimitSource::CONFIG_FILE)) { - LOGGER_ERROR(logger_, "GetVehicleData frequency is too high."); + SDL_ERROR("GetVehicleData frequency is too high."); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -261,7 +258,7 @@ void GetVehicleDataRequest::Run() { } void GetVehicleDataRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject message = event.smart_object(); switch (event.id()) { @@ -290,7 +287,7 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc index 67f4d8582b..c55a9cde9e 100644 --- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc @@ -45,7 +45,7 @@ GetVehicleDataResponse::GetVehicleDataResponse( GetVehicleDataResponse::~GetVehicleDataResponse() {} void GetVehicleDataResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc index 4c5f2cd5e4..b66c0f4c27 100644 --- a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc @@ -12,14 +12,13 @@ GetWayPointsRequest::GetWayPointsRequest( GetWayPointsRequest::~GetWayPointsRequest() {} void GetWayPointsRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); + SDL_ERROR("An application with connection key " << connection_key() + << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -34,12 +33,12 @@ void GetWayPointsRequest::Run() { } void GetWayPointsRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_GetWayPoints: { - LOGGER_INFO(logger_, "Received Navigation_GetWayPoints event"); + SDL_INFO("Received Navigation_GetWayPoints event"); mobile_apis::Result::eType result_code = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt())); @@ -48,7 +47,7 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); break; } } diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_response.cc b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc index 3766719b5c..b154a2dd87 100644 --- a/src/components/application_manager/src/commands/mobile/get_way_points_response.cc +++ b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc @@ -12,7 +12,7 @@ GetWayPointsResponse::GetWayPointsResponse( GetWayPointsResponse::~GetWayPointsResponse() {} void GetWayPointsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/list_files_request.cc b/src/components/application_manager/src/commands/mobile/list_files_request.cc index 3778dc2601..4aad773a02 100644 --- a/src/components/application_manager/src/commands/mobile/list_files_request.cc +++ b/src/components/application_manager/src/commands/mobile/list_files_request.cc @@ -48,14 +48,14 @@ ListFilesRequest::ListFilesRequest(const MessageSharedPtr& message, ListFilesRequest::~ListFilesRequest() {} void ListFilesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); return; } @@ -64,8 +64,7 @@ void ListFilesRequest::Run() { application->list_files_in_none_count())) { // If application is in the HMI_NONE level the quantity of allowed // DeleteFile request is limited by the configuration profile - LOGGER_ERROR(logger_, - "Too many requests from the app with HMILevel HMI_NONE "); + SDL_ERROR("Too many requests from the app with HMILevel HMI_NONE "); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -84,13 +83,11 @@ void ListFilesRequest::Run() { // to write only name file. // Plus one required for move to next letter after '/'. if (i < application_manager_.get_settings().list_files_response_size()) { - LOGGER_DEBUG(logger_, - "File " + filename + " added to ListFiles response"); + SDL_DEBUG("File " + filename + " added to ListFiles response"); (*message_)[strings::msg_params][strings::filenames][i++] = file_system::RetrieveFileNameFromPath(it->first); } else { - LOGGER_DEBUG(logger_, - "File " + filename + " not added to ListFiles response"); + SDL_DEBUG("File " + filename + " not added to ListFiles response"); } } (*message_)[strings::params][strings::message_type] = diff --git a/src/components/application_manager/src/commands/mobile/list_files_response.cc b/src/components/application_manager/src/commands/mobile/list_files_response.cc index 59b66324e3..3821f57e6b 100644 --- a/src/components/application_manager/src/commands/mobile/list_files_response.cc +++ b/src/components/application_manager/src/commands/mobile/list_files_response.cc @@ -45,7 +45,7 @@ ListFilesResponse::ListFilesResponse(const MessageSharedPtr& message, ListFilesResponse::~ListFilesResponse() {} void ListFilesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc b/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc index 58c3572e79..28a2531a39 100644 --- a/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc @@ -46,7 +46,7 @@ OnAppInterfaceUnregisteredNotification:: ~OnAppInterfaceUnregisteredNotification() {} void OnAppInterfaceUnregisteredNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc b/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc index dd661d05d5..37512dea74 100644 --- a/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc @@ -43,7 +43,7 @@ OnAudioPassThruNotification::OnAudioPassThruNotification( OnAudioPassThruNotification::~OnAudioPassThruNotification() {} void OnAudioPassThruNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc index 13d0006bfb..47a1f6e4c2 100644 --- a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc @@ -48,7 +48,7 @@ OnButtonEventNotification::OnButtonEventNotification( OnButtonEventNotification::~OnButtonEventNotification() {} void OnButtonEventNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const uint32_t btn_id = static_cast<uint32_t>( (*message_)[strings::msg_params][hmi_response::button_name].asInt()); @@ -57,7 +57,7 @@ void OnButtonEventNotification::Run() { if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { // app_id is mandatory for CUSTOM_BUTTON notification if (false == (*message_)[strings::msg_params].keyExists(strings::app_id)) { - LOGGER_ERROR(logger_, "CUSTOM_BUTTON OnButtonEvent without app_id."); + SDL_ERROR("CUSTOM_BUTTON OnButtonEvent without app_id."); return; } @@ -65,8 +65,7 @@ void OnButtonEventNotification::Run() { if (false == (*message_)[strings::msg_params].keyExists( hmi_response::custom_button_id)) { - LOGGER_ERROR(logger_, - "CUSTOM_BUTTON OnButtonEvent without custom_button_id."); + SDL_ERROR("CUSTOM_BUTTON OnButtonEvent without custom_button_id."); return; } @@ -74,7 +73,7 @@ void OnButtonEventNotification::Run() { (*message_)[strings::msg_params][strings::app_id].asUInt()); if (false == app.valid()) { - LOGGER_ERROR(logger_, "Application doesn't exist."); + SDL_ERROR("Application doesn't exist."); return; } @@ -84,8 +83,7 @@ void OnButtonEventNotification::Run() { .asUInt(); if (false == app->IsSubscribedToSoftButton(custom_btn_id)) { - LOGGER_ERROR(logger_, - "Application doesn't subscribed to this custom_button_id."); + SDL_ERROR("Application doesn't subscribed to this custom_button_id."); return; } @@ -100,25 +98,23 @@ void OnButtonEventNotification::Run() { for (; subscribedApps.end() != it; ++it) { ApplicationSharedPtr subscribed_app = *it; if (!subscribed_app) { - LOGGER_WARN(logger_, "Null pointer to subscribed app."); + SDL_WARN("Null pointer to subscribed app."); continue; } // Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) && (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) { - LOGGER_WARN(logger_, - "OnButtonEvent notification is allowed only" - << "in FULL or LIMITED hmi level"); + SDL_WARN("OnButtonEvent notification is allowed only" + << "in FULL or LIMITED hmi level"); continue; } // Send ButtonEvent notification for OK button only in HMI_FULL mode if ((static_cast<uint32_t>(mobile_apis::ButtonName::OK) == btn_id) && (mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level())) { - LOGGER_WARN(logger_, - "OnButtonEvent notification for OK button" - << "is allowed only in FULL hmi level"); + SDL_WARN("OnButtonEvent notification for OK button" + << "is allowed only in FULL hmi level"); continue; } @@ -128,7 +124,7 @@ void OnButtonEventNotification::Run() { void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { if (!app) { - LOGGER_ERROR(logger_, "OnButtonEvent NULL pointer"); + SDL_ERROR("OnButtonEvent NULL pointer"); return; } @@ -136,7 +132,7 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { new smart_objects::SmartObject(); if (!on_btn_event) { - LOGGER_ERROR(logger_, "OnButtonEvent NULL pointer"); + SDL_ERROR("OnButtonEvent NULL pointer"); return; } diff --git a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc index 38792d970b..0597d966ba 100644 --- a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc @@ -48,7 +48,7 @@ OnButtonPressNotification::OnButtonPressNotification( OnButtonPressNotification::~OnButtonPressNotification() {} void OnButtonPressNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const uint32_t btn_id = static_cast<uint32_t>( (*message_)[strings::msg_params][hmi_response::button_name].asInt()); @@ -57,7 +57,7 @@ void OnButtonPressNotification::Run() { if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { // app_id is mandatory for CUSTOM_BUTTON notification if (false == (*message_)[strings::msg_params].keyExists(strings::app_id)) { - LOGGER_ERROR(logger_, "CUSTOM_BUTTON OnButtonPress without app_id."); + SDL_ERROR("CUSTOM_BUTTON OnButtonPress without app_id."); return; } @@ -65,8 +65,7 @@ void OnButtonPressNotification::Run() { if (false == (*message_)[strings::msg_params].keyExists( hmi_response::custom_button_id)) { - LOGGER_ERROR(logger_, - "CUSTOM_BUTTON OnButtonPress without custom_button_id."); + SDL_ERROR("CUSTOM_BUTTON OnButtonPress without custom_button_id."); return; } @@ -74,7 +73,7 @@ void OnButtonPressNotification::Run() { (*message_)[strings::msg_params][strings::app_id].asUInt()); if (false == app.valid()) { - LOGGER_ERROR(logger_, "Application doesn't exist."); + SDL_ERROR("Application doesn't exist."); return; } @@ -84,8 +83,7 @@ void OnButtonPressNotification::Run() { .asUInt(); if (false == app->IsSubscribedToSoftButton(custom_btn_id)) { - LOGGER_ERROR(logger_, - "Application doesn't subscribed to this custom_button_id."); + SDL_ERROR("Application doesn't subscribed to this custom_button_id."); return; } @@ -100,25 +98,23 @@ void OnButtonPressNotification::Run() { for (; subscribedApps.end() != it; ++it) { ApplicationSharedPtr subscribed_app = *it; if (!subscribed_app) { - LOGGER_WARN(logger_, "Null pointer to subscribed app."); + SDL_WARN("Null pointer to subscribed app."); continue; } // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) && (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) { - LOGGER_WARN(logger_, - "OnButtonPress notification is allowed only" - << "in FULL or LIMITED hmi level"); + SDL_WARN("OnButtonPress notification is allowed only" + << "in FULL or LIMITED hmi level"); continue; } // Send ButtonPress notification for OK button only in HMI_FULL mode if ((static_cast<uint32_t>(mobile_apis::ButtonName::OK) == btn_id) && (mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level())) { - LOGGER_WARN(logger_, - "OnButtonPress notification for OK button" - << "is allowed only in FULL hmi level"); + SDL_WARN("OnButtonPress notification for OK button" + << "is allowed only in FULL hmi level"); continue; } @@ -128,7 +124,7 @@ void OnButtonPressNotification::Run() { void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { if (!app) { - LOGGER_ERROR(logger_, "OnButtonPress NULL pointer"); + SDL_ERROR("OnButtonPress NULL pointer"); return; } @@ -136,7 +132,7 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { new smart_objects::SmartObject(); if (!on_btn_press) { - LOGGER_ERROR(logger_, "OnButtonPress NULL pointer"); + SDL_ERROR("OnButtonPress NULL pointer"); return; } diff --git a/src/components/application_manager/src/commands/mobile/on_command_notification.cc b/src/components/application_manager/src/commands/mobile/on_command_notification.cc index 35b5086396..54b5a83ce0 100644 --- a/src/components/application_manager/src/commands/mobile/on_command_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_command_notification.cc @@ -45,13 +45,13 @@ OnCommandNotification::OnCommandNotification( OnCommandNotification::~OnCommandNotification() {} void OnCommandNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::msg_params][strings::app_id].asInt()); if (!app) { - LOGGER_ERROR(logger_, "No application associated with session key"); + SDL_ERROR("No application associated with session key"); return; } @@ -59,7 +59,7 @@ void OnCommandNotification::Run() { (*message_)[strings::msg_params][strings::cmd_id].asUInt(); if (!app->FindCommand(cmd_id)) { - LOGGER_ERROR(logger_, " No applications found for the command " << cmd_id); + SDL_ERROR(" No applications found for the command " << cmd_id); return; } diff --git a/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc b/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc index 73be534590..4b720dbd1b 100644 --- a/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc @@ -48,7 +48,7 @@ OnDriverDistractionNotification::OnDriverDistractionNotification( OnDriverDistractionNotification::~OnDriverDistractionNotification() {} void OnDriverDistractionNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc index 854f39543f..6d18efa027 100644 --- a/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc @@ -50,7 +50,7 @@ OnHashChangeNotification::OnHashChangeNotification( OnHashChangeNotification::~OnHashChangeNotification() {} void OnHashChangeNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); @@ -62,8 +62,7 @@ void OnHashChangeNotification::Run() { (*message_)[strings::msg_params][strings::hash_id] = app->curHash(); SendNotification(); } else { - LOGGER_WARN(logger_, - "Application with app_id " << app_id << " does not exist"); + SDL_WARN("Application with app_id " << app_id << " does not exist"); } } diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc index 0a7adcac6b..cb11f6080f 100644 --- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc @@ -46,13 +46,13 @@ OnHMIStatusNotification::OnHMIStatusNotification( OnHMIStatusNotification::~OnHMIStatusNotification() {} void OnHMIStatusNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app.valid()) { - LOGGER_ERROR(logger_, "OnHMIStatusNotification application doesn't exist"); + SDL_ERROR("OnHMIStatusNotification application doesn't exist"); return; } @@ -63,17 +63,16 @@ void OnHMIStatusNotification::Run() { (mobile_apis::HMILevel::HMI_NONE == hmi_level)) { if (!(app->tts_properties_in_none())) { app->set_tts_properties_in_none(true); - LOGGER_INFO(logger_, - "OnHMIStatusNotification::Send TTS GlobalProperties" - " with empty array to HMI"); + SDL_INFO( + "OnHMIStatusNotification::Send TTS GlobalProperties" + " with empty array to HMI"); MessageHelper::SendTTSGlobalProperties(app, false, application_manager_); } } else if ((mobile_apis::HMILevel::HMI_FULL == hmi_level) || (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) { if (!(app->tts_properties_in_full())) { app->set_tts_properties_in_full(true); - LOGGER_INFO(logger_, - "OnHMIStatusNotification AddAppToTTSGlobalPropertiesList"); + SDL_INFO("OnHMIStatusNotification AddAppToTTSGlobalPropertiesList"); application_manager_.AddAppToTTSGlobalPropertiesList(app->app_id()); } } diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc index 69523e32f5..81c9cced12 100644 --- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc +++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc @@ -45,15 +45,14 @@ OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile( OnHMIStatusNotificationFromMobile::~OnHMIStatusNotificationFromMobile() {} void OnHMIStatusNotificationFromMobile::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app.valid()) { - LOGGER_ERROR(logger_, - "OnHMIStatusNotificationFromMobile application doesn't exist"); + SDL_ERROR("OnHMIStatusNotificationFromMobile application doesn't exist"); return; } @@ -70,9 +69,8 @@ void OnHMIStatusNotificationFromMobile::Run() { bool is_apps_requested_before = application_manager_.IsAppsQueriedFrom(handle); - LOGGER_DEBUG(logger_, - "Mobile HMI state notication came for connection key:" - << connection_key() << " and handle: " << handle); + SDL_DEBUG("Mobile HMI state notication came for connection key:" + << connection_key() << " and handle: " << handle); if (!is_apps_requested_before && ProtocolVersion::kV4 == app->protocol_version() && app->is_foreground()) { @@ -84,10 +82,10 @@ void OnHMIStatusNotificationFromMobile::Run() { } if (is_apps_requested_before) { - LOGGER_DEBUG(logger_, - "Remote apps list had been requested already " - " for handle: " - << handle); + SDL_DEBUG( + "Remote apps list had been requested already " + " for handle: " + << handle); if (ProtocolVersion::kV4 == app->protocol_version()) { const ApplicationSet& accessor = diff --git a/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc index f3a56201d8..4b9a5ef3cb 100644 --- a/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc @@ -49,7 +49,7 @@ OnKeyBoardInputNotification::OnKeyBoardInputNotification( OnKeyBoardInputNotification::~OnKeyBoardInputNotification() {} void OnKeyBoardInputNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app_to_notify; @@ -59,14 +59,13 @@ void OnKeyBoardInputNotification::Run() { // if there is app with active perform interaction use it for notification ApplicationSharedPtr app = *it; if (app->is_perform_interaction_active()) { - LOGGER_INFO(logger_, - "There is application with active PerformInteraction"); + SDL_INFO("There is application with active PerformInteraction"); app_to_notify = app; break; } if (mobile_apis::HMILevel::eType::HMI_FULL == app->hmi_level()) { - LOGGER_INFO(logger_, "There is application in HMI_FULL level"); + SDL_INFO("There is application in HMI_FULL level"); app_to_notify = app; } } diff --git a/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc index a7ce66c939..a20a6fee4e 100644 --- a/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc @@ -44,7 +44,7 @@ OnLanguageChangeNotification::OnLanguageChangeNotification( OnLanguageChangeNotification::~OnLanguageChangeNotification() {} void OnLanguageChangeNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc index 0e7e9143b1..3a76939419 100644 --- a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc @@ -46,7 +46,7 @@ OnPermissionsChangeNotification::OnPermissionsChangeNotification( OnPermissionsChangeNotification::~OnPermissionsChangeNotification() {} void OnPermissionsChangeNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); diff --git a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc index d98c3d31d1..6a176f34e1 100644 --- a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc @@ -52,16 +52,15 @@ OnSystemRequestNotification::OnSystemRequestNotification( OnSystemRequestNotification::~OnSystemRequestNotification() {} void OnSystemRequestNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace application_manager; using namespace mobile_apis; ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app.valid()) { - LOGGER_ERROR(logger_, - "Application with connection key " << connection_key() - << " is not registered."); + SDL_ERROR("Application with connection key " << connection_key() + << " is not registered."); return; } @@ -71,9 +70,7 @@ void OnSystemRequestNotification::Run() { application_manager_.GetPolicyHandler(); if (!policy_handler.IsRequestTypeAllowed(app->policy_app_id(), request_type)) { - LOGGER_WARN(logger_, - "Request type " << request_type - << " is not allowed by policies"); + SDL_WARN("Request type " << request_type << " is not allowed by policies"); return; } @@ -103,7 +100,7 @@ void OnSystemRequestNotification::Run() { #ifdef EXTENDED_POLICY void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const int timeout = application_manager_.GetPolicyHandler().TimeoutExchange(); char size_str[24]; @@ -147,8 +144,7 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const { message.clear(); message.assign(header.begin(), header.end()); - LOGGER_DEBUG(logger_, - "Header added: " << std::string(message.begin(), message.end())); + SDL_DEBUG("Header added: " << std::string(message.begin(), message.end())); } #endif diff --git a/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc index bdebe843ef..a5c258bea1 100644 --- a/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc @@ -46,7 +46,7 @@ OnTBTClientStateNotification::OnTBTClientStateNotification( OnTBTClientStateNotification::~OnTBTClientStateNotification() {} void OnTBTClientStateNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); diff --git a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc index 1d90208664..1aa6b7edb1 100644 --- a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc @@ -47,7 +47,7 @@ OnTouchEventNotification::OnTouchEventNotification( OnTouchEventNotification::~OnTouchEventNotification() {} void OnTouchEventNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const std::vector<ApplicationSharedPtr>& applications = application_manager_.applications_with_navi(); diff --git a/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc index fef3b92474..102b50c3d3 100644 --- a/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc @@ -47,7 +47,7 @@ OnVehicleDataNotification::OnVehicleDataNotification( OnVehicleDataNotification::~OnVehicleDataNotification() {} void OnVehicleDataNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::vector<ApplicationSharedPtr> appNotification; std::vector<ApplicationSharedPtr>::iterator appNotification_it = @@ -69,7 +69,7 @@ void OnVehicleDataNotification::Run() { for (; applications.end() != app_it; ++app_it) { const ApplicationSharedPtr app = *app_it; if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); continue; } @@ -90,15 +90,12 @@ void OnVehicleDataNotification::Run() { } } - LOGGER_DEBUG( - logger_, - "Number of Notifications to be send: " << appNotification.size()); + SDL_DEBUG("Number of Notifications to be send: " << appNotification.size()); for (size_t idx = 0; idx < appNotification.size(); idx++) { - LOGGER_INFO(logger_, - "Send OnVehicleData PRNDL notification to " - << appNotification[idx]->name().c_str() - << " application id " << appNotification[idx]->app_id()); + SDL_INFO("Send OnVehicleData PRNDL notification to " + << appNotification[idx]->name().c_str() << " application id " + << appNotification[idx]->app_id()); (*message_)[strings::params][strings::connection_key] = appNotification[idx]->app_id(); (*message_)[strings::msg_params] = appSO[idx]; diff --git a/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc index 3a2025e18a..737ab3f5c9 100644 --- a/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc @@ -44,7 +44,7 @@ OnWayPointChangeNotification::OnWayPointChangeNotification( OnWayPointChangeNotification::~OnWayPointChangeNotification() {} void OnWayPointChangeNotification::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::set<int32_t> subscribed_for_way_points = application_manager_.GetAppsSubscribedForWayPoints(); diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc index 3faee4569c..cb24eccc13 100644 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -54,7 +54,7 @@ PerformAudioPassThruRequest::PerformAudioPassThruRequest( PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {} void PerformAudioPassThruRequest::onTimeOut() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); FinishTTSSpeak(); CommandRequestImpl::onTimeOut(); @@ -67,27 +67,27 @@ bool PerformAudioPassThruRequest::Init() { } void PerformAudioPassThruRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); + SDL_ERROR("APPLICATION_NOT_REGISTERED"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if (mobile_api::HMILevel::HMI_NONE == app->hmi_level()) { - LOGGER_ERROR(logger_, "application isn't activated"); + SDL_ERROR("application isn't activated"); SendResponse(false, mobile_apis::Result::REJECTED); return; } if (IsWhiteSpaceExist()) { - LOGGER_ERROR(logger_, - "Incoming perform audio pass thru has contains " - "\\t\\n \\\\t \\\\n" - " text contains only whitespace in initialPrompt"); + SDL_ERROR( + "Incoming perform audio pass thru has contains " + "\\t\\n \\\\t \\\\n" + " text contains only whitespace in initialPrompt"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -105,17 +105,17 @@ void PerformAudioPassThruRequest::Run() { } void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_PerformAudioPassThru: { - LOGGER_TRACE(logger_, "Received UI_PerformAudioPassThru"); + SDL_TRACE("Received UI_PerformAudioPassThru"); if (!WaitTTSSpeak()) { - LOGGER_DEBUG(logger_, "TTS.Speak is absent"); + SDL_DEBUG("TTS.Speak is absent"); return; } @@ -125,7 +125,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { // in case perform audio is started by other request skip stopping if (mobile_apis::Result::REJECTED == mobile_code) { - LOGGER_ERROR(logger_, "Request was rejected"); + SDL_ERROR("Request was rejected"); SendResponse(false, mobile_code, NULL, &(message[strings::msg_params])); return; } @@ -157,7 +157,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_Speak: { - LOGGER_INFO(logger_, "Received TTS_Speak event"); + SDL_INFO("Received TTS_Speak event"); result_tts_speak_ = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt())); @@ -173,21 +173,21 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_OnResetTimeout: { - LOGGER_INFO(logger_, "Received TTS_OnResetTimeout event"); + SDL_INFO("Received TTS_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } } void PerformAudioPassThruRequest::SendSpeakRequest() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace hmi_apis; using namespace smart_objects; @@ -213,7 +213,7 @@ void PerformAudioPassThruRequest::SendSpeakRequest() { } void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -257,7 +257,7 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() { } void PerformAudioPassThruRequest::SendRecordStartNotification() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -267,7 +267,7 @@ void PerformAudioPassThruRequest::SendRecordStartNotification() { } void PerformAudioPassThruRequest::StartMicrophoneRecording() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.BeginAudioPassThrough(); @@ -281,7 +281,7 @@ void PerformAudioPassThruRequest::StartMicrophoneRecording() { } bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) { @@ -294,7 +294,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { for (; it_ip != it_ip_end; ++it_ip) { str = (*it_ip)[strings::text].asCharArray(); if (std::strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid initial_prompt syntax check failed"); + SDL_ERROR("Invalid initial_prompt syntax check failed"); return true; } } @@ -305,9 +305,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::audio_pass_display_text1] .asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR( - logger_, - "Invalid audio_pass_display_text1 value syntax check failed"); + SDL_ERROR("Invalid audio_pass_display_text1 value syntax check failed"); return true; } } @@ -317,9 +315,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::audio_pass_display_text2] .asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR( - logger_, - "Invalid audio_pass_display_text2 value syntax check failed"); + SDL_ERROR("Invalid audio_pass_display_text2 value syntax check failed"); return true; } } @@ -327,13 +323,13 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { } void PerformAudioPassThruRequest::FinishTTSSpeak() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (application_manager_.EndAudioPassThrough()) { - LOGGER_DEBUG(logger_, "Stop AudioPassThru."); + SDL_DEBUG("Stop AudioPassThru."); application_manager_.StopAudioPassThru(connection_key()); } if (!is_active_tts_speak_) { - LOGGER_WARN(logger_, "TTS Speak is inactive."); + SDL_WARN("TTS Speak is inactive."); return; } is_active_tts_speak_ = false; @@ -341,7 +337,7 @@ void PerformAudioPassThruRequest::FinishTTSSpeak() { } bool PerformAudioPassThruRequest::WaitTTSSpeak() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint64_t default_timeout_msec = application_manager_.get_settings().default_timeout(); const TimevalStruct start_time = date_time::DateTime::getCurrentTime(); @@ -352,7 +348,7 @@ bool PerformAudioPassThruRequest::WaitTTSSpeak() { date_time::DateTime::calculateTimeSpan(start_time); // Send GENERIC_ERROR after default timeout if (difference_between_start_current_time > default_timeout_msec) { - LOGGER_WARN(logger_, "Expired timeout for TTS.Speak response"); + SDL_WARN("Expired timeout for TTS.Speak response"); // Don't use onTimeOut(), because default_timeout_ is bigger than // Default time in *.ini file FinishTTSSpeak(); diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc index f58056f99c..e7e2add94e 100644 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc +++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc @@ -44,7 +44,7 @@ PerformAudioPassThruResponse::PerformAudioPassThruResponse( PerformAudioPassThruResponse::~PerformAudioPassThruResponse() {} void PerformAudioPassThruResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc index 03e90b1010..8e1256ea55 100644 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc @@ -88,18 +88,18 @@ bool PerformInteractionRequest::Init() { } void PerformInteractionRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if (app->is_perform_interaction_active()) { - LOGGER_DEBUG(logger_, "Application has active PerformInteraction"); + SDL_DEBUG("Application has active PerformInteraction"); app_pi_was_active_before_ = true; } @@ -114,9 +114,9 @@ void PerformInteractionRequest::Run() { if ((mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) && (mobile_apis::LayoutMode::KEYBOARD == interaction_layout)) { - LOGGER_ERROR(logger_, - "PerformInteraction contains InteractionMode" - "=VR_ONLY and interactionLayout=KEYBOARD"); + SDL_ERROR( + "PerformInteraction contains InteractionMode" + "=VR_ONLY and interactionLayout=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -127,17 +127,17 @@ void PerformInteractionRequest::Run() { if (0 == choice_set_id_list_length) { if (mobile_apis::LayoutMode::KEYBOARD == interaction_layout) { if (mobile_apis::InteractionMode::BOTH == interaction_mode_) { - LOGGER_ERROR(logger_, - "interactionChoiceSetIDList is empty," - " InteractionMode=BOTH and" - " interactionLayout=KEYBOARD"); + SDL_ERROR( + "interactionChoiceSetIDList is empty," + " InteractionMode=BOTH and" + " interactionLayout=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } } else { - LOGGER_ERROR(logger_, - "interactionChoiceSetIDList is empty" - " and interactionLayout!=KEYBOARD"); + SDL_ERROR( + "interactionChoiceSetIDList is empty" + " and interactionLayout!=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -148,9 +148,9 @@ void PerformInteractionRequest::Run() { app, choice_set_id_list_length, msg_params[strings::interaction_choice_set_id_list]))) { - LOGGER_ERROR(logger_, - "PerformInteraction has choice sets with " - "duplicated IDs or application does not have choice sets"); + SDL_ERROR( + "PerformInteraction has choice sets with " + "duplicated IDs or application does not have choice sets"); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -159,23 +159,21 @@ void PerformInteractionRequest::Run() { if (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImageVrHelpItems( msg_params[strings::vr_help], app, application_manager_)) { - LOGGER_ERROR(logger_, - "Verification of " << strings::vr_help << " failed."); + SDL_ERROR("Verification of " << strings::vr_help << " failed."); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } } if (IsWhiteSpaceExist()) { - LOGGER_ERROR(logger_, - "Incoming perform interaction has contains \t\n \\t \\n"); + SDL_ERROR("Incoming perform interaction has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } switch (interaction_mode_) { case mobile_apis::InteractionMode::BOTH: { - LOGGER_DEBUG(logger_, "Interaction Mode: BOTH"); + SDL_DEBUG("Interaction Mode: BOTH"); if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) || !CheckVrHelpItemPositions(app)) { return; @@ -183,7 +181,7 @@ void PerformInteractionRequest::Run() { break; } case mobile_apis::InteractionMode::MANUAL_ONLY: { - LOGGER_DEBUG(logger_, "Interaction Mode: MANUAL_ONLY"); + SDL_DEBUG("Interaction Mode: MANUAL_ONLY"); if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) || !CheckVrHelpItemPositions(app)) { return; @@ -191,14 +189,14 @@ void PerformInteractionRequest::Run() { break; } case mobile_apis::InteractionMode::VR_ONLY: { - LOGGER_DEBUG(logger_, "Interaction Mode: VR_ONLY"); + SDL_DEBUG("Interaction Mode: VR_ONLY"); if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app)) { return; } break; } default: { - LOGGER_ERROR(logger_, "Unknown interaction mode"); + SDL_ERROR("Unknown interaction mode"); return; } } @@ -212,20 +210,20 @@ void PerformInteractionRequest::Run() { } void PerformInteractionRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); smart_objects::SmartObject msg_param = smart_objects::SmartObject(smart_objects::SmartType_Map); switch (event.id()) { case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOGGER_DEBUG(logger_, "Received UI_OnResetTimeout event"); + SDL_DEBUG("Received UI_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::UI_PerformInteraction: { - LOGGER_DEBUG(logger_, "Received UI_PerformInteraction event"); + SDL_DEBUG("Received UI_PerformInteraction event"); ui_response_recived_ = true; unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); ui_resultCode_ = @@ -235,7 +233,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::VR_PerformInteraction: { - LOGGER_DEBUG(logger_, "Received VR_PerformInteraction"); + SDL_DEBUG("Received VR_PerformInteraction"); vr_response_recived_ = true; unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction); vr_resultCode_ = @@ -245,20 +243,20 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); break; } } if (mobile_apis::InteractionMode::BOTH == interaction_mode_ && !HasHMIResponsesToWait()) { - LOGGER_DEBUG(logger_, "Send response in BOTH iteraction mode"); + SDL_DEBUG("Send response in BOTH iteraction mode"); SendBothModeResponse(msg_param); } } void PerformInteractionRequest::onTimeOut() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); switch (interaction_mode_) { case mobile_apis::InteractionMode::BOTH: { @@ -284,7 +282,7 @@ void PerformInteractionRequest::onTimeOut() { break; } default: { - LOGGER_ERROR(logger_, "INVALID ENUM"); + SDL_ERROR("INVALID ENUM"); return; } }; @@ -293,7 +291,7 @@ void PerformInteractionRequest::onTimeOut() { void PerformInteractionRequest::ProcessVRResponse( const smart_objects::SmartObject& message, smart_objects::SmartObject& msg_params) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis; using namespace mobile_apis::Result; using namespace smart_objects; @@ -302,7 +300,7 @@ void PerformInteractionRequest::ProcessVRResponse( ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -314,14 +312,14 @@ void PerformInteractionRequest::ProcessVRResponse( Compare<Result::eType, EQ, ONE>(vr_resultCode_, ABORTED, TIMED_OUT); if (is_vr_aborted_timeout) { - LOGGER_DEBUG(logger_, "VR response aborted"); + SDL_DEBUG("VR response aborted"); if (InteractionMode::VR_ONLY == interaction_mode_) { - LOGGER_DEBUG(logger_, "Aborted or Timeout Send Close Popup"); + SDL_DEBUG("Aborted or Timeout Send Close Popup"); TerminatePerformInteraction(); SendResponse(false, vr_resultCode_); return; } - LOGGER_DEBUG(logger_, "Update timeout for UI"); + SDL_DEBUG("Update timeout for UI"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); return; @@ -329,9 +327,8 @@ void PerformInteractionRequest::ProcessVRResponse( if (SUCCESS == vr_resultCode_ && InteractionMode::MANUAL_ONLY == interaction_mode_) { - LOGGER_DEBUG(logger_, - "VR response SUCCESS in MANUAL_ONLY mode " - << "Wait for UI response"); + SDL_DEBUG("VR response SUCCESS in MANUAL_ONLY mode " + << "Wait for UI response"); // in case MANUAL_ONLY mode VR.PI SUCCESS just return return; } @@ -340,7 +337,7 @@ void PerformInteractionRequest::ProcessVRResponse( if (hmi_msg_params.keyExists(strings::choice_id)) { const int choise_id = hmi_msg_params[strings::choice_id].asInt(); if (!CheckChoiceIDFromResponse(app, choise_id)) { - LOGGER_ERROR(logger_, "Wrong choiceID was received from HMI"); + SDL_ERROR("Wrong choiceID was received from HMI"); TerminatePerformInteraction(); SendResponse( false, GENERIC_ERROR, "Wrong choiceID was received from HMI"); @@ -353,11 +350,11 @@ void PerformInteractionRequest::ProcessVRResponse( if (mobile_apis::InteractionMode::BOTH == interaction_mode_ && mobile_apis::Result::SUCCESS != vr_resultCode_) { - LOGGER_DEBUG(logger_, "VR response isn't SUCCESS in BOTH mode"); + SDL_DEBUG("VR response isn't SUCCESS in BOTH mode"); return; } - LOGGER_DEBUG(logger_, "VR response consider to be SUCCESS"); + SDL_DEBUG("VR response consider to be SUCCESS"); TerminatePerformInteraction(); SendResponse(vr_result_, SUCCESS, NULL, &msg_params); } @@ -365,13 +362,13 @@ void PerformInteractionRequest::ProcessVRResponse( void PerformInteractionRequest::ProcessPerformInteractionResponse( const smart_objects::SmartObject& message, smart_objects::SmartObject& msg_params) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; using namespace smart_objects; ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -434,7 +431,7 @@ void PerformInteractionRequest::ProcessPerformInteractionResponse( void PerformInteractionRequest::SendUIPerformInteractionRequest( application_manager::ApplicationSharedPtr const app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& choice_set_id_list = (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; @@ -518,7 +515,7 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest( void PerformInteractionRequest::SendVRPerformInteractionRequest( application_manager::ApplicationSharedPtr const app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -535,7 +532,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( smart_objects::SmartObject* choice_set = app->FindChoiceSet(choice_list[i].asInt()); if (!choice_set) { - LOGGER_WARN(logger_, "Couldn't found choiset"); + SDL_WARN("Couldn't found choiset"); continue; } msg_params[strings::grammar_id][grammar_id_index++] = @@ -574,7 +571,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( } } } else { - LOGGER_ERROR(logger_, "Can't found choiceSet!"); + SDL_ERROR("Can't found choiceSet!"); } } } @@ -610,7 +607,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( bool PerformInteractionRequest::CheckChoiceSetMenuNames( application_manager::ApplicationSharedPtr const app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& choice_list = (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; @@ -630,7 +627,7 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( } if (!i_choice_set || !j_choice_set) { - LOGGER_ERROR(logger_, "Invalid ID"); + SDL_ERROR("Invalid ID"); SendResponse(false, mobile_apis::Result::INVALID_ID); return false; } @@ -647,7 +644,7 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( .asString(); if (ii_menu_name == jj_menu_name) { - LOGGER_ERROR(logger_, "Choice set has duplicated menu name"); + SDL_ERROR("Choice set has duplicated menu name"); SendResponse(false, mobile_apis::Result::DUPLICATE_NAME, "Choice set has duplicated menu name"); @@ -663,7 +660,7 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( application_manager::ApplicationSharedPtr const app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject& choice_list = (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; @@ -683,7 +680,7 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( } if ((!i_choice_set) || (!j_choice_set)) { - LOGGER_ERROR(logger_, "Invalid ID"); + SDL_ERROR("Invalid ID"); SendResponse(false, mobile_apis::Result::INVALID_ID); return false; } @@ -706,7 +703,7 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( const custom_str::CustomString& vr_cmd_j = jj_vr_commands[jjj].asCustomString(); if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) { - LOGGER_ERROR(logger_, "Choice set has duplicated VR synonym"); + SDL_ERROR("Choice set has duplicated VR synonym"); SendResponse(false, mobile_apis::Result::DUPLICATE_NAME, "Choice set has duplicated VR synonym"); @@ -724,10 +721,10 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( bool PerformInteractionRequest::CheckVrHelpItemPositions( application_manager::ApplicationSharedPtr const app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!(*message_)[strings::msg_params].keyExists(strings::vr_help)) { - LOGGER_DEBUG(logger_, strings::vr_help << " is omitted."); + SDL_DEBUG(strings::vr_help << " is omitted."); return true; } @@ -737,7 +734,7 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions( int32_t position = 1; for (size_t i = 0; i < vr_help.length(); ++i) { if (position != vr_help[i][strings::position].asInt()) { - LOGGER_ERROR(logger_, "Non-sequential vrHelp item position"); + SDL_ERROR("Non-sequential vrHelp item position"); SendResponse(false, mobile_apis::Result::REJECTED, "Non-sequential vrHelp item position"); @@ -749,11 +746,11 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions( } void PerformInteractionRequest::DisablePerformInteraction() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -769,12 +766,12 @@ void PerformInteractionRequest::DisablePerformInteraction() { } bool PerformInteractionRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; str = (*message_)[strings::msg_params][strings::initial_text].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid initial_text syntax check failed"); + SDL_ERROR("Invalid initial_text syntax check failed"); return true; } @@ -788,7 +785,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { for (; it_ip != it_ip_end; ++it_ip) { str = (*it_ip)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid initial_prompt syntax check failed"); + SDL_ERROR("Invalid initial_prompt syntax check failed"); return true; } } @@ -804,7 +801,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { for (; it_hp != it_hp_end; ++it_hp) { str = (*it_hp)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid help_prompt syntax check failed"); + SDL_ERROR("Invalid help_prompt syntax check failed"); return true; } } @@ -820,7 +817,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { for (; it_tp != it_tp_end; ++it_tp) { str = (*it_tp)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid timeout_prompt syntax check failed"); + SDL_ERROR("Invalid timeout_prompt syntax check failed"); return true; } } @@ -836,15 +833,14 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { for (; it_vh != it_vh_end; ++it_vh) { str = (*it_vh)[strings::text].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid vr_help syntax check failed"); + SDL_ERROR("Invalid vr_help syntax check failed"); return true; } if ((*it_vh).keyExists(strings::image)) { str = (*it_vh)[strings::image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid vr_help image value syntax check failed"); + SDL_ERROR("Invalid vr_help image value syntax check failed"); return true; } } @@ -854,7 +850,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { } void PerformInteractionRequest::TerminatePerformInteraction() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -865,7 +861,7 @@ void PerformInteractionRequest::TerminatePerformInteraction() { bool PerformInteractionRequest::CheckChoiceIDFromResponse( ApplicationSharedPtr app, int32_t choice_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const DataAccessor<PerformChoiceSetMap> accessor = app->performinteraction_choice_set_map(); const PerformChoiceSetMap& choice_set_map = accessor.GetData(); @@ -893,7 +889,7 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( ApplicationSharedPtr app, const size_t choice_set_id_list_length, const smart_objects::SmartObject& choice_set_id_list) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); size_t choice_list_length = 0; std::set<uint32_t> choice_id_set; @@ -903,9 +899,7 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( for (size_t i = 0; i < choice_set_id_list_length; ++i) { choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt()); if (!choice_set) { - LOGGER_ERROR( - logger_, - "Couldn't find choiset_id = " << choice_set_id_list[i].asInt()); + SDL_ERROR("Couldn't find choiset_id = " << choice_set_id_list[i].asInt()); return false; } choice_list_length = (*choice_set)[strings::choice_set].length(); @@ -915,10 +909,9 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( ins_res = choice_id_set.insert(choices_list[k][strings::choice_id].asInt()); if (!ins_res.second) { - LOGGER_ERROR(logger_, - "Choise with ID " - << choices_list[k][strings::choice_id].asInt() - << " already exists"); + SDL_ERROR("Choise with ID " + << choices_list[k][strings::choice_id].asInt() + << " already exists"); return false; } } @@ -927,23 +920,23 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( } const bool PerformInteractionRequest::HasHMIResponsesToWait() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return !ui_response_recived_ || !vr_response_recived_; } void PerformInteractionRequest::CheckResponseResultCode() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); mobile_apis::Result::eType resultCode = mobile_apis::Result::INVALID_ENUM; bool result = false; if (mobile_apis::Result::GENERIC_ERROR == vr_resultCode_) { - LOGGER_DEBUG(logger_, "VR response GENERIC_ERROR"); + SDL_DEBUG("VR response GENERIC_ERROR"); resultCode = mobile_apis::Result::GENERIC_ERROR; } else if (mobile_apis::Result::REJECTED == vr_resultCode_) { - LOGGER_DEBUG(logger_, "VR had been rejected."); + SDL_DEBUG("VR had been rejected."); resultCode = mobile_apis::Result::REJECTED; } else if (mobile_apis::Result::WARNINGS == vr_resultCode_ || mobile_apis::Result::UNSUPPORTED_REQUEST == vr_resultCode_) { - LOGGER_DEBUG(logger_, "VR response WARNINGS"); + SDL_DEBUG("VR response WARNINGS"); resultCode = mobile_api::Result::WARNINGS; result = true; } @@ -956,7 +949,7 @@ void PerformInteractionRequest::CheckResponseResultCode() { void PerformInteractionRequest::SendBothModeResponse( const smart_objects::SmartObject& msg_param) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis::Result; bool result = ui_result_ || vr_result_; diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc index 67f3e44454..96ad8aae99 100644 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc +++ b/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc @@ -44,7 +44,7 @@ PerformInteractionResponse::PerformInteractionResponse( PerformInteractionResponse::~PerformInteractionResponse() {} void PerformInteractionResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/put_file_request.cc b/src/components/application_manager/src/commands/mobile/put_file_request.cc index c3a8258486..290f4a7a71 100644 --- a/src/components/application_manager/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/src/commands/mobile/put_file_request.cc @@ -53,7 +53,7 @@ PutFileRequest::PutFileRequest(const MessageSharedPtr& message, PutFileRequest::~PutFileRequest() {} void PutFileRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); @@ -61,7 +61,7 @@ void PutFileRequest::Run() { smart_objects::SmartObject(smart_objects::SmartType_Map); if (!application) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -71,8 +71,7 @@ void PutFileRequest::Run() { application->put_file_in_none_count()) { // If application is in the HMI_NONE level the quantity of allowed // PutFile request is limited by the configuration profile - LOGGER_ERROR(logger_, - "Too many requests from the app with HMILevel HMI_NONE "); + SDL_ERROR("Too many requests from the app with HMILevel HMI_NONE "); SendResponse(false, mobile_apis::Result::REJECTED, "Too many requests from the app with HMILevel HMI_NONE", @@ -81,7 +80,7 @@ void PutFileRequest::Run() { } if (!(*message_)[strings::params].keyExists(strings::binary_data)) { - LOGGER_ERROR(logger_, "Binary data empty"); + SDL_ERROR("Binary data empty"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Binary data empty", @@ -90,7 +89,7 @@ void PutFileRequest::Run() { } if (!(*message_)[strings::msg_params].keyExists(strings::sync_file_name)) { - LOGGER_ERROR(logger_, "No file name"); + SDL_ERROR("No file name"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "No file name", @@ -99,7 +98,7 @@ void PutFileRequest::Run() { } if (!(*message_)[strings::msg_params].keyExists(strings::file_type)) { - LOGGER_ERROR(logger_, "No file type"); + SDL_ERROR("No file type"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "No file type", @@ -157,7 +156,7 @@ void PutFileRequest::Run() { response_params[strings::space_available] = static_cast<uint32_t>(space_available); - LOGGER_ERROR(logger_, "Out of memory"); + SDL_ERROR("Out of memory"); SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY, "Out of memory", @@ -167,7 +166,7 @@ void PutFileRequest::Run() { } if (!file_system::CreateDirectoryRecursively(file_path)) { - LOGGER_ERROR(logger_, "Can't create folder"); + SDL_ERROR("Can't create folder"); SendResponse(false, mobile_apis::Result::GENERIC_ERROR, "Can't create folder.", @@ -176,17 +175,15 @@ void PutFileRequest::Run() { } const std::string full_path = file_path + "/" + sync_file_name_; UNUSED(full_path); - LOGGER_DEBUG(logger_, - "Wrtiting " << binary_data.size() << "bytes to " << full_path - << " (current size is" - << file_system::FileSize(full_path) << ")"); + SDL_DEBUG("Wrtiting " << binary_data.size() << "bytes to " << full_path + << " (current size is" + << file_system::FileSize(full_path) << ")"); mobile_apis::Result::eType save_result = application_manager_.SaveBinary( binary_data, file_path, sync_file_name_, offset_); - LOGGER_DEBUG(logger_, - "New size of " << full_path << " is " - << file_system::FileSize(full_path) << " bytes"); + SDL_DEBUG("New size of " << full_path << " is " + << file_system::FileSize(full_path) << " bytes"); if (!is_system_file) { response_params[strings::space_available] = static_cast<uint32_t>(application->GetAvailableDiskSpace()); @@ -195,7 +192,7 @@ void PutFileRequest::Run() { sync_file_name_ = file_system::ConcatPath(file_path, sync_file_name_); switch (save_result) { case mobile_apis::Result::SUCCESS: { - LOGGER_INFO(logger_, "PutFile is successful"); + SDL_INFO("PutFile is successful"); if (!is_system_file) { AppFile file(sync_file_name_, is_persistent_file_, @@ -203,15 +200,14 @@ void PutFileRequest::Run() { file_type_); if (0 == offset_) { - LOGGER_INFO(logger_, "New file downloading"); + SDL_INFO("New file downloading"); if (!application->AddFile(file)) { - LOGGER_INFO(logger_, - "Couldn't add file to application (File already Exist" - << " in application and was rewritten on FS)"); + SDL_INFO("Couldn't add file to application (File already Exist" + << " in application and was rewritten on FS)"); /* It can be first part of new big file, so we need to update information about it's downloading status and persistence */ if (!application->UpdateFile(file)) { - LOGGER_ERROR(logger_, "Couldn't update file"); + SDL_ERROR("Couldn't update file"); /* If it is impossible to update file, application doesn't know about existing this file */ SendResponse(false, @@ -236,14 +232,14 @@ void PutFileRequest::Run() { break; } default: - LOGGER_WARN(logger_, "PutFile is unsuccessful. Result = " << save_result); + SDL_WARN("PutFile is unsuccessful. Result = " << save_result); SendResponse(false, save_result, "Can't save file", &response_params); break; } } void PutFileRequest::SendOnPutFileNotification() { - LOGGER_INFO(logger_, "SendOnPutFileNotification"); + SDL_INFO("SendOnPutFileNotification"); smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject(smart_objects::SmartType_Map); diff --git a/src/components/application_manager/src/commands/mobile/put_file_response.cc b/src/components/application_manager/src/commands/mobile/put_file_response.cc index 4e4dc5865b..64af7aadb8 100644 --- a/src/components/application_manager/src/commands/mobile/put_file_response.cc +++ b/src/components/application_manager/src/commands/mobile/put_file_response.cc @@ -46,12 +46,12 @@ PutFileResponse::PutFileResponse(const MessageSharedPtr& message, PutFileResponse::~PutFileResponse() {} void PutFileResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOGGER_ERROR(logger_, "Application not registered"); + SDL_ERROR("Application not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc index 89a73bea14..1c5fdc25da 100644 --- a/src/components/application_manager/src/commands/mobile/read_did_request.cc +++ b/src/components/application_manager/src/commands/mobile/read_did_request.cc @@ -47,19 +47,17 @@ ReadDIDRequest::ReadDIDRequest(const MessageSharedPtr& message, ReadDIDRequest::~ReadDIDRequest() {} void ReadDIDRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); - LOGGER_INFO( - logger_, - "Correlation_id :" - << (*message_)[strings::params][strings::correlation_id].asUInt()); + SDL_INFO("Correlation_id :" + << (*message_)[strings::params][strings::correlation_id].asUInt()); if (!app) { - LOGGER_ERROR(logger_, "An application is not registered."); + SDL_ERROR("An application is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -67,13 +65,13 @@ void ReadDIDRequest::Run() { if (app->IsCommandLimitsExceeded( static_cast<mobile_apis::FunctionID::eType>(function_id()), application_manager::TLimitSource::CONFIG_FILE)) { - LOGGER_ERROR(logger_, "ReadDID frequency is too high."); + SDL_ERROR("ReadDID frequency is too high."); SendResponse(false, mobile_apis::Result::REJECTED); return; } if ((*message_)[strings::msg_params][strings::did_location].empty()) { - LOGGER_ERROR(logger_, "INVALID_DATA"); + SDL_ERROR("INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -90,7 +88,7 @@ void ReadDIDRequest::Run() { } void ReadDIDRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -111,7 +109,7 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/read_did_response.cc b/src/components/application_manager/src/commands/mobile/read_did_response.cc index 8f0f651f5a..87c9995a3c 100644 --- a/src/components/application_manager/src/commands/mobile/read_did_response.cc +++ b/src/components/application_manager/src/commands/mobile/read_did_response.cc @@ -44,7 +44,7 @@ ReadDIDResponse::ReadDIDResponse(const MessageSharedPtr& message, ReadDIDResponse::~ReadDIDResponse() {} void ReadDIDResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index d4cdd6baaf..59b2614061 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -144,14 +144,14 @@ RegisterAppInterfaceRequest::RegisterAppInterfaceRequest( RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {} bool RegisterAppInterfaceRequest::Init() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return true; } void RegisterAppInterfaceRequest::Run() { using namespace helpers; - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Connection key is " << connection_key()); + SDL_AUTO_TRACE(); + SDL_DEBUG("Connection key is " << connection_key()); // Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA. // Flag conditional compilation specific to customer is used in order to @@ -162,12 +162,10 @@ void RegisterAppInterfaceRequest::Run() { // wait till HMI started while (!application_manager_.IsStopping() && !application_manager_.IsHMICooperating()) { - LOGGER_DEBUG(logger_, - "Waiting for the HMI... conn_key=" - << connection_key() - << ", correlation_id=" << correlation_id() - << ", default_timeout=" << default_timeout() - << ", thread=" << threads::Thread::CurrentId()); + SDL_DEBUG("Waiting for the HMI... conn_key=" + << connection_key() << ", correlation_id=" << correlation_id() + << ", default_timeout=" << default_timeout() + << ", thread=" << threads::Thread::CurrentId()); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); #if defined(OS_POSIX) @@ -179,7 +177,7 @@ void RegisterAppInterfaceRequest::Run() { } if (application_manager_.IsStopping()) { - LOGGER_WARN(logger_, "The ApplicationManager is stopping!"); + SDL_WARN("The ApplicationManager is stopping!"); return; } @@ -219,7 +217,7 @@ void RegisterAppInterfaceRequest::Run() { mobile_apis::Result::eType coincidence_result = CheckCoincidence(); if (mobile_apis::Result::SUCCESS != coincidence_result) { - LOGGER_ERROR(logger_, "Coincidence check failed."); + SDL_ERROR("Coincidence check failed."); if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) { usage_statistics::AppCounter count_of_rejections_duplicate_name( GetPolicyHandler().GetStatisticManager(), @@ -232,8 +230,7 @@ void RegisterAppInterfaceRequest::Run() { } if (IsWhiteSpaceExist()) { - LOGGER_INFO(logger_, - "Incoming register app interface has contains \t\n \\t \\n"); + SDL_INFO("Incoming register app interface has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -241,7 +238,7 @@ void RegisterAppInterfaceRequest::Run() { application = application_manager_.RegisterApplication(message_); if (!application) { - LOGGER_ERROR(logger_, "Application hasn't been registered!"); + SDL_ERROR("Application hasn't been registered!"); return; } // For resuming application need to restore hmi_app_id from resumeCtrl @@ -305,9 +302,8 @@ void RegisterAppInterfaceRequest::Run() { NULL, &dev_params.device_mac_address, &dev_params.device_connection_type)) { - LOGGER_ERROR(logger_, - "Failed to extract information for device " - << application->device()); + SDL_ERROR("Failed to extract information for device " + << application->device()); } policy::DeviceInfo device_info; @@ -322,7 +318,7 @@ void RegisterAppInterfaceRequest::Run() { } void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject response_params(smart_objects::SmartType_Map); mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; @@ -335,9 +331,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { resumption::ResumeCtrl& resumer = application_manager_.resume_controller(); if (!application) { - LOGGER_ERROR(logger_, - "There is no application for such connection key" << key); - LOGGER_DEBUG(logger_, "Need to start resume data persistent timer"); + SDL_ERROR("There is no application for such connection key" << key); + SDL_DEBUG("Need to start resume data persistent timer"); resumer.OnAppRegistrationEnd(); return; } @@ -358,19 +353,17 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { hmi_capabilities.active_vr_language() || msg_params[strings::hmi_display_language_desired].asInt() != hmi_capabilities.active_ui_language()) { - LOGGER_WARN(logger_, - "Wrong language on registering application " - << application->name().c_str()); - - LOGGER_ERROR( - logger_, - "VR language desired code is " - << msg_params[strings::language_desired].asInt() - << " , active VR language code is " - << hmi_capabilities.active_vr_language() << ", UI language code is " - << msg_params[strings::hmi_display_language_desired].asInt() - << " , active UI language code is " - << hmi_capabilities.active_ui_language()); + SDL_WARN("Wrong language on registering application " + << application->name().c_str()); + + SDL_ERROR("VR language desired code is " + << msg_params[strings::language_desired].asInt() + << " , active VR language code is " + << hmi_capabilities.active_vr_language() + << ", UI language code is " + << msg_params[strings::hmi_display_language_desired].asInt() + << " , active UI language code is " + << hmi_capabilities.active_ui_language()); result_code = mobile_apis::Result::WRONG_LANGUAGE; } @@ -523,13 +516,12 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { if (resumption) { hash_id = (*message_)[strings::msg_params][strings::hash_id].asString(); if (!resumer.CheckApplicationHash(application, hash_id)) { - LOGGER_WARN(logger_, - "Hash from RAI does not match to saved resume data."); + SDL_WARN("Hash from RAI does not match to saved resume data."); result_code = mobile_apis::Result::RESUME_FAILED; add_info = "Hash from RAI does not match to saved resume data."; need_restore_vr = false; } else if (!resumer.CheckPersistenceFilesForResumption(application)) { - LOGGER_WARN(logger_, "Persistent data is missing."); + SDL_WARN("Persistent data is missing."); result_code = mobile_apis::Result::RESUME_FAILED; add_info = "Persistent data is missing."; need_restore_vr = false; @@ -572,7 +564,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( using namespace smart_objects; SmartObjectSPtr notification = utils::MakeShared<SmartObject>(SmartType_Map); if (!notification) { - LOGGER_ERROR(logger_, "Failed to create smart object"); + SDL_ERROR("Failed to create smart object"); return; } @@ -656,8 +648,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( if (-1 == session_observer.GetDataOnDeviceID( handle, &device_name, NULL, &mac_address, &transport_type)) { - LOGGER_ERROR(logger_, - "Failed to extract information for device " << handle); + SDL_ERROR("Failed to extract information for device " << handle); } device_info[strings::name] = device_name; @@ -675,7 +666,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( } mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -689,7 +680,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { // name check const custom_str::CustomString& cur_name = (*it)->name(); if (app_name.CompareIgnoreCase(cur_name)) { - LOGGER_ERROR(logger_, "Application name is known already."); + SDL_ERROR("Application name is known already."); return mobile_apis::Result::DUPLICATE_NAME; } @@ -700,7 +691,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { CoincidencePredicateVR v(app_name); if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { - LOGGER_ERROR(logger_, "Application name is known already."); + SDL_ERROR("Application name is known already."); return mobile_apis::Result::DUPLICATE_NAME; } } @@ -712,7 +703,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { CoincidencePredicateVR v(cur_name); if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { - LOGGER_ERROR(logger_, "vr_synonyms duplicated with app_name ."); + SDL_ERROR("vr_synonyms duplicated with app_name ."); return mobile_apis::Result::DUPLICATE_NAME; } } // end vr check @@ -723,7 +714,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { } // method end mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO(AOleynik): Check is necessary to allow register application in case // of disabled policy // Remove this check, when HMI will support policy @@ -741,7 +732,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { mobile_app_id, &app_nicknames, &app_hmi_types); if (!init_result) { - LOGGER_ERROR(logger_, "Error during initial application data check."); + SDL_ERROR("Error during initial application data check."); return mobile_apis::Result::INVALID_DATA; } @@ -751,7 +742,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { policy::StringArray::const_iterator it = std::find_if(app_nicknames.begin(), app_nicknames.end(), compare); if (app_nicknames.end() == it) { - LOGGER_WARN(logger_, "Application name was not found in nicknames list."); + SDL_WARN("Application name was not found in nicknames list."); // App should be unregistered, if its name is not present in nicknames // list usage_statistics::AppCounter count_of_rejections_nickname_mismatch( @@ -837,7 +828,7 @@ void RegisterAppInterfaceRequest::FillDeviceInfo( } bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const custom_string::CustomString mobile_app_id = (*message_)[strings::msg_params][strings::app_id].asCustomString(); @@ -858,12 +849,12 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { } bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; str = (*message_)[strings::msg_params][strings::app_name].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid app_name syntax check failed"); + SDL_ERROR("Invalid app_name syntax check failed"); return true; } @@ -877,7 +868,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { for (; it_tn != it_tn_end; ++it_tn) { str = (*it_tn)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid tts_name syntax check failed"); + SDL_ERROR("Invalid tts_name syntax check failed"); return true; } } @@ -888,8 +879,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid ngn_media_screen_app_name syntax check failed"); + SDL_ERROR("Invalid ngn_media_screen_app_name syntax check failed"); return true; } } @@ -904,7 +894,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { for (; it_vs != it_vs_end; ++it_vs) { str = (*it_vs).asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid vr_synonyms syntax check failed"); + SDL_ERROR("Invalid vr_synonyms syntax check failed"); return true; } } @@ -913,7 +903,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::hash_id)) { str = (*message_)[strings::msg_params][strings::hash_id].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid hash_id syntax check failed"); + SDL_ERROR("Invalid hash_id syntax check failed"); return true; } } @@ -924,8 +914,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::device_info] [strings::hardware].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid device_info hardware syntax check failed"); + SDL_ERROR("Invalid device_info hardware syntax check failed"); return true; } } @@ -935,8 +924,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::device_info] [strings::firmware_rev].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid device_info firmware_rev syntax check failed"); + SDL_ERROR("Invalid device_info firmware_rev syntax check failed"); return true; } } @@ -946,7 +934,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::device_info][strings::os] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid device_info os syntax check failed"); + SDL_ERROR("Invalid device_info os syntax check failed"); return true; } } @@ -956,8 +944,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::device_info] [strings::os_version].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid device_info os_version syntax check failed"); + SDL_ERROR("Invalid device_info os_version syntax check failed"); return true; } } @@ -967,8 +954,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::device_info] [strings::carrier].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid device_info carrier syntax check failed"); + SDL_ERROR("Invalid device_info carrier syntax check failed"); return true; } } @@ -977,7 +963,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::app_id)) { str = (*message_)[strings::msg_params][strings::app_id].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid app_id syntax check failed"); + SDL_ERROR("Invalid app_id syntax check failed"); return true; } } @@ -992,9 +978,8 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam( using namespace hmi_response; if (!vehicle_type.keyExists(param) || vehicle_type[param].empty()) { if (!backup_value.empty()) { - LOGGER_DEBUG(logger_, - param << " is missing." - "Will be replaced with policy table value."); + SDL_DEBUG(param << " is missing." + "Will be replaced with policy table value."); vehicle_type[param] = backup_value; } else { vehicle_type.erase(param); diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc index 0048dca8d6..cb82b12a57 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc @@ -43,7 +43,7 @@ namespace application_manager { namespace commands { void RegisterAppInterfaceResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; bool success = (*message_)[strings::msg_params][strings::success].asBool(); @@ -70,9 +70,8 @@ void RegisterAppInterfaceResponse::Run() { application_manager::ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, - "Application with connection key " << connection_key() - << " is not registered."); + SDL_ERROR("Application with connection key " << connection_key() + << " is not registered."); return; } @@ -90,7 +89,7 @@ void RegisterAppInterfaceResponse::Run() { void RegisterAppInterfaceResponse::SetHeartBeatTimeout( uint32_t connection_key, const std::string& mobile_app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); policy::PolicyHandlerInterface& policy_handler = application_manager_.GetPolicyHandler(); if (policy_handler.PolicyEnabled()) { @@ -100,7 +99,7 @@ void RegisterAppInterfaceResponse::SetHeartBeatTimeout( connection_key, timeout); } } else { - LOGGER_INFO(logger_, "Policy is turn off"); + SDL_INFO("Policy is turn off"); } } diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc index deca172f3e..ee72a11a0a 100644 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc @@ -54,14 +54,14 @@ ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest( ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() {} void ResetGlobalPropertiesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOGGER_ERROR(logger_, "No application associated with session key"); + SDL_ERROR("No application associated with session key"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -70,7 +70,7 @@ void ResetGlobalPropertiesRequest::Run() { (*message_)[strings::msg_params][strings::properties].length(); // if application waits for sending ttsGlobalProperties need to remove this // application from tts_global_properties_app_list_ - LOGGER_INFO(logger_, "RemoveAppFromTTSGlobalPropertiesList"); + SDL_INFO("RemoveAppFromTTSGlobalPropertiesList"); application_manager_.RemoveAppFromTTSGlobalPropertiesList(app_id); bool helpt_promt = false; @@ -186,7 +186,7 @@ void ResetGlobalPropertiesRequest::Run() { bool ResetGlobalPropertiesRequest::ResetHelpPromt( application_manager::ApplicationSharedPtr app) { if (!app) { - LOGGER_ERROR(logger_, "Null pointer"); + SDL_ERROR("Null pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } @@ -199,7 +199,7 @@ bool ResetGlobalPropertiesRequest::ResetHelpPromt( bool ResetGlobalPropertiesRequest::ResetTimeoutPromt( application_manager::ApplicationSharedPtr const app) { if (!app) { - LOGGER_ERROR(logger_, "Null pointer"); + SDL_ERROR("Null pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } @@ -226,7 +226,7 @@ bool ResetGlobalPropertiesRequest::ResetTimeoutPromt( bool ResetGlobalPropertiesRequest::ResetVrHelpTitleItems( application_manager::ApplicationSharedPtr const app) { if (!app) { - LOGGER_ERROR(logger_, "Null pointer"); + SDL_ERROR("Null pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } @@ -237,7 +237,7 @@ bool ResetGlobalPropertiesRequest::ResetVrHelpTitleItems( } void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); ApplicationSharedPtr application = @@ -245,21 +245,21 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetGlobalProperties: { - LOGGER_INFO(logger_, "Received UI_SetGlobalProperties event"); + SDL_INFO("Received UI_SetGlobalProperties event"); is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); break; } case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - LOGGER_INFO(logger_, "Received TTS_SetGlobalProperties event"); + SDL_INFO("Received TTS_SetGlobalProperties event"); is_tts_received_ = true; tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } @@ -297,7 +297,7 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { &(message[strings::msg_params])); if (!application) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -305,7 +305,7 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { application->UpdateHash(); } } else { - LOGGER_WARN(logger_, "unable to find application: " << connection_key()); + SDL_WARN("unable to find application: " << connection_key()); } } diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc index 008c278f10..b624cce0be 100644 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc +++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc @@ -44,7 +44,7 @@ ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse( ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() {} void ResetGlobalPropertiesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc index c5da96dde2..b367cf3ff8 100644 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc @@ -68,12 +68,12 @@ bool ScrollableMessageRequest::Init() { } void ScrollableMessageRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -87,7 +87,7 @@ void ScrollableMessageRequest::Run() { application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOGGER_ERROR(logger_, "Wrong soft buttons parameters!"); + SDL_ERROR("Wrong soft buttons parameters!"); SendResponse(false, processing_result); return; } @@ -114,19 +114,19 @@ void ScrollableMessageRequest::Run() { } void ScrollableMessageRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOGGER_INFO(logger_, "Received UI_OnResetTimeout event"); + SDL_INFO("Received UI_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::UI_ScrollableMessage: { - LOGGER_INFO(logger_, "Received UI_ScrollableMessage event"); + SDL_INFO("Received UI_ScrollableMessage event"); mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( @@ -149,7 +149,7 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); break; } } diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc index ad3920b834..821fe57201 100644 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc +++ b/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc @@ -44,7 +44,7 @@ ScrollableMessageResponse::ScrollableMessageResponse( : CommandResponseImpl(message, application_manager) {} void ScrollableMessageResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( (*message_)[strings::msg_params][strings::result_code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/send_location_request.cc b/src/components/application_manager/src/commands/mobile/send_location_request.cc index e57f0e9605..12eb089100 100644 --- a/src/components/application_manager/src/commands/mobile/send_location_request.cc +++ b/src/components/application_manager/src/commands/mobile/send_location_request.cc @@ -51,14 +51,13 @@ SendLocationRequest::~SendLocationRequest() {} void SendLocationRequest::Run() { using namespace hmi_apis; using smart_objects::SmartObject; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); + SDL_ERROR("An application with connection key " << connection_key() + << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -94,7 +93,7 @@ void SendLocationRequest::Run() { } if (IsWhiteSpaceExist()) { - LOGGER_ERROR(logger_, "Strings contain invalid characters"); + SDL_ERROR("Strings contain invalid characters"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -108,7 +107,7 @@ void SendLocationRequest::Run() { } if (!CheckFieldsCompatibility()) { - LOGGER_ERROR(logger_, "CheckFieldsCompatibility failed"); + SDL_ERROR("CheckFieldsCompatibility failed"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -121,7 +120,7 @@ void SendLocationRequest::Run() { app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { - LOGGER_ERROR(logger_, "VerifyImage INVALID_DATA!"); + SDL_ERROR("VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); return; } @@ -136,12 +135,12 @@ void SendLocationRequest::Run() { } void SendLocationRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); namespace Result = mobile_apis::Result; using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); if (hmi_apis::FunctionID::Navigation_SendLocation == event.id()) { - LOGGER_INFO(logger_, "Received Navigation_SendLocation event"); + SDL_INFO("Received Navigation_SendLocation event"); mobile_apis::Result::eType result_code = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt())); @@ -154,7 +153,7 @@ void SendLocationRequest::on_event(const event_engine::Event& event) { SendResponse(result, result_code, NULL, &(message[strings::params])); return; } - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); } bool SendLocationRequest::CheckFieldsCompatibility() { @@ -168,13 +167,11 @@ bool SendLocationRequest::CheckFieldsCompatibility() { const bool address_exist = msg_params.keyExists(strings::address); if (latitude_degrees_exist ^ longitude_degrees_exist) { - LOGGER_DEBUG(logger_, - "latitude and longitude should be provided only in pair"); + SDL_DEBUG("latitude and longitude should be provided only in pair"); return false; } if (!address_exist && !longitude_degrees_exist && !latitude_degrees_exist) { - LOGGER_DEBUG(logger_, - "address or latitude/longtitude should should be provided"); + SDL_DEBUG("address or latitude/longtitude should should be provided"); return false; } @@ -190,7 +187,7 @@ void insert_if_contains( } bool SendLocationRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::vector<utils::custom_string::CustomString> fields_to_check; const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -228,8 +225,7 @@ bool SendLocationRequest::IsWhiteSpaceExist() { for (; it != fields_to_check.end(); ++it) { const std::string& str = it->AsMBString(); if (!CheckSyntax(str, false)) { - LOGGER_ERROR(logger_, - "string '" << str << "'' contains invalid characters"); + SDL_ERROR("string '" << str << "'' contains invalid characters"); return true; } } @@ -239,7 +235,7 @@ bool SendLocationRequest::IsWhiteSpaceExist() { bool SendLocationRequest::CheckHMICapabilities( std::vector<hmi_apis::Common_TextFieldName::eType>& fields_names) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace smart_objects; using namespace hmi_apis; @@ -250,7 +246,7 @@ bool SendLocationRequest::CheckHMICapabilities( const HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); if (!hmi_capabilities.is_ui_cooperating()) { - LOGGER_ERROR(logger_, "UI is not supported."); + SDL_ERROR("UI is not supported."); return false; } @@ -273,7 +269,7 @@ bool SendLocationRequest::CheckHMICapabilities( } if (!fields_names.empty()) { - LOGGER_ERROR(logger_, "Some fields are not supported by capabilities"); + SDL_ERROR("Some fields are not supported by capabilities"); return false; } return true; diff --git a/src/components/application_manager/src/commands/mobile/send_location_response.cc b/src/components/application_manager/src/commands/mobile/send_location_response.cc index ac3b30905c..6b4f213909 100644 --- a/src/components/application_manager/src/commands/mobile/send_location_response.cc +++ b/src/components/application_manager/src/commands/mobile/send_location_response.cc @@ -46,7 +46,7 @@ SendLocationResponse::SendLocationResponse( SendLocationResponse::~SendLocationResponse() {} void SendLocationResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc index 18965c94a9..baa2d350aa 100644 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc @@ -56,12 +56,12 @@ SetAppIconRequest::SetAppIconRequest(const MessageSharedPtr& message, SetAppIconRequest::~SetAppIconRequest() {} void SetAppIconRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -75,7 +75,7 @@ void SetAppIconRequest::Run() { sync_file_name); if (!file_system::FileExists(full_file_path)) { - LOGGER_ERROR(logger_, "No such file " << full_file_path); + SDL_ERROR("No such file " << full_file_path); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -113,14 +113,13 @@ void SetAppIconRequest::CopyToIconStorage( if (!application_manager_.protocol_handler() .get_settings() .enable_protocol_4()) { - LOGGER_WARN(logger_, - "Icon copying skipped, since protocol ver. 4 is not enabled."); + SDL_WARN("Icon copying skipped, since protocol ver. 4 is not enabled."); return; } std::vector<uint8_t> file_content; if (!file_system::ReadBinaryFile(path_to_file, file_content)) { - LOGGER_ERROR(logger_, "Can't read icon file: " << path_to_file); + SDL_ERROR("Can't read icon file: " << path_to_file); return; } @@ -131,11 +130,10 @@ void SetAppIconRequest::CopyToIconStorage( const uint64_t file_size = file_system::FileSize(path_to_file); if (storage_max_size < file_size) { - LOGGER_ERROR(logger_, - "Icon size (" << file_size << ") is bigger, than " - " icons storage maximum size (" - << storage_max_size << ")." - "Copying skipped."); + SDL_ERROR("Icon size (" << file_size << ") is bigger, than " + " icons storage maximum size (" + << storage_max_size << ")." + "Copying skipped."); return; } @@ -146,9 +144,9 @@ void SetAppIconRequest::CopyToIconStorage( application_manager_.get_settings().app_icons_amount_to_remove(); if (!icons_amount) { - LOGGER_DEBUG(logger_, - "No icons will be deleted, since amount icons to remove " - "is zero. Icon saving skipped."); + SDL_DEBUG( + "No icons will be deleted, since amount icons to remove " + "is zero. Icon saving skipped."); return; } @@ -160,27 +158,24 @@ void SetAppIconRequest::CopyToIconStorage( application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR( - logger_, - "Can't get application for connection key: " << connection_key()); + SDL_ERROR("Can't get application for connection key: " << connection_key()); return; } const std::string icon_path = file_system::ConcatPath(icon_storage, app->policy_app_id()); if (!file_system::CreateFile(icon_path)) { - LOGGER_ERROR(logger_, "Can't create icon: " << icon_path); + SDL_ERROR("Can't create icon: " << icon_path); return; } if (!file_system::Write(icon_path, file_content)) { - LOGGER_ERROR(logger_, "Can't write icon: " << icon_path); + SDL_ERROR("Can't write icon: " << icon_path); return; } - LOGGER_DEBUG(logger_, - "Icon was successfully copied from :" << path_to_file << " to " - << icon_path); + SDL_DEBUG("Icon was successfully copied from :" << path_to_file << " to " + << icon_path); return; } @@ -202,17 +197,16 @@ void SetAppIconRequest::RemoveOldestIcons(const std::string& storage, for (size_t counter = 0; counter < icons_amount; ++counter) { if (!icon_modification_time.size()) { - LOGGER_ERROR(logger_, "No more icons left for deletion."); + SDL_ERROR("No more icons left for deletion."); return; } const std::string file_name = icon_modification_time.begin()->second; const std::string file_path = file_system::ConcatPath(storage, file_name); if (!file_system::DeleteFile(file_path)) { - LOGGER_DEBUG(logger_, "Error while deleting icon " << file_path); + SDL_DEBUG("Error while deleting icon " << file_path); } icon_modification_time.erase(icon_modification_time.begin()); - LOGGER_DEBUG(logger_, - "Old icon " << file_path << " was deleted successfully."); + SDL_DEBUG("Old icon " << file_path << " was deleted successfully."); } } @@ -227,7 +221,7 @@ bool SetAppIconRequest::IsEnoughSpaceForIcon(const uint64_t icon_size) const { } void SetAppIconRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -247,7 +241,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!message_.valid() || !app.valid()) { - LOGGER_ERROR(logger_, "NULL pointer."); + SDL_ERROR("NULL pointer."); return; } @@ -256,15 +250,14 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { [strings::value].asString(); app->set_app_icon_path(path); - LOGGER_INFO(logger_, - "Icon path was set to '" << app->app_icon_path() << "'"); + SDL_INFO("Icon path was set to '" << app->app_icon_path() << "'"); } SendResponse(result, result_code, NULL, &(message[strings::msg_params])); break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc index 20b551127f..fbb8e2d54d 100644 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc @@ -44,7 +44,7 @@ SetAppIconResponse::SetAppIconResponse(const MessageSharedPtr& message, SetAppIconResponse::~SetAppIconResponse() {} void SetAppIconResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc index 50051a7ef1..a62f07cb23 100644 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc @@ -45,12 +45,12 @@ SetDisplayLayoutRequest::SetDisplayLayoutRequest( SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {} void SetDisplayLayoutRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationConstSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -62,12 +62,12 @@ void SetDisplayLayoutRequest::Run() { } void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_SetDisplayLayout: { - LOGGER_INFO(logger_, "Received UI_SetDisplayLayout event"); + SDL_INFO("Received UI_SetDisplayLayout event"); mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( @@ -96,7 +96,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc index 1c4ede699a..98f8817399 100644 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc @@ -45,7 +45,7 @@ SetDisplayLayoutResponse::SetDisplayLayoutResponse( SetDisplayLayoutResponse::~SetDisplayLayoutResponse() {} void SetDisplayLayoutResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc index 88e6e80b8b..2df230197b 100644 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc @@ -55,7 +55,7 @@ SetGlobalPropertiesRequest::SetGlobalPropertiesRequest( SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {} void SetGlobalPropertiesRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -63,9 +63,8 @@ void SetGlobalPropertiesRequest::Run() { ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, - "No application associated with connection key " - << connection_key()); + SDL_ERROR("No application associated with connection key " + << connection_key()); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -85,8 +84,7 @@ void SetGlobalPropertiesRequest::Run() { app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { - LOGGER_ERROR(logger_, - "MessageHelper::VerifyImage return " << verification_result); + SDL_ERROR("MessageHelper::VerifyImage return " << verification_result); SendResponse(false, verification_result); return; } @@ -98,14 +96,14 @@ void SetGlobalPropertiesRequest::Run() { (*message_)[strings::msg_params][strings::vr_help], app, application_manager_)) { - LOGGER_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!"); + SDL_ERROR("MessageHelper::VerifyImage return INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } } if (IsWhiteSpaceExist()) { - LOGGER_ERROR(logger_, "White spaces found"); + SDL_ERROR("White spaces found"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -121,18 +119,16 @@ void SetGlobalPropertiesRequest::Run() { // check VR params if (is_vr_help_title_present ^ is_vr_help_present) { - LOGGER_ERROR(logger_, - "Reject because of vr_help or vr_help_title only provided"); + SDL_ERROR("Reject because of vr_help or vr_help_title only provided"); SendResponse(false, mobile_apis::Result::REJECTED); return; } if (is_vr_help_title_present && is_vr_help_present) { - LOGGER_DEBUG(logger_, "VRHelp params presents"); + SDL_DEBUG("VRHelp params presents"); if (!CheckVrHelpItemsOrder(msg_params[strings::vr_help])) { - LOGGER_ERROR(logger_, - "VR Help Items contains nonsequential positions" - << " (e.g. [1,2,4]) or not started from 1"); + SDL_ERROR("VR Help Items contains nonsequential positions" + << " (e.g. [1,2,4]) or not started from 1"); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -146,17 +142,17 @@ void SetGlobalPropertiesRequest::Run() { params[strings::app_id] = app->app_id(); SendUIRequest(params, true); } else { - LOGGER_DEBUG(logger_, "VRHelp params does not present"); + SDL_DEBUG("VRHelp params does not present"); DCHECK_OR_RETURN_VOID(!is_vr_help_title_present && !is_vr_help_present); smart_objects::SmartObject params = smart_objects::SmartObject(smart_objects::SmartType_Map); if (ValidateVRHelpTitle(app->vr_help_title())) { - LOGGER_DEBUG(logger_, "App already contains VRHelp data"); + SDL_DEBUG("App already contains VRHelp data"); } else { if (!PrepareUIRequestDefaultVRHelpData(app, params)) { - LOGGER_ERROR(logger_, "default VRHElp data could not be generated"); + SDL_ERROR("default VRHElp data could not be generated"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -165,7 +161,7 @@ void SetGlobalPropertiesRequest::Run() { // Preparing data if (params.empty()) { - LOGGER_DEBUG(logger_, "No UI info provided"); + SDL_DEBUG("No UI info provided"); } else { params[strings::app_id] = app->app_id(); SendUIRequest(params, true); @@ -174,7 +170,7 @@ void SetGlobalPropertiesRequest::Run() { // check TTS params if (is_help_prompt_present || is_timeout_prompt_present) { - LOGGER_DEBUG(logger_, "TTS params presents"); + SDL_DEBUG("TTS params presents"); smart_objects::SmartObject params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -195,7 +191,7 @@ void SetGlobalPropertiesRequest::Run() { bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder( const smart_objects::SmartObject& vr_help) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(vr_help.getType() == smart_objects::SmartType_Array, false); const size_t vr_help_length = vr_help.length(); DCHECK_OR_RETURN(vr_help_length > 0, false); @@ -205,9 +201,8 @@ bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder( vr_help.getElement(j).getElement(strings::position).asUInt(); // Elements shall start from 1 and increment one by one if (position != (j + 1)) { - LOGGER_ERROR(logger_, - "VR help items order is wrong" - << " at " << j << ", position value:" << position); + SDL_ERROR("VR help items order is wrong" + << " at " << j << ", position value:" << position); return false; } } @@ -215,33 +210,33 @@ bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder( } void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_SetGlobalProperties: { - LOGGER_INFO(logger_, "Received UI_SetGlobalProperties event"); + SDL_INFO("Received UI_SetGlobalProperties event"); is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); break; } case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - LOGGER_INFO(logger_, "Received TTS_SetGlobalProperties event"); + SDL_INFO("Received TTS_SetGlobalProperties event"); is_tts_received_ = true; tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } if (IsPendingResponseExist()) { - LOGGER_DEBUG(logger_, "Continue waiting for response"); + SDL_DEBUG("Continue waiting for response"); return; } @@ -294,7 +289,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { result, result_code, return_info, &(message[strings::msg_params])); if (!application) { - LOGGER_DEBUG(logger_, "NULL pointer."); + SDL_DEBUG("NULL pointer."); return; } @@ -305,10 +300,10 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { bool SetGlobalPropertiesRequest::ValidateVRHelpTitle( const smart_objects::SmartObject* const vr_help_so_ptr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (vr_help_so_ptr) { const std::string& vr_help = vr_help_so_ptr->asString(); - LOGGER_TRACE(logger_, "App contains vr_help_title: \"" << vr_help << '"'); + SDL_TRACE("App contains vr_help_title: \"" << vr_help << '"'); return !vr_help.empty(); } return false; @@ -318,7 +313,7 @@ void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData( const ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params, smart_objects::SmartObject& out_params) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); app->set_vr_help_title(msg_params.getElement(strings::vr_help_title)); @@ -330,10 +325,10 @@ void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData( bool SetGlobalPropertiesRequest::PrepareUIRequestDefaultVRHelpData( const ApplicationSharedPtr app, smart_objects::SmartObject& out_params) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(app, false); - LOGGER_DEBUG(logger_, "Generate default VRHelp data"); + SDL_DEBUG("Generate default VRHelp data"); const DataAccessor<CommandsMap> accessor = app->commands_map(); const CommandsMap& cmdMap = accessor.GetData(); @@ -344,7 +339,7 @@ bool SetGlobalPropertiesRequest::PrepareUIRequestDefaultVRHelpData( ++command_it) { const smart_objects::SmartObject& command = *command_it->second; if (!command.keyExists(strings::vr_commands)) { - LOGGER_ERROR(logger_, "VR synonyms are empty"); + SDL_ERROR("VR synonyms are empty"); return false; } // use only first @@ -367,7 +362,7 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData( const ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params, smart_objects::SmartObject& out_params) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); const bool is_menu_title_present = @@ -395,7 +390,7 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData( void SetGlobalPropertiesRequest::SendTTSRequest( const smart_objects::SmartObject& params, bool use_events) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendHMIRequest( hmi_apis::FunctionID::TTS_SetGlobalProperties, ¶ms, use_events); is_tts_send_ = true; @@ -403,7 +398,7 @@ void SetGlobalPropertiesRequest::SendTTSRequest( void SetGlobalPropertiesRequest::SendUIRequest( const smart_objects::SmartObject& params, bool use_events) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendHMIRequest( hmi_apis::FunctionID::UI_SetGlobalProperties, ¶ms, use_events); is_ui_send_ = true; @@ -415,7 +410,7 @@ bool SetGlobalPropertiesRequest::IsPendingResponseExist() { bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters( const smart_objects::SmartObject& params) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return params.keyExists(strings::help_prompt) || params.keyExists(strings::timeout_prompt) || params.keyExists(strings::vr_help_title) || @@ -426,7 +421,7 @@ bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters( } bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str; const smart_objects::SmartObject& msg_params = @@ -442,7 +437,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { for (; it_hp != it_hp_end; ++it_hp) { str = (*it_hp)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid help_prompt syntax check failed"); + SDL_ERROR("Invalid help_prompt syntax check failed"); return true; } } @@ -458,7 +453,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { for (; it_tp != it_tp_end; ++it_tp) { str = (*it_tp)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid timeout_prompt syntax check failed"); + SDL_ERROR("Invalid timeout_prompt syntax check failed"); return true; } } @@ -474,15 +469,14 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { for (; it_vh != it_vh_end; ++it_vh) { str = (*it_vh)[strings::text].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid vr_help text syntax check failed"); + SDL_ERROR("Invalid vr_help text syntax check failed"); return true; } if ((*it_vh).keyExists(strings::image)) { str = (*it_vh)[strings::image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid vr_help image value syntax check failed"); + SDL_ERROR("Invalid vr_help image value syntax check failed"); return true; } } // if image exists @@ -492,7 +486,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { if (msg_params.keyExists(strings::menu_icon)) { str = msg_params[strings::menu_icon][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid menu_icon value syntax check failed"); + SDL_ERROR("Invalid menu_icon value syntax check failed"); return true; } } @@ -500,7 +494,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { if (msg_params.keyExists(strings::vr_help_title)) { str = msg_params[strings::vr_help_title].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid vr_help_title value syntax check failed"); + SDL_ERROR("Invalid vr_help_title value syntax check failed"); return true; } } @@ -508,7 +502,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { if (msg_params.keyExists(strings::menu_title)) { str = msg_params[strings::menu_title].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid menu_title value syntax check failed"); + SDL_ERROR("Invalid menu_title value syntax check failed"); return true; } } @@ -526,9 +520,9 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { for (; it_lcl != it_lcl_end; ++it_lcl) { str = (*it_lcl).asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid keyboard_properties " - "limited_character_list syntax check failed"); + SDL_ERROR( + "Invalid keyboard_properties " + "limited_character_list syntax check failed"); return true; } } @@ -541,9 +535,9 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { .asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid keyboard_properties " - "auto_complete_text syntax check failed"); + SDL_ERROR( + "Invalid keyboard_properties " + "auto_complete_text syntax check failed"); return true; } } diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc index 73ff608460..752a6f5eb2 100644 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc @@ -44,7 +44,7 @@ SetGlobalPropertiesResponse::SetGlobalPropertiesResponse( SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() {} void SetGlobalPropertiesResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/set_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_icon_request.cc index eabcd1138e..0059c0e34a 100644 --- a/src/components/application_manager/src/commands/mobile/set_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_icon_request.cc @@ -50,12 +50,12 @@ SetIconRequest::SetIconRequest(const MessageSharedPtr& message, SetIconRequest::~SetIconRequest() {} void SetIconRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -69,7 +69,7 @@ void SetIconRequest::Run() { sync_file_name); if (!file_system::FileExists(full_file_path)) { - LOGGER_ERROR(logger_, "No such file " << full_file_path); + SDL_ERROR("No such file " << full_file_path); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -99,7 +99,7 @@ void SetIconRequest::Run() { } void SetIconRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -119,15 +119,14 @@ void SetIconRequest::on_event(const event_engine::Event& event) { [strings::value].asString(); app->set_app_icon_path(path); - LOGGER_INFO(logger_, - "Icon path was set to '" << app->app_icon_path() << "'"); + SDL_INFO("Icon path was set to '" << app->app_icon_path() << "'"); } SendResponse(result, result_code, NULL, &(message[strings::msg_params])); break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } diff --git a/src/components/application_manager/src/commands/mobile/set_icon_response.cc b/src/components/application_manager/src/commands/mobile/set_icon_response.cc index dcbc0c8dca..19d28020f6 100644 --- a/src/components/application_manager/src/commands/mobile/set_icon_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_icon_response.cc @@ -45,7 +45,7 @@ SetIconResponse::SetIconResponse(const MessageSharedPtr& message, SetIconResponse::~SetIconResponse() {} void SetIconResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc index 2e6c5a38c5..92edce550c 100644 --- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc @@ -47,18 +47,18 @@ SetMediaClockRequest::SetMediaClockRequest( SetMediaClockRequest::~SetMediaClockRequest() {} void SetMediaClockRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); return; } if (!app->is_media_application()) { - LOGGER_ERROR(logger_, "Application is not media application"); + SDL_ERROR("Application is not media application"); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -78,7 +78,7 @@ void SetMediaClockRequest::Run() { } void SetMediaClockRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -93,7 +93,7 @@ void SetMediaClockRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } @@ -108,7 +108,7 @@ bool SetMediaClockRequest::isDataValid() { if (update_mode == mobile_apis::UpdateMode::COUNTUP || update_mode == mobile_apis::UpdateMode::COUNTDOWN) { if (!msg_params.keyExists(strings::start_time)) { - LOGGER_INFO(logger_, "Invalid data"); + SDL_INFO("Invalid data"); return false; } @@ -133,13 +133,13 @@ bool SetMediaClockRequest::isDataValid() { (update_mode == mobile_apis::UpdateMode::COUNTDOWN)) || ((end_time_in_seconds < start_time_in_seconds) && (update_mode == mobile_apis::UpdateMode::COUNTUP))) { - LOGGER_INFO(logger_, "Invalid data"); + SDL_INFO("Invalid data"); return false; } } } - LOGGER_INFO(logger_, "Data is valid"); + SDL_INFO("Data is valid"); return true; } diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc index 3c5a1dfed4..52a8cf21a7 100644 --- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc +++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc @@ -44,7 +44,7 @@ SetMediaClockTimerResponse::SetMediaClockTimerResponse( SetMediaClockTimerResponse::~SetMediaClockTimerResponse() {} void SetMediaClockTimerResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc index 3eed49da44..63b1d21171 100644 --- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc @@ -51,19 +51,19 @@ ShowConstantTBTRequest::ShowConstantTBTRequest( ShowConstantTBTRequest::~ShowConstantTBTRequest() {} void ShowConstantTBTRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); return; } // SDLAQ-CRS-664, VC3.1 if ((*message_)[strings::msg_params].empty()) { - LOGGER_ERROR(logger_, "INVALID_DATA!"); + SDL_ERROR("INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -73,8 +73,7 @@ void ShowConstantTBTRequest::Run() { msg_params = (*message_)[strings::msg_params]; if (IsWhiteSpaceExist()) { - LOGGER_ERROR(logger_, - "Incoming show constant TBT has contains \t\n \\t \\n"); + SDL_ERROR("Incoming show constant TBT has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -88,7 +87,7 @@ void ShowConstantTBTRequest::Run() { application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOGGER_ERROR(logger_, "INVALID_DATA!"); + SDL_ERROR("INVALID_DATA!"); SendResponse(false, processing_result); return; } @@ -98,7 +97,7 @@ void ShowConstantTBTRequest::Run() { verification_result = MessageHelper::VerifyImage( msg_params[strings::turn_icon], app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { - LOGGER_ERROR(logger_, "VerifyImage INVALID_DATA!"); + SDL_ERROR("VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); return; } @@ -108,7 +107,7 @@ void ShowConstantTBTRequest::Run() { verification_result = MessageHelper::VerifyImage( msg_params[strings::next_turn_icon], app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { - LOGGER_ERROR(logger_, "VerifyImage INVALID_DATA!"); + SDL_ERROR("VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); return; } @@ -176,12 +175,12 @@ void ShowConstantTBTRequest::Run() { } void ShowConstantTBTRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_ShowConstantTBT: { - LOGGER_INFO(logger_, "Received Navigation_ShowConstantTBT event"); + SDL_INFO("Received Navigation_ShowConstantTBT event"); std::string return_info; mobile_apis::Result::eType result_code = @@ -206,21 +205,21 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); break; } } } bool ShowConstantTBTRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::turn_icon)) { str = (*message_)[strings::msg_params][strings::turn_icon][strings::value] .asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid turn_icon value syntax check failed"); + SDL_ERROR("Invalid turn_icon value syntax check failed"); return true; } } @@ -229,7 +228,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::next_turn_icon] [strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid next_turn_icon value syntax check failed"); + SDL_ERROR("Invalid next_turn_icon value syntax check failed"); return true; } } @@ -238,8 +237,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::navigation_text_1] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid navigation_text_1 value syntax check failed"); + SDL_ERROR("Invalid navigation_text_1 value syntax check failed"); return true; } } @@ -248,8 +246,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::navigation_text_2] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid navigation_text_2 value syntax check failed"); + SDL_ERROR("Invalid navigation_text_2 value syntax check failed"); return true; } } @@ -257,7 +254,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::eta)) { str = (*message_)[strings::msg_params][strings::eta].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid eta value syntax check failed"); + SDL_ERROR("Invalid eta value syntax check failed"); return true; } } @@ -266,7 +263,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::total_distance].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid total_distance value syntax check failed"); + SDL_ERROR("Invalid total_distance value syntax check failed"); return true; } } @@ -276,8 +273,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::time_to_destination] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid time_to_destination value syntax check failed"); + SDL_ERROR("Invalid time_to_destination value syntax check failed"); return true; } } diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc index a0973d467d..cec622118f 100644 --- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc +++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc @@ -46,7 +46,7 @@ ShowConstantTBTResponse::ShowConstantTBTResponse( ShowConstantTBTResponse::~ShowConstantTBTResponse() {} void ShowConstantTBTResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc index 6dcb83c6f2..9476986bc9 100644 --- a/src/components/application_manager/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_request.cc @@ -49,24 +49,24 @@ ShowRequest::ShowRequest(const MessageSharedPtr& message, ShowRequest::~ShowRequest() {} void ShowRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } // SDLAQ-CRS-494, VC3.1 if ((*message_)[strings::msg_params].empty()) { - LOGGER_ERROR(logger_, strings::msg_params << " is empty."); + SDL_ERROR(strings::msg_params << " is empty."); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } if (!CheckStringsOfShowRequest()) { - LOGGER_ERROR(logger_, "Incorrect characters in string"); + SDL_ERROR("Incorrect characters in string"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -84,7 +84,7 @@ void ShowRequest::Run() { } if (mobile_apis::Result::SUCCESS != processing_result) { - LOGGER_ERROR(logger_, "Processing of soft buttons failed."); + SDL_ERROR("Processing of soft buttons failed."); SendResponse(false, processing_result); return; } @@ -98,7 +98,7 @@ void ShowRequest::Run() { app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { - LOGGER_ERROR(logger_, "Image verification failed."); + SDL_ERROR("Image verification failed."); SendResponse(false, verification_result); return; } @@ -110,7 +110,7 @@ void ShowRequest::Run() { app, application_manager_); if (mobile_apis::Result::SUCCESS != verification_result) { - LOGGER_ERROR(logger_, "Image verification failed."); + SDL_ERROR("Image verification failed."); SendResponse(false, verification_result); return; } @@ -218,14 +218,14 @@ void ShowRequest::Run() { } void ShowRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_Show: { - LOGGER_DEBUG(logger_, "Received UI_Show event."); + SDL_DEBUG("Received UI_Show event."); std::string response_info; mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( @@ -249,62 +249,62 @@ void ShowRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event " << event.id()); + SDL_ERROR("Received unknown event " << event.id()); break; } } } bool ShowRequest::CheckStringsOfShowRequest() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str; if ((*message_)[strings::msg_params].keyExists(strings::main_field_4)) { str = (*message_)[strings::msg_params][strings::main_field_4].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid main_field_4 syntax check failed"); + SDL_ERROR("Invalid main_field_4 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::main_field_3)) { str = (*message_)[strings::msg_params][strings::main_field_3].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid main_field_3 syntax check failed"); + SDL_ERROR("Invalid main_field_3 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::main_field_2)) { str = (*message_)[strings::msg_params][strings::main_field_2].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid main_field_2 syntax check failed"); + SDL_ERROR("Invalid main_field_2 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::main_field_1)) { str = (*message_)[strings::msg_params][strings::main_field_1].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid main_field_1 syntax check failed"); + SDL_ERROR("Invalid main_field_1 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::status_bar)) { str = (*message_)[strings::msg_params][strings::status_bar].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid status_bar syntax check failed"); + SDL_ERROR("Invalid status_bar syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::media_clock)) { str = (*message_)[strings::msg_params][strings::media_clock].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid media_clock syntax check failed"); + SDL_ERROR("Invalid media_clock syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::media_track)) { str = (*message_)[strings::msg_params][strings::media_track].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid media_track syntax check failed"); + SDL_ERROR("Invalid media_track syntax check failed"); return false; } } @@ -314,7 +314,7 @@ bool ShowRequest::CheckStringsOfShowRequest() { for (size_t i = 0; i < custom_presets_array.length(); ++i) { str = custom_presets_array[i].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid custom_presets syntax check failed"); + SDL_ERROR("Invalid custom_presets syntax check failed"); return false; } } @@ -324,7 +324,7 @@ bool ShowRequest::CheckStringsOfShowRequest() { str = (*message_)[strings::msg_params][strings::graphic][strings::value] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid graphic value syntax check failed"); + SDL_ERROR("Invalid graphic value syntax check failed"); return false; } } @@ -333,8 +333,7 @@ bool ShowRequest::CheckStringsOfShowRequest() { str = (*message_)[strings::msg_params][strings::secondary_graphic] [strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid secondary_graphic value syntax check failed"); + SDL_ERROR("Invalid secondary_graphic value syntax check failed"); return false; } } diff --git a/src/components/application_manager/src/commands/mobile/show_response.cc b/src/components/application_manager/src/commands/mobile/show_response.cc index 4f823b9b86..a6a0dca884 100644 --- a/src/components/application_manager/src/commands/mobile/show_response.cc +++ b/src/components/application_manager/src/commands/mobile/show_response.cc @@ -46,7 +46,7 @@ ShowResponse::ShowResponse(const MessageSharedPtr& message, ShowResponse::~ShowResponse() {} void ShowResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc index af942a7fe7..996957e971 100644 --- a/src/components/application_manager/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/src/commands/mobile/slider_request.cc @@ -62,20 +62,20 @@ bool SliderRequest::Init() { } void SliderRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!application) { - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if ((*message_)[strings::msg_params][strings::num_ticks].asInt() < (*message_)[strings::msg_params][strings::position].asInt()) { - LOGGER_ERROR(logger_, "INVALID_DATA"); + SDL_ERROR("INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -84,7 +84,7 @@ void SliderRequest::Run() { if (1 < (*message_)[strings::msg_params][strings::slider_footer].length()) { if ((*message_)[strings::msg_params][strings::num_ticks].asUInt() != (*message_)[strings::msg_params][strings::slider_footer].length()) { - LOGGER_ERROR(logger_, "INVALID_DATA"); + SDL_ERROR("INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -92,7 +92,7 @@ void SliderRequest::Run() { } if (IsWhiteSpaceExist()) { - LOGGER_ERROR(logger_, "Incoming slider has contains \t\n \\t \\n"); + SDL_ERROR("Incoming slider has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -110,7 +110,7 @@ void SliderRequest::Run() { } void SliderRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; using namespace smart_objects; using namespace hmi_apis; @@ -119,18 +119,18 @@ void SliderRequest::on_event(const event_engine::Event& event) { const event_engine::Event::EventID event_id = event.id(); if (event_id == FunctionID::UI_OnResetTimeout) { - LOGGER_INFO(logger_, "Received UI_OnResetTimeout event"); + SDL_INFO("Received UI_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); return; } if (event_id != FunctionID::UI_Slider) { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } - LOGGER_DEBUG(logger_, "Received UI_Slider event"); + SDL_DEBUG("Received UI_Slider event"); const Common_Result::eType response_code = static_cast<Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -147,9 +147,8 @@ void SliderRequest::on_event(const event_engine::Event& event) { response_msg_params[strings::slider_position] = message[strings::params][strings::data][strings::slider_position]; } else { - LOGGER_ERROR(logger_, - strings::slider_position << " field is absent" - " in response."); + SDL_ERROR(strings::slider_position << " field is absent" + " in response."); response_msg_params[strings::slider_position] = 0; } } @@ -164,12 +163,12 @@ void SliderRequest::on_event(const event_engine::Event& event) { } bool SliderRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; str = (*message_)[strings::msg_params][strings::slider_header].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid slider_header value syntax check failed"); + SDL_ERROR("Invalid slider_header value syntax check failed"); return true; } @@ -183,7 +182,7 @@ bool SliderRequest::IsWhiteSpaceExist() { for (; it_sf != it_sf_end; ++it_sf) { str = (*it_sf).asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid slider_footer syntax check failed"); + SDL_ERROR("Invalid slider_footer syntax check failed"); return true; } } diff --git a/src/components/application_manager/src/commands/mobile/slider_response.cc b/src/components/application_manager/src/commands/mobile/slider_response.cc index fe82d64249..50184e9a8f 100644 --- a/src/components/application_manager/src/commands/mobile/slider_response.cc +++ b/src/components/application_manager/src/commands/mobile/slider_response.cc @@ -44,7 +44,7 @@ SliderResponse::SliderResponse(const MessageSharedPtr& message, SliderResponse::~SliderResponse() {} void SliderResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/speak_request.cc b/src/components/application_manager/src/commands/mobile/speak_request.cc index 4ab12d935b..d672b3a224 100644 --- a/src/components/application_manager/src/commands/mobile/speak_request.cc +++ b/src/components/application_manager/src/commands/mobile/speak_request.cc @@ -50,20 +50,20 @@ SpeakRequest::SpeakRequest(const MessageSharedPtr& message, SpeakRequest::~SpeakRequest() {} void SpeakRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if (IsWhiteSpaceExist()) { - LOGGER_ERROR(logger_, - "Incoming speak has contains \\t\\n \\\\t \\\\n " - " text contains only whitespace in ttsChunks"); + SDL_ERROR( + "Incoming speak has contains \\t\\n \\\\t \\\\n " + " text contains only whitespace in ttsChunks"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -77,23 +77,23 @@ void SpeakRequest::Run() { } void SpeakRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); switch (event.id()) { case hmi_apis::FunctionID::TTS_Speak: { - LOGGER_INFO(logger_, "Received TTS_Speak event"); + SDL_INFO("Received TTS_Speak event"); ProcessTTSSpeakResponse(event.smart_object()); break; } case hmi_apis::FunctionID::TTS_OnResetTimeout: { - LOGGER_INFO(logger_, "Received TTS_OnResetTimeout event"); + SDL_INFO("Received TTS_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); break; } } @@ -101,14 +101,14 @@ void SpeakRequest::on_event(const event_engine::Event& event) { void SpeakRequest::ProcessTTSSpeakResponse( const smart_objects::SmartObject& message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -143,7 +143,7 @@ void SpeakRequest::ProcessTTSSpeakResponse( } bool SpeakRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) { @@ -156,7 +156,7 @@ bool SpeakRequest::IsWhiteSpaceExist() { for (; it_tc != it_tc_end; ++it_tc) { str = (*it_tc)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOGGER_ERROR(logger_, "Invalid tts_chunks syntax check failed"); + SDL_ERROR("Invalid tts_chunks syntax check failed"); return true; } } diff --git a/src/components/application_manager/src/commands/mobile/speak_response.cc b/src/components/application_manager/src/commands/mobile/speak_response.cc index 638ca95a9b..dcb3f47225 100644 --- a/src/components/application_manager/src/commands/mobile/speak_response.cc +++ b/src/components/application_manager/src/commands/mobile/speak_response.cc @@ -47,7 +47,7 @@ SpeakResponse::SpeakResponse(const MessageSharedPtr& message, SpeakResponse::~SpeakResponse() {} void SpeakResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc index f3bc03aabb..1dd697e39c 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc @@ -46,12 +46,12 @@ SubscribeButtonRequest::SubscribeButtonRequest( SubscribeButtonRequest::~SubscribeButtonRequest() {} void SubscribeButtonRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); + SDL_ERROR("APPLICATION_NOT_REGISTERED"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -61,21 +61,20 @@ void SubscribeButtonRequest::Run() { (*message_)[str::msg_params][str::button_name].asUInt()); if (!IsSubscriptionAllowed(app, btn_id)) { - LOGGER_ERROR(logger_, "Subscribe on button " << btn_id << " isn't allowed"); + SDL_ERROR("Subscribe on button " << btn_id << " isn't allowed"); SendResponse(false, mobile_apis::Result::REJECTED); return; } if (!CheckHMICapabilities(btn_id)) { - LOGGER_ERROR(logger_, - "Subscribe on button " - << btn_id << " isn't allowed by HMI capabilities"); + SDL_ERROR("Subscribe on button " << btn_id + << " isn't allowed by HMI capabilities"); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); return; } if (app->IsSubscribedToButton(btn_id)) { - LOGGER_ERROR(logger_, "Already subscribed to button " << btn_id); + SDL_ERROR("Already subscribed to button " << btn_id); SendResponse(false, mobile_apis::Result::IGNORED); return; } @@ -108,11 +107,11 @@ bool SubscribeButtonRequest::CheckHMICapabilities( mobile_apis::ButtonName::eType button) { using namespace smart_objects; using namespace mobile_apis; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const HMICapabilities& hmi_caps = application_manager_.hmi_capabilities(); if (!hmi_caps.is_ui_cooperating()) { - LOGGER_ERROR(logger_, "UI is not supported by HMI."); + SDL_ERROR("UI is not supported by HMI."); return false; } diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc index 4245d5ff10..81b3624acd 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc @@ -44,12 +44,12 @@ SubscribeButtonResponse::SubscribeButtonResponse( SubscribeButtonResponse::~SubscribeButtonResponse() {} void SubscribeButtonResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // check if response false if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOGGER_ERROR(logger_, "Success = false"); + SDL_ERROR("Success = false"); SendResponse(false); return; } diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc index fff6775d62..f84f679777 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc @@ -99,12 +99,12 @@ Subrequest subrequests[] = { #endif // #ifdef HMI_DBUS_API void SubscribeVehicleDataRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -132,11 +132,10 @@ void SubscribeVehicleDataRequest::Run() { VehicleDataType key_type = it->second; if (app->IsSubscribedToIVI(key_type)) { - LOGGER_DEBUG(logger_, - "App with connection key " - << connection_key() - << " is subscribed already for VehicleDataType: " - << key_type); + SDL_DEBUG("App with connection key " + << connection_key() + << " is subscribed already for VehicleDataType: " + << key_type); ++subscribed_items; vi_already_subscribed_by_this_app_.insert(key_type); response_params[key_name][strings::data_type] = key_type; @@ -146,21 +145,18 @@ void SubscribeVehicleDataRequest::Run() { } if (IsSomeoneSubscribedFor(key_type)) { - LOGGER_DEBUG(logger_, - "There are apps subscribed already for " - "VehicleDataType: " - << key_type); + SDL_DEBUG( + "There are apps subscribed already for " + "VehicleDataType: " + << key_type); if (!app->SubscribeToIVI(static_cast<uint32_t>(key_type))) { - LOGGER_ERROR( - logger_, - "Unable to subscribe for VehicleDataType: " << key_type); + SDL_ERROR("Unable to subscribe for VehicleDataType: " << key_type); continue; } - LOGGER_DEBUG( - logger_, - "App with connection key " - << connection_key() - << " have been subscribed for VehicleDataType: " << key_type); + SDL_DEBUG("App with connection key " + << connection_key() + << " have been subscribed for VehicleDataType: " + << key_type); ++subscribed_items; vi_already_subscribed_by_another_apps_.insert(key_type); response_params[key_name][strings::data_type] = key_type; @@ -172,11 +168,10 @@ void SubscribeVehicleDataRequest::Run() { msg_params[key_name] = is_key_enabled; if (app->SubscribeToIVI(static_cast<uint32_t>(key_type))) { - LOGGER_DEBUG( - logger_, - "App with connection key " - << connection_key() - << " have been subscribed for VehicleDataType: " << key_type); + SDL_DEBUG("App with connection key " + << connection_key() + << " have been subscribed for VehicleDataType: " + << key_type); ++subscribed_items; } } @@ -233,8 +228,7 @@ void SubscribeVehicleDataRequest::Run() { hmi_requests_.push_back(hmi_request); } } - LOGGER_DEBUG(logger_, - hmi_requests_.size() << " requests are going to be sent to HMI"); + SDL_DEBUG(hmi_requests_.size() << " requests are going to be sent to HMI"); // Send subrequests for (HmiRequests::const_iterator it = hmi_requests_.begin(); @@ -249,13 +243,13 @@ void SubscribeVehicleDataRequest::Run() { } void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); if (hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData != event.id()) { - LOGGER_ERROR(logger_, "Received unknown event."); + SDL_ERROR("Received unknown event."); return; } @@ -263,7 +257,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { application_manager_.application(CommandRequestImpl::connection_key()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer."); + SDL_ERROR("NULL pointer."); return; } @@ -298,10 +292,8 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { static_cast<mobile_apis::Result::eType>(it->status)) { status = mobile_api::Result::eType::GENERIC_ERROR; } - LOGGER_TRACE(logger_, - "Status from HMI: " << it->status - << ", so response status become " - << status); + SDL_TRACE("Status from HMI: " + << it->status << ", so response status become " << status); } else { any_arg_success = true; } @@ -316,7 +308,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { response_params[it->str] = it->value; } } - LOGGER_DEBUG(logger_, "All HMI requests are complete"); + SDL_DEBUG("All HMI requests are complete"); const bool result = any_arg_success; SendResponse(any_arg_success, status, NULL, &response_params); if (result) { @@ -367,7 +359,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { void SubscribeVehicleDataRequest::AddAlreadySubscribedVI( smart_objects::SmartObject& msg_params) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis; VehicleInfoSubscriptions::const_iterator it_same_app = vi_already_subscribed_by_this_app_.begin(); @@ -389,7 +381,7 @@ void SubscribeVehicleDataRequest::AddAlreadySubscribedVI( void SubscribeVehicleDataRequest::UnsubscribeFailedSubscriptions( ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const VehicleData& vehicle_data = MessageHelper::vehicle_data(); VehicleData::const_iterator it = vehicle_data.begin(); @@ -397,12 +389,10 @@ void SubscribeVehicleDataRequest::UnsubscribeFailedSubscriptions( if (msg_params.keyExists(it->first)) { if (msg_params[it->first][strings::result_code].asInt() != hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS) { - LOGGER_DEBUG(logger_, - "Subscription for VehicleDataType " - << it->first - << " is unsuccessfull. " - "Unsubscribing app with connection key " - << connection_key() << " from it."); + SDL_DEBUG("Subscription for VehicleDataType " + << it->first << " is unsuccessfull. " + "Unsubscribing app with connection key " + << connection_key() << " from it."); app->UnsubscribeFromIVI(it->second); } } @@ -419,7 +409,7 @@ struct SubscribedToIVIPredicate { }; bool SubscribeVehicleDataRequest::IsSomeoneSubscribedFor( const uint32_t param_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SubscribedToIVIPredicate finder(param_id); DataAccessor<ApplicationSet> accessor = application_manager_.applications(); ApplicationSetConstIt it = std::find_if( diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc index d5a7279d40..364c376801 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc @@ -45,7 +45,7 @@ SubscribeVehicleDataResponse::SubscribeVehicleDataResponse( SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() {} void SubscribeVehicleDataResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc index 6a15aafb8a..534dd44bb8 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc @@ -12,14 +12,13 @@ SubscribeWayPointsRequest::SubscribeWayPointsRequest( SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {} void SubscribeWayPointsRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); + SDL_ERROR("An application with connection key " << connection_key() + << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -40,12 +39,12 @@ void SubscribeWayPointsRequest::Run() { } void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: { - LOGGER_INFO(logger_, "Received Navigation_SubscribeWayPoints event"); + SDL_INFO("Received Navigation_SubscribeWayPoints event"); mobile_apis::Result::eType result_code = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt())); @@ -57,7 +56,7 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); break; } } diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc index a17de31013..c3e151da83 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc @@ -12,7 +12,7 @@ SubscribeWayPointsResponse::SubscribeWayPointsResponse( SubscribeWayPointsResponse::~SubscribeWayPointsResponse() {} void SubscribeWayPointsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/system_request.cc b/src/components/application_manager/src/commands/mobile/system_request.cc index 2e38f56714..5e7a1db9c1 100644 --- a/src/components/application_manager/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/src/commands/mobile/system_request.cc @@ -52,7 +52,7 @@ Copyright (c) 2016, Ford Motor Company #endif namespace application_manager { -CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") +SDL_CREATE_LOGGER("ApplicationManager") namespace { #ifdef ENABLE_LOG @@ -75,11 +75,10 @@ class QueryAppsDataValidator { : data_(object), manager_(manager) {} bool Validate() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!data_.isValid()) { - LOGGER_ERROR(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response is not valid."); + SDL_ERROR(kQueryAppsValidationFailedPrefix + << "QueryApps response is not valid."); return false; } if (!HasResponseKey()) { @@ -91,10 +90,9 @@ class QueryAppsDataValidator { private: bool HasResponseKey() const { if (!data_.keyExists(json::response)) { - LOGGER_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response does not contain '" - << json::response << "' parameter."); + SDL_WARN(kQueryAppsValidationFailedPrefix + << "QueryApps response does not contain '" << json::response + << "' parameter."); return false; } return true; @@ -104,34 +102,27 @@ class QueryAppsDataValidator { const std::string& language_name, SynonymsMap& synonyms_map) const { if (!language[language_name].keyExists(json::vrSynonyms)) { - LOGGER_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "'languages.vrSynonyms' doesn't exist"); + SDL_WARN(kQueryAppsValidationFailedPrefix + << "'languages.vrSynonyms' doesn't exist"); return false; } const smart_objects::SmartArray* synonyms_array = language[language_name][json::vrSynonyms].asArray(); if (!synonyms_array) { - LOGGER_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSynonyms is not array."); + SDL_WARN(kQueryAppsValidationFailedPrefix << "vrSynonyms is not array."); return false; } const size_t synonyms_array_size = synonyms_array->size(); if (synonyms_array_size < kVrArraySizeMin) { - LOGGER_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSynomyms array has [" << synonyms_array_size - << "] size < allowed min size [" << kVrArraySizeMin - << "]"); + SDL_WARN(kQueryAppsValidationFailedPrefix + << "vrSynomyms array has [" << synonyms_array_size + << "] size < allowed min size [" << kVrArraySizeMin << "]"); return false; } if (synonyms_array_size > kVrArraySizeMax) { - LOGGER_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSynomyms array size [" << synonyms_array_size - << "] exceeds maximum allowed size [" << kVrArraySizeMax - << "]"); + SDL_WARN(kQueryAppsValidationFailedPrefix + << "vrSynomyms array size [" << synonyms_array_size + << "] exceeds maximum allowed size [" << kVrArraySizeMax << "]"); return false; } @@ -139,19 +130,16 @@ class QueryAppsDataValidator { const smart_objects::SmartObject& synonym = (*synonyms_array)[idx]; const std::string vrSynonym = synonym.asString(); if (vrSynonym.length() > kVrSynonymLengthMax) { - LOGGER_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSYnomym item [" << idx << "] exceeds max length [" - << vrSynonym.length() << "]>[" << kVrSynonymLengthMax - << "]"); + SDL_WARN(kQueryAppsValidationFailedPrefix + << "vrSYnomym item [" << idx << "] exceeds max length [" + << vrSynonym.length() << "]>[" << kVrSynonymLengthMax << "]"); return false; } if (vrSynonym.length() < kVrSynonymLengthMin) { - LOGGER_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSYnomym item [" << idx << "] length [" - << vrSynonym.length() << "] is less then min length [" - << kVrSynonymLengthMin << "] allowed."); + SDL_WARN(kQueryAppsValidationFailedPrefix + << "vrSYnomym item [" << idx << "] length [" + << vrSynonym.length() << "] is less then min length [" + << kVrSynonymLengthMin << "] allowed."); return false; } // Verify duplicates @@ -159,11 +147,9 @@ class QueryAppsDataValidator { synonyms_map.find(language_name); if (synonyms_map_iter != synonyms_map.end()) { if (!(*synonyms_map_iter).second.insert(vrSynonym).second) { - LOGGER_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSYnomym item already defined [" - << vrSynonym.c_str() << "] for language [" - << language_name << "]"); + SDL_WARN(kQueryAppsValidationFailedPrefix + << "vrSYnomym item already defined [" << vrSynonym.c_str() + << "] for language [" << language_name << "]"); return false; } } @@ -193,13 +179,13 @@ SystemRequest::SystemRequest(const MessageSharedPtr& message, SystemRequest::~SystemRequest() {} void SystemRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!(application.valid())) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -251,13 +237,12 @@ void SystemRequest::Run() { application_manager_.get_settings().system_files_path(), file_name); if ((*message_)[strings::params].keyExists(strings::binary_data)) { - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "Binary data is present. Trying to save it to: " << binary_data_folder); if (mobile_apis::Result::SUCCESS != (application_manager_.SaveBinary( binary_data, binary_data_folder, file_name, 0))) { - LOGGER_DEBUG(logger_, "Binary data can't be saved."); + SDL_DEBUG("Binary data can't be saved."); SendResponse(false, mobile_apis::Result::GENERIC_ERROR); return; } @@ -265,15 +250,14 @@ void SystemRequest::Run() { std::string app_full_file_path = binary_data_folder; app_full_file_path += file_name; - LOGGER_DEBUG(logger_, - "Binary data is not present. Trying to find file " - << file_name << " within previously saved app file in " - << binary_data_folder); + SDL_DEBUG("Binary data is not present. Trying to find file " + << file_name << " within previously saved app file in " + << binary_data_folder); const AppFile* file = application->GetFile(app_full_file_path); if (!file || !file->is_download_complete || !file_system::MoveFile(app_full_file_path, file_dst_path)) { - LOGGER_DEBUG(logger_, "Binary data not found."); + SDL_DEBUG("Binary data not found."); std::string origin_file_name; if ((*message_)[strings::msg_params].keyExists(strings::file_name)) { @@ -282,16 +266,16 @@ void SystemRequest::Run() { } if (!(mobile_apis::RequestType::HTTP == request_type && 0 == origin_file_name.compare(kIVSU))) { - LOGGER_DEBUG(logger_, "Binary data required. Reject"); + SDL_DEBUG("Binary data required. Reject"); SendResponse(false, mobile_apis::Result::REJECTED); return; } - LOGGER_DEBUG(logger_, "IVSU does not require binary data. Continue"); + SDL_DEBUG("IVSU does not require binary data. Continue"); } processing_file_ = file_dst_path; } - LOGGER_DEBUG(logger_, "Binary data ok."); + SDL_DEBUG("Binary data ok."); if (mobile_apis::RequestType::QUERY_APPS == request_type) { using namespace NsSmartDeviceLink::NsJSONHandler::Formatters; @@ -302,7 +286,7 @@ void SystemRequest::Run() { JsonValue::ParseResult parse_result = JsonValue::Parse(json_string); if (!parse_result.second) { - LOGGER_DEBUG(logger_, "Unable to parse query_app json file."); + SDL_DEBUG("Unable to parse query_app json file."); return; } JsonValue& root_json = parse_result.first; @@ -338,7 +322,7 @@ void SystemRequest::Run() { } void SystemRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -358,7 +342,7 @@ void SystemRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!(application.valid())) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); return; } @@ -370,7 +354,7 @@ void SystemRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); return; } } @@ -379,16 +363,14 @@ void SystemRequest::on_event(const event_engine::Event& event) { bool SystemRequest::ValidateQueryAppData( const smart_objects::SmartObject& data) const { if (!data.isValid()) { - LOGGER_ERROR(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response is not valid."); + SDL_ERROR(kQueryAppsValidationFailedPrefix + << "QueryApps response is not valid."); return false; } if (!data.keyExists(json::response)) { - LOGGER_ERROR(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response does not contain '" - << json::response << "' parameter."); + SDL_ERROR(kQueryAppsValidationFailedPrefix + << "QueryApps response does not contain '" << json::response + << "' parameter."); return false; } diff --git a/src/components/application_manager/src/commands/mobile/system_response.cc b/src/components/application_manager/src/commands/mobile/system_response.cc index c5ca29bd57..4c2a4acbb6 100644 --- a/src/components/application_manager/src/commands/mobile/system_response.cc +++ b/src/components/application_manager/src/commands/mobile/system_response.cc @@ -44,7 +44,7 @@ SystemResponse::SystemResponse(const MessageSharedPtr& message, SystemResponse::~SystemResponse() {} void SystemResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc index 5503663fb9..83dc858a63 100644 --- a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc @@ -39,11 +39,11 @@ namespace application_manager { namespace commands { void UnregisterAppInterfaceRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!application_manager_.application(connection_key())) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); return; } diff --git a/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc b/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc index 9daca7b663..c8556ae3ca 100644 --- a/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc +++ b/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc @@ -38,7 +38,7 @@ namespace application_manager { namespace commands { void UnregisterAppInterfaceResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SendResponse((*message_)[strings::msg_params][strings::success].asBool()); } diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc index 72dac720bf..f8443d5767 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc @@ -47,12 +47,12 @@ UnsubscribeButtonRequest::UnsubscribeButtonRequest( UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {} void UnsubscribeButtonRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); + SDL_ERROR("APPLICATION_NOT_REGISTERED"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -62,7 +62,7 @@ void UnsubscribeButtonRequest::Run() { if (!app->IsSubscribedToButton( static_cast<mobile_apis::ButtonName::eType>(btn_id))) { - LOGGER_ERROR(logger_, "App doesn't subscibe to button " << btn_id); + SDL_ERROR("App doesn't subscibe to button " << btn_id); SendResponse(false, mobile_apis::Result::IGNORED); return; } diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc index c1c17b791f..985ff353ed 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc @@ -44,14 +44,14 @@ UnsubscribeButtonResponse::UnsubscribeButtonResponse( UnsubscribeButtonResponse::~UnsubscribeButtonResponse() {} void UnsubscribeButtonResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; // check if response false if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOGGER_ERROR(logger_, "Success = false"); + SDL_ERROR("Success = false"); SendResponse(false); return; } diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc index 6f50cf598c..67ca654c90 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc @@ -104,12 +104,12 @@ Subrequest subrequests[] = { #endif // #ifdef HMI_DBUS_API void UnsubscribeVehicleDataRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, "NULL pointer"); + SDL_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -144,25 +144,23 @@ void UnsubscribeVehicleDataRequest::Run() { } if (!app->UnsubscribeFromIVI(static_cast<uint32_t>(key_type))) { - LOGGER_ERROR(logger_, - "Unable to unsubscribe from " - "VehicleDataType: " - << key_type); + SDL_ERROR( + "Unable to unsubscribe from " + "VehicleDataType: " + << key_type); continue; } - LOGGER_DEBUG(logger_, - "Unsubscribed app with connection key " - << connection_key() - << " from VehicleDataType: " << key_type); + SDL_DEBUG("Unsubscribed app with connection key " + << connection_key() << " from VehicleDataType: " << key_type); ++unsubscribed_items; if (IsSomeoneSubscribedFor(key_type)) { - LOGGER_DEBUG(logger_, - "There are another apps still subscribed for " - "VehicleDataType: " - << key_type); + SDL_DEBUG( + "There are another apps still subscribed for " + "VehicleDataType: " + << key_type); vi_still_subscribed_by_another_apps_.insert(key_type); response_params[key_name][strings::data_type] = key_type; @@ -226,8 +224,7 @@ void UnsubscribeVehicleDataRequest::Run() { hmi_requests_.push_back(hmi_request); } } - LOGGER_INFO(logger_, - hmi_requests_.size() << " requests are going to be sent to HMI"); + SDL_INFO(hmi_requests_.size() << " requests are going to be sent to HMI"); // Send subrequests for (HmiRequests::const_iterator it = hmi_requests_.begin(); @@ -242,13 +239,13 @@ void UnsubscribeVehicleDataRequest::Run() { } void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); if (hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData != event.id()) { - LOGGER_ERROR(logger_, "Received unknown event."); + SDL_ERROR("Received unknown event."); return; } @@ -283,10 +280,8 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { static_cast<mobile_apis::Result::eType>(it->status)) { status = mobile_api::Result::eType::GENERIC_ERROR; } - LOGGER_TRACE(logger_, - "Status from HMI: " << it->status - << ", so response status become " - << status); + SDL_TRACE("Status from HMI: " + << it->status << ", so response status become " << status); } else { any_arg_success = true; } @@ -301,7 +296,7 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { } } - LOGGER_INFO(logger_, "All HMI requests are complete"); + SDL_INFO("All HMI requests are complete"); if (true == any_arg_success) { SetAllowedToTerminate(false); } @@ -359,7 +354,7 @@ struct SubscribedToIVIPredicate { }; bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor( const uint32_t param_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SubscribedToIVIPredicate finder(param_id); DataAccessor<ApplicationSet> accessor = application_manager_.applications(); ApplicationSetConstIt it = std::find_if( @@ -369,7 +364,7 @@ bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor( void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI( smart_objects::SmartObject& response) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis; VehicleInfoSubscriptions::const_iterator it_same_app = vi_already_unsubscribed_by_this_app_.begin(); @@ -389,15 +384,14 @@ void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI( } void UnsubscribeVehicleDataRequest::UpdateHash() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (application) { application->UpdateHash(); } else { - LOGGER_ERROR(logger_, - "Application with connection_key = " << connection_key() - << " doesn't exist."); + SDL_ERROR("Application with connection_key = " << connection_key() + << " doesn't exist."); } application_manager_.TerminateRequest(connection_key(), correlation_id()); } diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc index 6b21c8704d..8504b3e1c3 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc @@ -43,14 +43,14 @@ UnsubscribeVehicleDataResponse::UnsubscribeVehicleDataResponse( UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() {} void UnsubscribeVehicleDataResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; // check if response false if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOGGER_ERROR(logger_, "Success = false"); + SDL_ERROR("Success = false"); SendResponse(false); return; } diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc index ebe687d67a..f6e10c42d3 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc @@ -12,14 +12,13 @@ UnSubscribeWayPointsRequest::UnSubscribeWayPointsRequest( UnSubscribeWayPointsRequest::~UnSubscribeWayPointsRequest() {} void UnSubscribeWayPointsRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOGGER_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); + SDL_ERROR("An application with connection key " << connection_key() + << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -34,12 +33,12 @@ void UnSubscribeWayPointsRequest::Run() { } void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: { - LOGGER_INFO(logger_, "Received Navigation_UnSubscribeWayPoints event"); + SDL_INFO("Received Navigation_UnSubscribeWayPoints event"); mobile_apis::Result::eType result_code = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt())); @@ -51,7 +50,7 @@ void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); break; } } diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc index fa2b34c395..bb86a7a0bf 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc @@ -12,7 +12,7 @@ UnsubscribeWayPointsResponse::UnsubscribeWayPointsResponse( UnsubscribeWayPointsResponse::~UnsubscribeWayPointsResponse() {} void UnsubscribeWayPointsResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc index ab1cdb6f8c..97cd10fb87 100644 --- a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc +++ b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc @@ -53,20 +53,19 @@ UpdateTurnListRequest::UpdateTurnListRequest( UpdateTurnListRequest::~UpdateTurnListRequest() {} void UpdateTurnListRequest::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOGGER_ERROR(logger_, "Application is not registered"); + SDL_ERROR("Application is not registered"); return; } if (IsWhiteSpaceExist()) { - LOGGER_ERROR(logger_, - "Incoming update turn list has contains \t\n \\t \\n"); + SDL_ERROR("Incoming update turn list has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -80,7 +79,7 @@ void UpdateTurnListRequest::Run() { application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOGGER_ERROR(logger_, "INVALID_DATA!"); + SDL_ERROR("INVALID_DATA!"); SendResponse(false, processing_result); return; } @@ -94,7 +93,7 @@ void UpdateTurnListRequest::Run() { MessageHelper::VerifyImage(turn_list_array[i][strings::turn_icon], app, application_manager_))) { - LOGGER_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA"); + SDL_ERROR("MessageHelper::VerifyImage return INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -107,7 +106,7 @@ void UpdateTurnListRequest::Run() { if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) { if (!CheckTurnListArray()) { - LOGGER_ERROR(logger_, "INVALID_DATA!"); + SDL_ERROR("INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -140,18 +139,18 @@ void UpdateTurnListRequest::Run() { hmi_apis::FunctionID::Navigation_UpdateTurnList, &msg_params, true); } else { // conditional mandatory - LOGGER_ERROR(logger_, "INVALID_DATA!"); + SDL_ERROR("INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); } } void UpdateTurnListRequest::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_UpdateTurnList: { - LOGGER_INFO(logger_, "Received Navigation_UpdateTurnList event"); + SDL_INFO("Received Navigation_UpdateTurnList event"); mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( @@ -168,7 +167,7 @@ void UpdateTurnListRequest::on_event(const event_engine::Event& event) { break; } default: { - LOGGER_ERROR(logger_, "Received unknown event" << event.id()); + SDL_ERROR("Received unknown event" << event.id()); break; } } @@ -193,7 +192,7 @@ bool UpdateTurnListRequest::CheckTurnListArray() { } bool UpdateTurnListRequest::IsWhiteSpaceExist() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) { @@ -207,8 +206,7 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() { if ((*it_tl).keyExists(strings::navigation_text)) { str = (*it_tl)[strings::navigation_text].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Invalid turn_list navigation_text text syntax check failed"); return true; } @@ -217,8 +215,7 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() { if ((*it_tl).keyExists(strings::turn_icon)) { str = (*it_tl)[strings::turn_icon][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOGGER_ERROR(logger_, - "Invalid turn_list turn_icon value syntax check failed"); + SDL_ERROR("Invalid turn_list turn_icon value syntax check failed"); return true; } } diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc index 11e558d015..bf3a2f0d30 100644 --- a/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc +++ b/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc @@ -45,7 +45,7 @@ UpdateTurnListResponse::UpdateTurnListResponse( UpdateTurnListResponse::~UpdateTurnListResponse() {} void UpdateTurnListResponse::Run() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc index 343fe84c90..dbf4bdfd1b 100644 --- a/src/components/application_manager/src/hmi_capabilities_impl.cc +++ b/src/components/application_manager/src/hmi_capabilities_impl.cc @@ -46,7 +46,7 @@ namespace application_manager { namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; -CREATE_LOGGERPTR_GLOBAL(logger_, "HMICapabilities") +SDL_CREATE_LOGGER("HMICapabilities") namespace { @@ -720,9 +720,9 @@ void convert_json_languages_to_sm_obj( void HMICapabilitiesImpl::Init(resumption::LastState* last_state) { hmi_language_handler_.Init(last_state); if (false == load_capabilities_from_file()) { - LOGGER_ERROR(logger_, "file hmi_capabilities.json was not loaded"); + SDL_ERROR("file hmi_capabilities.json was not loaded"); } else { - LOGGER_INFO(logger_, "file hmi_capabilities.json was loaded"); + SDL_INFO("file hmi_capabilities.json was loaded"); } hmi_language_handler_.set_default_capabilities_languages( ui_language_, vr_language_, tts_language_); diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc index 372a546f90..8e0ba1f701 100644 --- a/src/components/application_manager/src/hmi_command_factory.cc +++ b/src/components/application_manager/src/hmi_command_factory.cc @@ -272,7 +272,7 @@ #include "application_manager/commands/hmi/dial_number_request.h" #include "application_manager/commands/hmi/dial_number_response.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOGGER("ApplicationManager") namespace application_manager { @@ -281,8 +281,7 @@ CommandSharedPtr HMICommandFactory::CreateCommand( ApplicationManager& application_manager) { const int function_id = (*message)[strings::params][strings::function_id].asInt(); - LOGGER_DEBUG(logger_, - "HMICommandFactory::CreateCommand function_id: " << function_id); + SDL_DEBUG("HMICommandFactory::CreateCommand function_id: " << function_id); CommandSharedPtr command(new application_manager::commands::CommandImpl( message, application_manager)); @@ -293,14 +292,14 @@ CommandSharedPtr HMICommandFactory::CreateCommand( if (msg_type == static_cast<int>(application_manager::MessageType::kResponse)) { is_response = true; - LOGGER_DEBUG(logger_, "HMICommandFactory::CreateCommand response"); + SDL_DEBUG("HMICommandFactory::CreateCommand response"); } else if ((*message)[strings::params][strings::message_type] == static_cast<int>( application_manager::MessageType::kErrorResponse)) { is_response = true; - LOGGER_DEBUG(logger_, "HMICommandFactory::CreateCommand error response"); + SDL_DEBUG("HMICommandFactory::CreateCommand error response"); } else { - LOGGER_DEBUG(logger_, "HMICommandFactory::CreateCommand request"); + SDL_DEBUG("HMICommandFactory::CreateCommand request"); } switch (function_id) { diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc index c287a5b29c..33b8a618f8 100644 --- a/src/components/application_manager/src/hmi_language_handler.cc +++ b/src/components/application_manager/src/hmi_language_handler.cc @@ -43,7 +43,7 @@ static const std::string UIKey = "UI"; static const std::string VRKey = "VR"; static const std::string TTSKey = "TTS"; -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOGGER("ApplicationManager") namespace application_manager { @@ -62,7 +62,7 @@ HMILanguageHandler::HMILanguageHandler(ApplicationManager& application_manager) void HMILanguageHandler::set_language_for( HMILanguageHandler::Interface iface, hmi_apis::Common_Language::eType language) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace utils::json; std::string key = "UNKNOWN"; switch (iface) { @@ -76,11 +76,10 @@ void HMILanguageHandler::set_language_for( key = TTSKey; break; default: - LOGGER_WARN(logger_, "Unknown interface has been passed " << iface); + SDL_WARN("Unknown interface has been passed " << iface); return; } - LOGGER_DEBUG(logger_, - "Setting language " << language << " for interface " << iface); + SDL_DEBUG("Setting language " << language << " for interface " << iface); last_state_->dictionary()[LanguagesKey][key] = static_cast<JsonValue::Int>(language); return; @@ -88,7 +87,7 @@ void HMILanguageHandler::set_language_for( hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for( HMILanguageHandler::Interface iface) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace resumption; using namespace hmi_apis; std::string key = "UNKNOWN"; @@ -103,7 +102,7 @@ hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for( key = TTSKey; break; default: - LOGGER_WARN(logger_, "Unknown interfcase has been passed " << iface); + SDL_WARN("Unknown interfcase has been passed " << iface); return Common_Language::INVALID_ENUM; } @@ -118,19 +117,19 @@ hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for( } void HMILanguageHandler::on_event(const event_engine::Event& event) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject msg = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_GetLanguage: - LOGGER_DEBUG(logger_, "Got UI language response."); + SDL_DEBUG("Got UI language response."); is_ui_language_received_ = true; break; case hmi_apis::FunctionID::VR_GetLanguage: - LOGGER_DEBUG(logger_, "Got VR language response."); + SDL_DEBUG("Got VR language response."); is_vr_language_received_ = true; break; case hmi_apis::FunctionID::TTS_GetLanguage: - LOGGER_DEBUG(logger_, "Got TTS language response."); + SDL_DEBUG("Got TTS language response."); is_tts_language_received_ = true; break; case hmi_apis::FunctionID::BasicCommunication_OnAppRegistered: @@ -143,30 +142,27 @@ void HMILanguageHandler::on_event(const event_engine::Event& event) { if (is_ui_language_received_ && is_vr_language_received_ && is_tts_language_received_) { - LOGGER_DEBUG(logger_, "All GetLanguages responses gotten."); + SDL_DEBUG("All GetLanguages responses gotten."); VerifyWithPersistedLanguages(); } } void HMILanguageHandler::set_handle_response_for( const event_engine::smart_objects::SmartObject& request) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; if (!request.keyExists(strings::params)) { - LOGGER_ERROR(logger_, - "Object does not have " << strings::params << " key."); + SDL_ERROR("Object does not have " << strings::params << " key."); return; } if (!request[strings::params].keyExists(strings::function_id)) { - LOGGER_ERROR(logger_, - "Object does not have " << strings::function_id << " key."); + SDL_ERROR("Object does not have " << strings::function_id << " key."); return; } if (!request[strings::params].keyExists(strings::correlation_id)) { - LOGGER_ERROR(logger_, - "Object does not have " << strings::correlation_id << " key."); + SDL_ERROR("Object does not have " << strings::correlation_id << " key."); return; } @@ -179,8 +175,7 @@ void HMILanguageHandler::set_handle_response_for( hmi_apis::FunctionID::UI_GetLanguage, hmi_apis::FunctionID::VR_GetLanguage, hmi_apis::FunctionID::TTS_GetLanguage)) { - LOGGER_ERROR(logger_, - "Only *GetLanguage request are allowed to be subscribed."); + SDL_ERROR("Only *GetLanguage request are allowed to be subscribed."); return; } @@ -189,9 +184,8 @@ void HMILanguageHandler::set_handle_response_for( subscribe_on_event(function_id, correlation_id); - LOGGER_DEBUG(logger_, - "Subscribed for function_id " - << function_id << " and correlation_id " << correlation_id); + SDL_DEBUG("Subscribed for function_id " + << function_id << " and correlation_id " << correlation_id); } void HMILanguageHandler::set_default_capabilities_languages( @@ -216,7 +210,7 @@ void HMILanguageHandler::set_default_capabilities_languages( void HMILanguageHandler::SendOnLanguageChangeToMobile( const uint32_t connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject; DCHECK_OR_RETURN_VOID(notification); @@ -234,14 +228,14 @@ void HMILanguageHandler::SendOnLanguageChangeToMobile( hmi_capabilities.active_vr_language(); if (application_manager_.ManageMobileCommand(notification, commands::Command::ORIGIN_SDL)) { - LOGGER_INFO(logger_, "Mobile command sent"); + SDL_INFO("Mobile command sent"); } else { - LOGGER_WARN(logger_, "Cannot send mobile command"); + SDL_WARN("Cannot send mobile command"); } } void HMILanguageHandler::VerifyWithPersistedLanguages() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; const HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); @@ -250,14 +244,13 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() { if (hmi_capabilities.active_ui_language() == persisted_ui_language_ && hmi_capabilities.active_vr_language() == persisted_vr_language_ && hmi_capabilities.active_tts_language() == persisted_tts_language_) { - LOGGER_INFO(logger_, - "All languages gotten from HMI match to persisted values."); + SDL_INFO("All languages gotten from HMI match to persisted values."); return; } - LOGGER_INFO(logger_, - "Some languages gotten from HMI have " - "mismatch with persisted values."); + SDL_INFO( + "Some languages gotten from HMI have " + "mismatch with persisted values."); const ApplicationSet& accessor = application_manager_.applications().GetData(); @@ -265,36 +258,31 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() { for (; accessor.end() != it;) { ApplicationConstSharedPtr app = *it++; - LOGGER_INFO(logger_, - "Application with app_id " - << app->app_id() << " will be unregistered because of " - "HMI language(s) mismatch."); + SDL_INFO("Application with app_id " << app->app_id() + << " will be unregistered because of " + "HMI language(s) mismatch."); CheckApplication(std::make_pair(app->app_id(), false)); } sync_primitives::AutoLock lock(apps_lock_); if (0 == apps_.size()) { - LOGGER_DEBUG(logger_, - "No registered apps found. Unsubscribing from all events."); + SDL_DEBUG("No registered apps found. Unsubscribing from all events."); unsubscribe_from_all_events(); } } void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Apps::iterator it = apps_.find(app.first); if (apps_.end() == it) { - LOGGER_DEBUG(logger_, - "Application id " - << app.first - << " is not found within apps with wrong language."); + SDL_DEBUG("Application id " + << app.first << " is not found within apps with wrong language."); return; } - LOGGER_INFO(logger_, - "Unregistering application with app_id " - << app.first << " because of HMI language(s) mismatch."); + SDL_INFO("Unregistering application with app_id " + << app.first << " because of HMI language(s) mismatch."); SendOnLanguageChangeToMobile(app.first); application_manager_.ManageMobileCommand( @@ -306,19 +294,18 @@ void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) { app.first, mobile_apis::Result::SUCCESS, false); apps_.erase(it); if (0 == apps_.size()) { - LOGGER_DEBUG(logger_, "All apps processed. Unsubscribing from all events."); + SDL_DEBUG("All apps processed. Unsubscribing from all events."); unsubscribe_from_all_events(); } } void HMILanguageHandler::CheckApplication(const Apps::value_type app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_lock_); Apps::iterator it = apps_.find(app.first); if (apps_.end() == it) { - LOGGER_INFO(logger_, - "Adding application id " - << app.first << " Application registered: " << app.second); + SDL_INFO("Adding application id " + << app.first << " Application registered: " << app.second); apps_.insert(app); return; } diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc index 30edec70b1..3070c1604b 100644 --- a/src/components/application_manager/src/message_helper.cc +++ b/src/components/application_manager/src/message_helper.cc @@ -64,7 +64,7 @@ #define snprintf _snprintf_s #endif -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOGGER("ApplicationManager") namespace application_manager { namespace { @@ -272,7 +272,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateRequestObject( smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification( const uint32_t app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr message = utils::MakeShared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -286,16 +286,16 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification( void MessageHelper::SendHashUpdateNotification(const uint32_t app_id, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = app_mngr.application(app_id); if (!app) { - LOGGER_ERROR(logger_, "Application not found by appID"); + SDL_ERROR("Application not found by appID"); return; } smart_objects::SmartObjectSPtr so = CreateHashUpdateNotification(app_id); PrintSmartObject(*so); if (!app_mngr.ManageMobileCommand(so, commands::Command::ORIGIN_SDL)) { - LOGGER_ERROR(logger_, "Failed to send HashUpdate notification."); + SDL_ERROR("Failed to send HashUpdate notification."); return; } app_mngr.resume_controller().ApplicationsDataUpdated(); @@ -305,7 +305,7 @@ smart_objects::SmartObjectSPtr MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( int32_t connection_key, mobile_api::AppInterfaceUnregisteredReason::eType reason) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr notification = utils::MakeShared<smart_objects::SmartObject>(); @@ -414,7 +414,7 @@ std::string MessageHelper::StringifiedHMILevel( std::string MessageHelper::StringifiedFunctionID( mobile_apis::FunctionID::eType function_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace NsSmartDeviceLink::NsSmartObjects; const char* str = 0; if (EnumConversionHelper<mobile_apis::FunctionID::eType>::EnumToCString( @@ -502,7 +502,7 @@ void MessageHelper::CreateGetVehicleDataRequest( const uint32_t correlation_id, const std::vector<std::string>& params, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); #ifdef HMI_DBUS_API for (std::vector<std::string>::const_iterator it = params.begin(); it != params.end(); @@ -550,7 +550,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse( mobile_apis::Result::eType result, const uint32_t correlation_id, uint32_t connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr response = utils::MakeShared<smart_objects::SmartObject>(); @@ -574,7 +574,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO( const connection_handler::DeviceMap& devices, const policy::PolicyHandlerInterface& policy_handler, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr device_list_so = utils::MakeShared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -605,7 +605,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO( smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO( uint32_t function_id, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr module_info = utils::MakeShared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -621,7 +621,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO( smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon( const std::string& path_to_icon, uint32_t app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr set_icon = utils::MakeShared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -642,13 +642,13 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon( bool MessageHelper::SendIVISubscribtions(const uint32_t app_id, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool result = true; ApplicationSharedPtr app = app_mngr.application(app_id); if (!app.valid()) { - LOGGER_ERROR(logger_, "Invalid application " << app_id); + SDL_ERROR("Invalid application " << app_id); return result; } @@ -666,11 +666,11 @@ bool MessageHelper::SendIVISubscribtions(const uint32_t app_id, smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests( ApplicationSharedPtr app, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectList hmi_requests; if (!app.valid()) { - LOGGER_ERROR(logger_, "Invalid application pointer "); + SDL_ERROR("Invalid application pointer "); return hmi_requests; } @@ -720,12 +720,12 @@ void MessageHelper::SendOnButtonSubscriptionNotification( ApplicationManager& app_mngr) { using namespace smart_objects; using namespace hmi_apis; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SmartObjectSPtr notification_ptr = utils::MakeShared<SmartObject>(SmartType_Map); if (!notification_ptr) { - LOGGER_ERROR(logger_, "Memory allocation failed."); + SDL_ERROR("Memory allocation failed."); return; } SmartObject& notification = *notification_ptr; @@ -746,7 +746,7 @@ void MessageHelper::SendOnButtonSubscriptionNotification( notification[strings::msg_params] = msg_params; if (!app_mngr.ManageHMICommand(notification_ptr)) { - LOGGER_ERROR(logger_, "Unable to send HMI notification"); + SDL_ERROR("Unable to send HMI notification"); } } @@ -755,10 +755,10 @@ void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp( using namespace smart_objects; using namespace hmi_apis; using namespace mobile_apis; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!app.valid()) { - LOGGER_ERROR(logger_, "Invalid application pointer "); + SDL_ERROR("Invalid application pointer "); return; } @@ -800,7 +800,7 @@ void MessageHelper::SendSetAppIcon( void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_man) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (app) { SendSetAppIcon(app, app->app_icon_path(), app_man); SendGlobalPropertiesToHMI(app, app_man); @@ -811,7 +811,7 @@ void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app, void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { if (!app.valid()) { - LOGGER_ERROR(logger_, "Invalid application"); + SDL_ERROR("Invalid application"); return; } @@ -827,11 +827,11 @@ void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app, smart_objects::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHMI( ApplicationConstSharedPtr app, const uint32_t correlation_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectList requests; if (!app.valid()) { - LOGGER_ERROR(logger_, "Invalid application"); + SDL_ERROR("Invalid application"); return requests; } @@ -902,7 +902,7 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI( void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app, bool default_help_prompt, ApplicationManager& app_man) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!app) { return; } @@ -979,7 +979,7 @@ smart_objects::SmartObjectList MessageHelper::CreateShowRequestToHMI( ApplicationConstSharedPtr app, const uint32_t correlation_id) { smart_objects::SmartObjectList requests; if (!app) { - LOGGER_ERROR(logger_, "Invalid application"); + SDL_ERROR("Invalid application"); return requests; } @@ -1048,7 +1048,7 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI( ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { smart_objects::SmartObjectList requests; if (!app) { - LOGGER_ERROR(logger_, "Invalid application"); + SDL_ERROR("Invalid application"); return requests; } @@ -1099,7 +1099,7 @@ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI( ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { smart_objects::SmartObjectList requests; if (!app) { - LOGGER_ERROR(logger_, "Invalid application"); + SDL_ERROR("Invalid application"); return requests; } @@ -1169,7 +1169,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateChangeRegistration( void MessageHelper::SendUIChangeRegistrationRequestToHMI( ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { if (!app.valid()) { - LOGGER_ERROR(logger_, "Application is not valid"); + SDL_ERROR("Application is not valid"); return; } @@ -1284,7 +1284,7 @@ bool MessageHelper::CreateHMIApplicationStruct( DCHECK_OR_RETURN(output, false); SmartObject& message = *output; if (!app) { - LOGGER_WARN(logger_, "Application is not valid"); + SDL_WARN("Application is not valid"); return false; } @@ -1297,8 +1297,7 @@ bool MessageHelper::CreateHMIApplicationStruct( if (-1 == session_observer.GetDataOnDeviceID( app->device(), &device_name, NULL, &mac_address, &transport_type)) { - LOGGER_ERROR(logger_, - "Failed to extract information for device " << app->device()); + SDL_ERROR("Failed to extract information for device " << app->device()); } message = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -1345,7 +1344,7 @@ bool MessageHelper::CreateHMIApplicationStruct( void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { if (!app.valid()) { - LOGGER_ERROR(logger_, "Invalid application"); + SDL_ERROR("Invalid application"); return; } @@ -1460,11 +1459,11 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI( void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id, ApplicationManager& app_mngr) { - LOGGER_WARN(logger_, "SendOnResumeAudioSourceToHMI app_id: " << app_id); + SDL_WARN("SendOnResumeAudioSourceToHMI app_id: " << app_id); application_manager::ApplicationConstSharedPtr app = app_mngr.application(app_id); if (!app) { - LOGGER_WARN(logger_, "Invalid app_id: " << app_id); + SDL_WARN("Invalid app_id: " << app_id); return; } @@ -1574,7 +1573,7 @@ void MessageHelper::SendGetUserFriendlyMessageResponse( const std::vector<policy::UserFriendlyMessage>& msg, uint32_t correlation_id, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr message = utils::MakeShared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -1677,7 +1676,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse( void MessageHelper::SendNaviStartStream(const int32_t app_id, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr start_stream = CreateRequestObject(app_mngr.GetNextHMICorrelationID()); if (!start_stream) { @@ -1716,7 +1715,7 @@ void MessageHelper::SendNaviStartStream(const int32_t app_id, void MessageHelper::SendNaviStopStream(const int32_t app_id, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr stop_stream = CreateRequestObject(app_mngr.GetNextHMICorrelationID()); if (!stop_stream) { @@ -1733,7 +1732,7 @@ void MessageHelper::SendNaviStopStream(const int32_t app_id, void MessageHelper::SendAudioStartStream(const int32_t app_id, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr start_stream = CreateRequestObject(app_mngr.GetNextHMICorrelationID()); @@ -1773,7 +1772,7 @@ void MessageHelper::SendAudioStartStream(const int32_t app_id, void MessageHelper::SendAudioStopStream(const int32_t app_id, ApplicationManager& app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr stop_stream = CreateRequestObject(app_mngr.GetNextHMICorrelationID()); if (!stop_stream) { @@ -1821,7 +1820,7 @@ void MessageHelper::SendOnDataStreaming( } bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) { - LOGGER_INFO(logger_, "MessageHelper::SendAudioStopAudioPathThru"); + SDL_INFO("MessageHelper::SendAudioStopAudioPathThru"); smart_objects::SmartObjectSPtr result = CreateRequestObject(app_mngr.GetNextHMICorrelationID()); @@ -1833,7 +1832,7 @@ bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) { } bool MessageHelper::SendUnsubscribedWayPoints(ApplicationManager& app_mngr) { - LOGGER_INFO(logger_, "MessageHelper::SendUnsubscribedWayPoints"); + SDL_INFO("MessageHelper::SendUnsubscribedWayPoints"); smart_objects::SmartObjectSPtr result = CreateRequestObject(app_mngr.GetNextHMICorrelationID()); @@ -1855,7 +1854,7 @@ void MessageHelper::SendPolicySnapshotNotification( content[strings::msg_params][strings::url] = url; // Doesn't work with mobile_notification::syncp_url ("URL") } else { - LOGGER_WARN(logger_, "No service URLs"); + SDL_WARN("No service URLs"); } content[strings::msg_params][strings::request_type] = @@ -2215,7 +2214,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles( mobile_apis::Result::eType res = VerifyImageFiles(message[i], app, app_mngr); if (mobile_apis::Result::SUCCESS != res) { - LOGGER_DEBUG(logger_, "VerifyImageFiles result:" << res); + SDL_DEBUG("VerifyImageFiles result:" << res); return res; } } @@ -2226,8 +2225,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles( VerifyImage(message, app, app_mngr); if (mobile_apis::Result::SUCCESS != verification_result) { - LOGGER_DEBUG(logger_, - "VerifyImageFiles result:" << verification_result); + SDL_DEBUG("VerifyImageFiles result:" << verification_result); return verification_result; // exit point } } else { @@ -2240,7 +2238,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles( mobile_apis::Result::eType res = VerifyImageFiles(message[*key], app, app_mngr); if (mobile_apis::Result::SUCCESS != res) { - LOGGER_DEBUG(logger_, "VerifyImageFiles result:" << res); + SDL_DEBUG("VerifyImageFiles result:" << res); return res; } } @@ -2327,9 +2325,9 @@ bool MessageHelper::VerifySoftButtonString(const std::string& str) { (std::string::npos != str.find("\\n")) || (std::string::npos != str.find("\\t")) || (std::string::npos == str.find_first_not_of(' '))) { - LOGGER_ERROR(logger_, - "MessageHelper::VerifySoftButtonString" - "string contains incorrect character"); + SDL_ERROR( + "MessageHelper::VerifySoftButtonString" + "string contains incorrect character"); return false; } return true; diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc index df1e15331d..a30de2f83d 100644 --- a/src/components/application_manager/src/mobile_message_handler.cc +++ b/src/components/application_manager/src/mobile_message_handler.cc @@ -72,6 +72,7 @@ MessageTypeMap create_map() { MessageTypeMap message_types_map = create_map(); #endif // SDL_CPP11 +#if defined(ENABLE_LOG) std::string GetMessageType(const MessageType message_type) { MessageTypeMap::const_iterator it = message_types_map.find(message_type); if (message_types_map.end() != it) { @@ -79,9 +80,10 @@ std::string GetMessageType(const MessageType message_type) { } return std::string(); } +#endif } // namespace -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOGGER("ApplicationManager") application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocol( @@ -90,53 +92,50 @@ MobileMessageHandler::HandleIncomingMessageProtocol( application_manager::Message* out_message = NULL; switch (message->protocol_version()) { case ProtocolVersion::kV1: - LOGGER_DEBUG(logger_, "Protocol version - V1"); + SDL_DEBUG("Protocol version - V1"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV1(message); break; case ProtocolVersion::kV2: - LOGGER_DEBUG(logger_, "Protocol version - V2"); + SDL_DEBUG("Protocol version - V2"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); break; case ProtocolVersion::kV3: - LOGGER_DEBUG(logger_, "Protocol version - V3"); + SDL_DEBUG("Protocol version - V3"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); break; case ProtocolVersion::kV4: - LOGGER_DEBUG(logger_, "Protocol version - V4"); + SDL_DEBUG("Protocol version - V4"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); break; default: - LOGGER_WARN(logger_, "Can't recognise protocol version"); + SDL_WARN("Can't recognise protocol version"); out_message = NULL; break; } if (out_message == NULL) { - LOGGER_WARN(logger_, "Message is NULL"); + SDL_WARN("Message is NULL"); return NULL; } - LOGGER_DEBUG(logger_, - "Incoming RPC_INFO: " << (out_message->connection_key() >> 16) - << ", " - << GetMessageType(out_message->type()) - << ", " << out_message->function_id() - << ", " << out_message->correlation_id() - << ", " << out_message->json_message()); + SDL_DEBUG("Incoming RPC_INFO: " << (out_message->connection_key() >> 16) + << ", " << GetMessageType(out_message->type()) + << ", " << out_message->function_id() << ", " + << out_message->correlation_id() << ", " + << out_message->json_message()); return out_message; } protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocol( const MobileMessage& message) { - LOGGER_DEBUG(logger_, - "Outgoing RPC_INFO: " << (message->connection_key() >> 16) - << ", " << GetMessageType(message->type()) - << ", " << message->function_id() << ", " - << message->correlation_id() << ", " - << message->json_message()); + SDL_DEBUG("Outgoing RPC_INFO: " << (message->connection_key() >> 16) << ", " + << GetMessageType(message->type()) << ", " + << message->function_id() << ", " + << message->correlation_id() << ", " + << message->json_message()); if (message->protocol_version() == application_manager::kV1) { return MobileMessageHandler::HandleOutgoingMessageProtocolV1(message); @@ -152,7 +151,7 @@ MobileMessageHandler::HandleOutgoingMessageProtocol( application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocolV1( const ::protocol_handler::RawMessagePtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); application_manager::Message* outgoing_message = new application_manager::Message( protocol_handler::MessagePriority::FromServiceType( @@ -180,7 +179,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1( application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocolV2( const ::protocol_handler::RawMessagePtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::BitStream message_bytestream(message->data(), message->data_size()); protocol_handler::ProtocolPayloadV2 payload; protocol_handler::Extract( @@ -188,8 +187,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2( // Silently drop message if it wasn't parsed correctly if (message_bytestream.IsBad()) { - LOGGER_WARN( - logger_, + SDL_WARN( "Drop ill-formed message from mobile, partially parsed: " << payload); return NULL; } @@ -221,10 +219,10 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2( protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocolV1( const MobileMessage& message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::string messageString = message->json_message(); if (messageString.length() == 0) { - LOGGER_WARN(logger_, "Drop ill-formed message from mobile"); + SDL_WARN("Drop ill-formed message from mobile"); return NULL; } @@ -242,9 +240,9 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV1( protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocolV2( const MobileMessage& message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (message->json_message().length() == 0) { - LOGGER_ERROR(logger_, "json string is empty."); + SDL_ERROR("json string is empty."); } uint32_t jsonSize = message->json_message().length(); uint32_t binarySize = 0; diff --git a/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc b/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc index f2cf2c01cd..2a037b9c89 100644 --- a/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc +++ b/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc @@ -34,7 +34,7 @@ #include "application_manager/application_manager.h" namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") +SDL_CREATE_LOGGER("PolicyHandler") AppPermissionDelegate::AppPermissionDelegate( const uint32_t connection_key, @@ -45,7 +45,7 @@ AppPermissionDelegate::AppPermissionDelegate( , policy_handler_(policy_handler) {} void AppPermissionDelegate::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); policy_handler_.OnAppPermissionConsentInternal(connection_key_, permissions_); } diff --git a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc index e0caaa579b..de1cbf0995 100644 --- a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc +++ b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc @@ -33,7 +33,7 @@ #include "application_manager/policies/delegates/statistics_delegate.h" #include "application_manager/policies/policy_handler.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") +SDL_CREATE_LOGGER("PolicyHandler") namespace policy { StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler, usage_statistics::GlobalCounterId type) @@ -77,7 +77,7 @@ StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler, , policy_handler_(policy_handler) {} void StatisticsDelegate::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); switch (type_) { case INCREMENT_GLOBAL: policy_handler_.Increment(global_counter_); @@ -92,7 +92,7 @@ void StatisticsDelegate::threadMain() { policy_handler_.Add(app_id_, stop_watch_, timespan_seconds_); break; default: - LOGGER_ERROR(logger_, "Unknown statistics operator"); + SDL_ERROR("Unknown statistics operator"); break; } } diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc index a6ef100941..df8ef3726f 100644 --- a/src/components/application_manager/src/policies/policy_event_observer.cc +++ b/src/components/application_manager/src/policies/policy_event_observer.cc @@ -41,7 +41,7 @@ namespace smart_objects = NsSmartDeviceLink::NsSmartObjects; using namespace application_manager; class PolicyHandler; -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") +SDL_CREATE_LOGGER("PolicyHandler") PolicyEventObserver::PolicyEventObserver( policy::PolicyHandlerInterface* const policy_handler, @@ -50,9 +50,9 @@ PolicyEventObserver::PolicyEventObserver( void PolicyEventObserver::set_policy_handler( PolicyHandlerInterface* const policy_handler) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(policy_handler_lock_); - LOGGER_DEBUG(logger_, "Set policy handler " << policy_handler); + SDL_DEBUG("Set policy handler " << policy_handler); policy_handler_ = policy_handler; } diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index 2c7800b16c..31e5ce9d96 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -58,7 +58,7 @@ namespace policy { using namespace application_manager; -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") +SDL_CREATE_LOGGER("PolicyHandler") namespace { using namespace mobile_apis; @@ -153,7 +153,7 @@ std::string RequestTypeToString(RequestType::eType type) { const policy::DeviceParams GetDeviceParams( connection_handler::DeviceHandle device_handle, const protocol_handler::SessionObserver& session_observer) { - CREATE_LOGGERPTR_LOCAL(logger_, "PolicyHandler") + SDL_CREATE_LOGGER("PolicyHandler") policy::DeviceParams device_params; if (-1 == session_observer.GetDataOnDeviceID( @@ -162,29 +162,28 @@ const policy::DeviceParams GetDeviceParams( NULL, &device_params.device_mac_address, &device_params.device_connection_type)) { - LOGGER_ERROR(logger_, - "Failed to extract information for device " << device_handle); + SDL_ERROR("Failed to extract information for device " << device_handle); } device_params.device_handle = device_handle; return device_params; } -#define POLICY_LIB_CHECK(return_value) \ - { \ - sync_primitives::AutoReadLock lock(policy_manager_lock_); \ - if (!policy_manager_) { \ - LOGGER_DEBUG(logger_, "The shared library of policy is not loaded"); \ - return return_value; \ - } \ +#define POLICY_LIB_CHECK(return_value) \ + { \ + sync_primitives::AutoReadLock lock(policy_manager_lock_); \ + if (!policy_manager_) { \ + SDL_DEBUG("The shared library of policy is not loaded"); \ + return return_value; \ + } \ } -#define POLICY_LIB_CHECK_VOID() \ - { \ - sync_primitives::AutoReadLock lock(policy_manager_lock_); \ - if (!policy_manager_) { \ - LOGGER_DEBUG(logger_, "The shared library of policy is not loaded"); \ - return; \ - } \ +#define POLICY_LIB_CHECK_VOID() \ + { \ + sync_primitives::AutoReadLock lock(policy_manager_lock_); \ + if (!policy_manager_) { \ + SDL_DEBUG("The shared library of policy is not loaded"); \ + return; \ + } \ } static const std::string kCerficateFileName = "certificate"; @@ -275,9 +274,9 @@ struct LinkAppToDevice { void operator()(const ApplicationSharedPtr& app) { if (!app.valid()) { - LOGGER_WARN(logger_, - "Invalid pointer to application was passed." - "Skip current application."); + SDL_WARN( + "Invalid pointer to application was passed." + "Skip current application."); return; } DeviceParams device_params = GetDeviceParams( @@ -285,8 +284,7 @@ struct LinkAppToDevice { application_manager_.connection_handler().get_session_observer()); const std::string app_id = app->policy_app_id(); if (device_params.device_mac_address.empty()) { - LOGGER_WARN(logger_, - "Couldn't find device, which hosts application " << app_id); + SDL_WARN("Couldn't find device, which hosts application " << app_id); return; } app_to_device_link_[app_id] = device_params.device_mac_address; @@ -351,12 +349,12 @@ PolicyHandler::PolicyHandler(const PolicySettings& settings, PolicyHandler::~PolicyHandler() {} bool PolicyHandler::LoadPolicyLibrary() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoWriteLock lock(policy_manager_lock_); if (!PolicyEnabled()) { - LOGGER_WARN(logger_, - "System is configured to work without policy " - "functionality."); + SDL_WARN( + "System is configured to work without policy " + "functionality."); policy_manager_.reset(); return false; } @@ -370,7 +368,7 @@ bool PolicyHandler::LoadPolicyLibrary() { this, application_manager_.event_dispatcher())); } } else { - LOGGER_ERROR(logger_, "Policy library loading error"); + SDL_ERROR("Policy library loading error"); } return policy_manager_.valid(); @@ -399,12 +397,11 @@ bool PolicyHandler::CreateManager() { get_settings().open_attempt_timeout_ms() #ifdef ENABLE_LOG , - GET_LOGGER() + SDL_GET_LOGGER() #endif ); } else { - LOGGER_WARN(logger_, - "Policy library loading error. Cannot get proc address"); + SDL_WARN("Policy library loading error. Cannot get proc address"); } return policy_manager_.valid(); } @@ -414,7 +411,7 @@ const PolicySettings& PolicyHandler::get_settings() const { } bool PolicyHandler::InitPolicyTable() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK(false); // Subscribing to notification for system readiness to be able to get system // info necessary for policy table @@ -424,23 +421,23 @@ bool PolicyHandler::InitPolicyTable() { if (file_system::FileExists(preloaded_file)) { return policy_manager_->InitPT(preloaded_file, &get_settings()); } - LOGGER_FATAL(logger_, "The file which contains preloaded PT is not exist"); + SDL_FATAL("The file which contains preloaded PT is not exist"); return false; } bool PolicyHandler::ResetPolicyTable() { - LOGGER_TRACE(logger_, "Reset policy table."); + SDL_TRACE("Reset policy table."); POLICY_LIB_CHECK(false); const std::string& preloaded_file = get_settings().preloaded_pt_file(); if (file_system::FileExists(preloaded_file)) { return policy_manager_->ResetPT(preloaded_file); } - LOGGER_WARN(logger_, "The file which contains preloaded PT is not exist"); + SDL_WARN("The file which contains preloaded PT is not exist"); return false; } bool PolicyHandler::ClearUserConsent() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK(false); return policy_manager_->ResetUserConsent(); } @@ -451,7 +448,7 @@ uint32_t PolicyHandler::GetAppIdForSending() const { application_manager_.applications().GetData(); HmiLevelOrderedApplicationList app_list(accessor.begin(), accessor.end()); - LOGGER_INFO(logger_, "Apps size: " << app_list.size()); + SDL_INFO("Apps size: " << app_list.size()); for (HmiLevelOrderedApplicationList::const_iterator first = app_list.begin(); first != app_list.end(); @@ -475,7 +472,7 @@ uint32_t PolicyHandler::GetAppIdForSending() const { void PolicyHandler::OnAppPermissionConsent( const uint32_t connection_key, const PermissionConsent& permissions) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); AsyncRun(new AppPermissionDelegate(connection_key, permissions, *this)); } @@ -514,14 +511,12 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id, void PolicyHandler::SendOnAppPermissionsChanged( const AppPermissions& permissions, const std::string& policy_app_id) const { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "PolicyHandler::SendOnAppPermissionsChanged for " - << policy_app_id); + SDL_AUTO_TRACE(); + SDL_DEBUG("PolicyHandler::SendOnAppPermissionsChanged for " << policy_app_id); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); if (!app.valid()) { - LOGGER_WARN(logger_, "No app found for policy app id = " << policy_app_id); + SDL_WARN("No app found for policy app id = " << policy_app_id); return; } MessageHelper::SendOnAppPermissionsChangedNotification( @@ -535,13 +530,13 @@ void PolicyHandler::OnPTExchangeNeeded() { } void PolicyHandler::GetAvailableApps(std::queue<std::string>& apps) { - LOGGER_INFO(logger_, "GetAvailable apps"); + SDL_INFO("GetAvailable apps"); const ApplicationSet& app_list = application_manager_.applications().GetData(); ApplicationSetConstIt iter = app_list.begin(); for (; app_list.end() != iter; ++iter) { - LOGGER_INFO(logger_, "one more app"); + SDL_INFO("one more app"); apps.push((*iter)->policy_app_id()); } } @@ -553,21 +548,21 @@ void PolicyHandler::AddApplication(const std::string& application_id) { void PolicyHandler::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->AddDevice(device_id, connection_type); } void PolicyHandler::SetDeviceInfo(const std::string& device_id, const DeviceInfo& device_info) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->SetDeviceInfo(device_id, device_info); } void PolicyHandler::OnAppPermissionConsentInternal( const uint32_t connection_key, PermissionConsent& permissions) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); if (connection_key) { ApplicationSharedPtr app = application_manager_.application(connection_key); @@ -590,9 +585,9 @@ void PolicyHandler::OnAppPermissionConsentInternal( sync_primitives::AutoLock lock(app_to_device_link_lock_); if (!app_to_device_link_.size()) { - LOGGER_WARN(logger_, - "There are no applications previously stored for " - "setting common permissions."); + SDL_WARN( + "There are no applications previously stored for " + "setting common permissions."); return; } @@ -607,18 +602,18 @@ void PolicyHandler::OnAppPermissionConsentInternal( // If list of apps sent to HMI for user consents is not the same as current, // permissions should be set only for coincident to registered apps if (!app.valid()) { - LOGGER_WARN(logger_, - "Invalid pointer to application was passed." - "Permissions setting skipped."); + SDL_WARN( + "Invalid pointer to application was passed." + "Permissions setting skipped."); continue; } DeviceParams device_params = GetDeviceParams( app->device(), application_manager_.connection_handler().get_session_observer()); if (device_params.device_mac_address != it->second) { - LOGGER_WARN(logger_, - "Device_id of application is changed." - "Permissions setting skipped."); + SDL_WARN( + "Device_id of application is changed." + "Permissions setting skipped."); continue; } @@ -647,7 +642,7 @@ void PolicyHandler::OnGetUserFriendlyMessage( const std::vector<std::string>& message_codes, const std::string& language, uint32_t correlation_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); std::vector<UserFriendlyMessage> result = policy_manager_->GetUserFriendlyMessages(message_codes, language); @@ -658,7 +653,7 @@ void PolicyHandler::OnGetUserFriendlyMessage( void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, const uint32_t correlation_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); // If no specific app was passed, get permissions for all currently registered // applications @@ -695,11 +690,9 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, ApplicationSharedPtr app = application_manager_.application(connection_key); if (!app.valid()) { - LOGGER_WARN(logger_, - "Connection key '" - << connection_key - << "' " - "not found within registered applications."); + SDL_WARN("Connection key '" << connection_key + << "' " + "not found within registered applications."); return; } DeviceParams device_params = GetDeviceParams( @@ -707,9 +700,9 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, application_manager_.connection_handler().get_session_observer()); std::vector<FunctionalGroupPermission> group_permissions; if (device_params.device_mac_address.empty()) { - LOGGER_WARN(logger_, "Couldn't find device, which hosts application."); + SDL_WARN("Couldn't find device, which hosts application."); } else if (!app) { - LOGGER_WARN(logger_, "Couldn't find application to get permissions."); + SDL_WARN("Couldn't find application to get permissions."); } else { policy_manager_->GetUserConsentForApp(device_params.device_mac_address, app->policy_app_id(), @@ -721,7 +714,7 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, } void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); MessageHelper::SendGetStatusUpdateResponse( policy_manager_->GetPolicyTableStatus(), @@ -730,22 +723,20 @@ void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) { } void PolicyHandler::OnUpdateStatusChanged(const std::string& status) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); MessageHelper::SendOnStatusUpdate(status, application_manager_); } std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired( const std::string& policy_app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); if (!app.valid()) { - LOGGER_WARN(logger_, - "Application with id '" - << policy_app_id - << "' " - "not found within registered applications."); + SDL_WARN("Application with id '" + << policy_app_id << "' " + "not found within registered applications."); return ""; } DeviceParams device_params = GetDeviceParams( @@ -755,7 +746,7 @@ std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired( } void PolicyHandler::OnSystemInfoChanged(const std::string& language) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->SetSystemLanguage(language); } @@ -763,19 +754,19 @@ void PolicyHandler::OnSystemInfoChanged(const std::string& language) { void PolicyHandler::OnGetSystemInfo(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->SetSystemInfo(ccpu_version, wers_country_code, language); } void PolicyHandler::OnSystemInfoUpdateRequired() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); MessageHelper::SendGetSystemInfoRequest(application_manager_); } void PolicyHandler::OnVIIsReady() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const uint32_t correlation_id = application_manager_.GetNextHMICorrelationID(); @@ -793,15 +784,12 @@ void PolicyHandler::OnVehicleDataUpdated( void PolicyHandler::OnPendingPermissionChange( const std::string& policy_app_id) { - LOGGER_DEBUG(logger_, - "PolicyHandler::OnPendingPermissionChange for " - << policy_app_id); + SDL_DEBUG("PolicyHandler::OnPendingPermissionChange for " << policy_app_id); POLICY_LIB_CHECK_VOID(); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); if (!app.valid()) { - LOGGER_WARN(logger_, - "No app found for " << policy_app_id << " policy app id."); + SDL_WARN("No app found for " << policy_app_id << " policy app id."); return; } @@ -875,32 +863,30 @@ void PolicyHandler::OnPendingPermissionChange( bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string, const std::string& url) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK(false); uint32_t app_id = GetAppIdForSending(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app.valid()) { - LOGGER_WARN(logger_, - "There is no registered application with " - "connection key '" - << app_id << "'"); + SDL_WARN( + "There is no registered application with " + "connection key '" + << app_id << "'"); return false; } const std::string& mobile_app_id = app->policy_app_id(); if (mobile_app_id.empty()) { - LOGGER_WARN(logger_, - "Application with connection key '" - << app_id << "'" - " has no application id."); + SDL_WARN("Application with connection key '" << app_id + << "'" + " has no application id."); return false; } - LOGGER_DEBUG(logger_, - "Update url is " << url << " for application " - "with connection key " << app_id); + SDL_DEBUG("Update url is " << url << " for application " + "with connection key " << app_id); MessageHelper::SendPolicySnapshotNotification( app_id, pt_string, url, application_manager_); @@ -913,9 +899,9 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file, POLICY_LIB_CHECK(false); bool ret = policy_manager_->LoadPT(file, pt_string); - LOGGER_INFO(logger_, "Policy table is saved: " << std::boolalpha << ret); + SDL_INFO("Policy table is saved: " << std::boolalpha << ret); if (ret) { - LOGGER_INFO(logger_, "PTU was successful."); + SDL_INFO("PTU was successful."); policy_manager_->CleanupUnpairedDevices(); int32_t correlation_id = application_manager_.GetNextHMICorrelationID(); @@ -933,15 +919,15 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file, MessageHelper::CreateGetVehicleDataRequest( correlation_id, vehicle_data_args, application_manager_); } else { - LOGGER_WARN(logger_, "Exchange wasn't successful, trying another one."); + SDL_WARN("Exchange wasn't successful, trying another one."); OnPTExchangeNeeded(); } return ret; } bool PolicyHandler::UnloadPolicyLibrary() { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "policy_manager_ = " << policy_manager_); + SDL_AUTO_TRACE(); + SDL_DEBUG("policy_manager_ = " << policy_manager_); bool ret = true; AsyncRunner::Stop(); sync_primitives::AutoWriteLock lock(policy_manager_lock_); @@ -949,13 +935,13 @@ bool PolicyHandler::UnloadPolicyLibrary() { policy_manager_.reset(); } policy_library_.Unload(); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); return ret; } void PolicyHandler::OnAllowSDLFunctionalityNotification( bool is_allowed, const std::string& device_mac) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); using namespace mobile_apis; // Device ids, need to be changed @@ -976,14 +962,13 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( const std::string device_id = *it_ids; if (kDefaultDeviceMacAddress == device_id) { - LOGGER_WARN(logger_, "Device with id " << device_id << " wasn't found."); + SDL_WARN("Device with id " << device_id << " wasn't found."); return; } policy_manager_->SetUserConsentForDevice(device_id, is_allowed); uint32_t device_handle = 0; if (!connection_handler.GetDeviceID(device_mac, &device_handle)) { - LOGGER_WARN(logger_, - "Device hadle with mac " << device_mac << " wasn't found."); + SDL_WARN("Device hadle with mac " << device_mac << " wasn't found."); } } @@ -991,8 +976,7 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( if (device_specific) { uint32_t device_handle = 0; if (!connection_handler.GetDeviceID(device_mac, &device_handle)) { - LOGGER_WARN(logger_, - "Device hadle with mac " << device_mac << " wasn't found."); + SDL_WARN("Device hadle with mac " << device_mac << " wasn't found."); } DeviceHandles::iterator it = std::find(pending_device_handles_.begin(), pending_device_handles_.end(), @@ -1007,18 +991,18 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( } void PolicyHandler::OnIgnitionCycleOver() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->IncrementIgnitionCycles(); } void PolicyHandler::OnActivateApp(uint32_t connection_key, uint32_t correlation_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); ApplicationSharedPtr app = application_manager_.application(connection_key); if (!app.valid()) { - LOGGER_WARN(logger_, "Activated App failed: no app found."); + SDL_WARN("Activated App failed: no app found."); return; } std::string policy_app_id = app->policy_app_id(); @@ -1027,7 +1011,7 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key, sync_primitives::AutoReadLock lock(policy_manager_lock_); if (!policy_manager_) { - LOGGER_DEBUG(logger_, "The shared library of policy is not loaded"); + SDL_DEBUG("The shared library of policy is not loaded"); if (!PolicyEnabled()) { permissions.isSDLAllowed = true; } @@ -1040,12 +1024,12 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key, // If application is revoked it should not be activated // In this case we need to activate application if (false == permissions.appRevoked && true == permissions.isSDLAllowed) { - LOGGER_INFO(logger_, "Application will be activated"); + SDL_INFO("Application will be activated"); if (application_manager_.ActivateApplication(app)) { last_activated_app_id_ = 0; } } else { - LOGGER_WARN(logger_, "Application should not be activated"); + SDL_WARN("Application should not be activated"); } MessageHelper::SendSDLActivateAppResponse( @@ -1053,14 +1037,13 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key, } void PolicyHandler::KmsChanged(int kilometers) { - LOGGER_DEBUG(logger_, - "PolicyHandler::KmsChanged " << kilometers << " kilometers"); + SDL_DEBUG("PolicyHandler::KmsChanged " << kilometers << " kilometers"); POLICY_LIB_CHECK_VOID(); policy_manager_->KmsChanged(kilometers); } void PolicyHandler::PTExchangeAtUserRequest(uint32_t correlation_id) { - LOGGER_TRACE(logger_, "PT exchange at user request"); + SDL_TRACE("PT exchange at user request"); POLICY_LIB_CHECK_VOID(); std::string update_status = policy_manager_->ForcePTExchange(); MessageHelper::SendUpdateSDLResponse( @@ -1070,15 +1053,13 @@ void PolicyHandler::PTExchangeAtUserRequest(uint32_t correlation_id) { void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, const Permissions& permissions, const HMILevel& default_hmi) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); OnPermissionsUpdated(policy_app_id, permissions); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); if (!app.valid()) { - LOGGER_WARN( - logger_, - "Connection_key not found for application_id:" << policy_app_id); + SDL_WARN("Connection_key not found for application_id:" << policy_app_id); return; } @@ -1089,21 +1070,18 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, MessageHelper::StringToHMILevel(default_hmi); if (mobile_apis::HMILevel::INVALID_ENUM == hmi_level) { - LOGGER_WARN(logger_, - "Couldn't convert default hmi level " << default_hmi - << " to enum."); + SDL_WARN("Couldn't convert default hmi level " << default_hmi + << " to enum."); return; } if (current_hmi_level == hmi_level) { - LOGGER_DEBUG(logger_, "Application already in default hmi state."); + SDL_DEBUG("Application already in default hmi state."); return; } switch (current_hmi_level) { case mobile_apis::HMILevel::HMI_NONE: { - LOGGER_INFO(logger_, - "Changing hmi level of application " - << policy_app_id << " to default hmi level " - << default_hmi); + SDL_INFO("Changing hmi level of application " + << policy_app_id << " to default hmi level " << default_hmi); if (hmi_level == mobile_apis::HMILevel::HMI_FULL) { application_manager_.state_controller().SetRegularState( @@ -1115,32 +1093,28 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, break; } default: - LOGGER_WARN(logger_, - "Application " << policy_app_id - << " is running." - "HMI level won't be changed."); + SDL_WARN("Application " << policy_app_id + << " is running." + "HMI level won't be changed."); break; } } void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, const Permissions& permissions) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); if (!app.valid()) { - LOGGER_WARN( - logger_, - "Connection_key not found for application_id:" << policy_app_id); + SDL_WARN("Connection_key not found for application_id:" << policy_app_id); return; } MessageHelper::SendOnPermissionsChangeNotification( app->app_id(), permissions, application_manager_); - LOGGER_DEBUG(logger_, - "Notification sent for application_id:" - << policy_app_id << " and connection_key " << app->app_id()); + SDL_DEBUG("Notification sent for application_id:" + << policy_app_id << " and connection_key " << app->app_id()); } bool PolicyHandler::SaveSnapshot(const BinaryMessage& pt_string, @@ -1156,19 +1130,19 @@ bool PolicyHandler::SaveSnapshot(const BinaryMessage& pt_string, } if (!result) { - LOGGER_ERROR(logger_, "Failed to write snapshot file to " << snap_path); + SDL_ERROR("Failed to write snapshot file to " << snap_path); } return result; } void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); #ifdef EXTENDED_POLICY std::string policy_snapshot_full_path; if (!SaveSnapshot(pt_string, policy_snapshot_full_path)) { - LOGGER_ERROR(logger_, "Snapshot processing skipped."); + SDL_ERROR("Snapshot processing skipped."); return; } MessageHelper::SendPolicyUpdate(policy_snapshot_full_path, @@ -1180,7 +1154,7 @@ void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string) { policy_manager_->GetServiceUrls("0x07", urls); if (urls.empty()) { - LOGGER_ERROR(logger_, "Service URLs are empty! NOT sending PT to mobile!"); + SDL_ERROR("Service URLs are empty! NOT sending PT to mobile!"); return; } SendMessageToSDK(pt_string, urls.front().url.front()); @@ -1294,7 +1268,7 @@ void PolicyHandler::AddStatisticsInfo(int type) { ++count_of_iap_buffer_full; break; } - default: { LOGGER_WARN(logger_, "Type of statistics is unknown"); } + default: { SDL_WARN("Type of statistics is unknown"); } } } @@ -1313,7 +1287,7 @@ void PolicyHandler::OnSystemError(int code) { ++count_sync_out_of_memory; break; } - default: { LOGGER_WARN(logger_, "System error is unknown"); } + default: { SDL_WARN("System error is unknown"); } } } @@ -1323,9 +1297,7 @@ custom_str::CustomString PolicyHandler::GetAppName( application_manager_.application_by_policy_id(policy_app_id); if (!app.valid()) { - LOGGER_WARN( - logger_, - "Connection_key not found for application_id:" << policy_app_id); + SDL_WARN("Connection_key not found for application_id:" << policy_app_id); return custom_str::CustomString(""); } return app->name(); @@ -1333,7 +1305,7 @@ custom_str::CustomString PolicyHandler::GetAppName( void PolicyHandler::OnUpdateHMIAppType( std::map<std::string, StringArray> app_hmi_types) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(listeners_lock_); HandlersCollection::const_iterator it = listeners_.begin(); for (; it != listeners_.end(); ++it) { @@ -1342,7 +1314,7 @@ void PolicyHandler::OnUpdateHMIAppType( } void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(listeners_lock_); HandlersCollection::const_iterator it = listeners_.begin(); for (; it != listeners_.end(); ++it) { @@ -1356,21 +1328,21 @@ bool PolicyHandler::CanUpdate() { } void PolicyHandler::RemoveDevice(const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->MarkUnpairedDevice(device_id); } bool PolicyHandler::IsApplicationRevoked(const std::string& app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK(false); return policy_manager_->IsApplicationRevoked(app_id); } void PolicyHandler::OnUpdateRequestSentToMobile() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->OnUpdateStarted(); } @@ -1389,7 +1361,7 @@ bool PolicyHandler::CheckSystemAction( mobile_apis::SystemAction::eType system_action, const std::string& policy_app_id) const { using namespace mobile_apis; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); switch (system_action) { case SystemAction::STEAL_FOCUS: return CheckStealFocus(policy_app_id); @@ -1400,7 +1372,7 @@ bool PolicyHandler::CheckSystemAction( default: break; } - LOGGER_DEBUG(logger_, "Unknown system action"); + SDL_DEBUG("Unknown system action"); return false; } @@ -1444,7 +1416,7 @@ bool PolicyHandler::IsRequestTypeAllowed( std::string stringified_type = RequestTypeToString(type); if (stringified_type.empty()) { - LOGGER_ERROR(logger_, "Unknown request type."); + SDL_ERROR("Unknown request type."); return false; } diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc index 8541742c48..f6c0a3c6c3 100644 --- a/src/components/application_manager/src/request_controller.cc +++ b/src/components/application_manager/src/request_controller.cc @@ -51,7 +51,7 @@ namespace request_controller { using namespace sync_primitives; -CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController") +SDL_CREATE_LOGGER("RequestController") RequestController::RequestController(const RequestControlerSettings& settings) : pool_state_(UNDEFINED) @@ -61,19 +61,19 @@ RequestController::RequestController(const RequestControlerSettings& settings) this, &RequestController::onTimer)) , is_low_voltage_(false) , settings_(settings) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); InitializeThreadpool(); } RequestController::~RequestController() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (pool_state_ != TPoolState::STOPPED) { DestroyThreadpool(); } } void RequestController::InitializeThreadpool() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO(DK): Consider lazy loading threads instead of creating all at once pool_state_ = TPoolState::STARTED; char name[50]; @@ -81,16 +81,16 @@ void RequestController::InitializeThreadpool() { snprintf(name, sizeof(name) / sizeof(name[0]), "AM Pool %d", i); pool_.push_back(threads::CreateThread(name, new Worker(this))); pool_[i]->start(); - LOGGER_DEBUG(logger_, "Request thread initialized: " << name); + SDL_DEBUG("Request thread initialized: " << name); } } void RequestController::DestroyThreadpool() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); { AutoLock auto_lock(mobile_request_list_lock_); pool_state_ = TPoolState::STOPPED; - LOGGER_DEBUG(logger_, "Broadcasting STOP signal to all threads..."); + SDL_DEBUG("Broadcasting STOP signal to all threads..."); cond_var_.Broadcast(); // notify all threads we are shutting down } for (size_t i = 0; i < pool_.size(); i++) { @@ -104,7 +104,7 @@ void RequestController::DestroyThreadpool() { RequestController::TResult RequestController::CheckPosibilitytoAdd( const RequestPtr request) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const uint32_t& app_hmi_level_none_time_scale = settings_.app_hmi_level_none_time_scale(); @@ -120,7 +120,7 @@ RequestController::TResult RequestController::CheckPosibilitytoAdd( const uint32_t& pending_requests_amount = settings_.pending_requests_amount(); if (!CheckPendingRequestsAmount(pending_requests_amount)) { - LOGGER_ERROR(logger_, "Too many pending request"); + SDL_ERROR("Too many pending request"); return RequestController::TOO_MANY_PENDING_REQUESTS; } @@ -129,14 +129,14 @@ RequestController::TResult RequestController::CheckPosibilitytoAdd( request->connection_key(), app_hmi_level_none_time_scale, hmi_level_none_count)) { - LOGGER_ERROR(logger_, "Too many application requests in hmi level NONE"); + SDL_ERROR("Too many application requests in hmi level NONE"); return RequestController::NONE_HMI_LEVEL_MANY_REQUESTS; } if (!waiting_for_response_.CheckTimeScaleMaxRequest( request->connection_key(), app_time_scale, max_request_per_time_scale)) { - LOGGER_ERROR(logger_, "Too many application requests"); + SDL_ERROR("Too many application requests"); return RequestController::TOO_MANY_REQUESTS; } return SUCCESS; @@ -144,41 +144,38 @@ RequestController::TResult RequestController::CheckPosibilitytoAdd( bool RequestController::CheckPendingRequestsAmount( const uint32_t& pending_requests_amount) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (pending_requests_amount > 0) { const size_t pending_requests_size = mobile_request_list_.size(); const bool available_to_add = pending_requests_amount > pending_requests_size; if (!available_to_add) { - LOGGER_WARN(logger_, - "Pending requests count " << pending_requests_size - << " exceed application limit " - << pending_requests_amount); + SDL_WARN("Pending requests count " << pending_requests_size + << " exceed application limit " + << pending_requests_amount); } return available_to_add; } - LOGGER_DEBUG(logger_, "CheckPendingRequestsAmount disabled"); + SDL_DEBUG("CheckPendingRequestsAmount disabled"); return true; } RequestController::TResult RequestController::addMobileRequest( const RequestPtr request, const mobile_apis::HMILevel::eType& hmi_level) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!request) { - LOGGER_ERROR(logger_, "Null Pointer request"); + SDL_ERROR("Null Pointer request"); cond_var_.NotifyOne(); return INVALID_DATA; } - LOGGER_DEBUG( - logger_, - "correlation_id : " << request->correlation_id() - << "connection_key : " << request->connection_key()); + SDL_DEBUG("correlation_id : " << request->correlation_id() + << "connection_key : " + << request->connection_key()); RequestController::TResult result = CheckPosibilitytoAdd(request); if (SUCCESS == result) { AutoLock auto_lock_list(mobile_request_list_lock_); mobile_request_list_.push_back(request); - LOGGER_DEBUG(logger_, - "Waiting for execution: " << mobile_request_list_.size()); + SDL_DEBUG("Waiting for execution: " << mobile_request_list_.size()); // wake up one thread that is waiting for a task to be available } cond_var_.NotifyOne(); @@ -187,13 +184,13 @@ RequestController::TResult RequestController::addMobileRequest( RequestController::TResult RequestController::addHMIRequest( const RequestPtr request) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!request.valid()) { - LOGGER_ERROR(logger_, "HMI request pointer is invalid"); + SDL_ERROR("HMI request pointer is invalid"); return RequestController::INVALID_DATA; } - LOGGER_DEBUG(logger_, " correlation_id : " << request->correlation_id()); + SDL_DEBUG(" correlation_id : " << request->correlation_id()); const uint64_t timeout_in_mseconds = static_cast<uint64_t>(request->default_timeout()); @@ -201,78 +198,75 @@ RequestController::TResult RequestController::addHMIRequest( new HMIRequestInfo(request, timeout_in_mseconds)); if (0 == timeout_in_mseconds) { - LOGGER_DEBUG(logger_, - "Default timeout was set to 0." - "RequestController will not track timeout of this request."); + SDL_DEBUG( + "Default timeout was set to 0." + "RequestController will not track timeout of this request."); } waiting_for_response_.Add(request_info_ptr); - LOGGER_DEBUG(logger_, - "Waiting for response count:" << waiting_for_response_.Size()); + SDL_DEBUG("Waiting for response count:" << waiting_for_response_.Size()); UpdateTimer(); return RequestController::SUCCESS; } void RequestController::addNotification(const RequestPtr ptr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); notification_list_.push_back(ptr); } void RequestController::removeNotification( const commands::Command* notification) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::list<RequestPtr>::iterator it = notification_list_.begin(); for (; notification_list_.end() != it;) { if (it->get() == notification) { notification_list_.erase(it++); - LOGGER_DEBUG(logger_, "Notification removed"); + SDL_DEBUG("Notification removed"); break; } else { ++it; } } - LOGGER_DEBUG(logger_, "Cant find notification"); + SDL_DEBUG("Cant find notification"); } void RequestController::terminateRequest(const uint32_t& correlation_id, const uint32_t& connection_key, bool force_terminate) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "correlation_id = " << correlation_id - << " connection_key = " << connection_key - << " force_terminate = " << force_terminate); + SDL_AUTO_TRACE(); + SDL_DEBUG("correlation_id = " << correlation_id + << " connection_key = " << connection_key + << " force_terminate = " << force_terminate); RequestInfoPtr request = waiting_for_response_.Find(connection_key, correlation_id); if (request) { if (force_terminate || request->request()->AllowedToTerminate()) { waiting_for_response_.RemoveRequest(request); } else { - LOGGER_WARN(logger_, "Request was not terminated"); + SDL_WARN("Request was not terminated"); } UpdateTimer(); } else { - LOGGER_WARN(logger_, "Request not found in waiting_for_response_"); + SDL_WARN("Request not found in waiting_for_response_"); } } void RequestController::OnMobileResponse(const uint32_t& mobile_correlation_id, const uint32_t& connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); terminateRequest(mobile_correlation_id, connection_key); } void RequestController::OnHMIResponse(const uint32_t& correlation_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); terminateRequest(correlation_id, RequestInfo::HmiConnectoinKey); } void RequestController::terminateWaitingForExecutionAppRequests( const uint32_t& app_id) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "app_id: " << app_id << "Waiting for execution" - << mobile_request_list_.size()); + SDL_AUTO_TRACE(); + SDL_DEBUG("app_id: " << app_id << "Waiting for execution" + << mobile_request_list_.size()); AutoLock auto_lock(mobile_request_list_lock_); std::list<RequestPtr>::iterator request_it = mobile_request_list_.begin(); while (mobile_request_list_.end() != request_it) { @@ -283,26 +277,22 @@ void RequestController::terminateWaitingForExecutionAppRequests( ++request_it; } } - LOGGER_DEBUG(logger_, - "Waiting for execution " << mobile_request_list_.size()); + SDL_DEBUG("Waiting for execution " << mobile_request_list_.size()); } void RequestController::terminateWaitingForResponseAppRequests( const uint32_t& app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); waiting_for_response_.RemoveByConnectionKey(app_id); - LOGGER_DEBUG(logger_, - "Waiting for response count : " << waiting_for_response_.Size()); + SDL_DEBUG("Waiting for response count : " << waiting_for_response_.Size()); } void RequestController::terminateAppRequests(const uint32_t& app_id) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "app_id : " << app_id - << "Requests waiting for execution count : " - << mobile_request_list_.size() - << "Requests waiting for response count : " - << waiting_for_response_.Size()); + SDL_AUTO_TRACE(); + SDL_DEBUG("app_id : " << app_id << "Requests waiting for execution count : " + << mobile_request_list_.size() + << "Requests waiting for response count : " + << waiting_for_response_.Size()); terminateWaitingForExecutionAppRequests(app_id); terminateWaitingForResponseAppRequests(app_id); @@ -310,32 +300,30 @@ void RequestController::terminateAppRequests(const uint32_t& app_id) { } void RequestController::terminateAllHMIRequests() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); terminateWaitingForResponseAppRequests(RequestInfo::HmiConnectoinKey); } void RequestController::terminateAllMobileRequests() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); waiting_for_response_.RemoveMobileRequests(); - LOGGER_DEBUG(logger_, "Mobile Requests waiting for response cleared"); + SDL_DEBUG("Mobile Requests waiting for response cleared"); AutoLock waiting_execution_auto_lock(mobile_request_list_lock_); mobile_request_list_.clear(); - LOGGER_DEBUG(logger_, "Mobile Requests waiting for execution cleared"); + SDL_DEBUG("Mobile Requests waiting for execution cleared"); UpdateTimer(); } void RequestController::updateRequestTimeout(const uint32_t& app_id, const uint32_t& correlation_id, const uint32_t& new_timeout) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); - LOGGER_DEBUG(logger_, - "app_id : " << app_id - << " mobile_correlation_id : " << correlation_id - << " new_timeout : " << new_timeout); - LOGGER_DEBUG(logger_, - "New_timeout is NULL. RequestCtrl will " - "not manage this request any more"); + SDL_DEBUG("app_id : " << app_id << " mobile_correlation_id : " + << correlation_id << " new_timeout : " << new_timeout); + SDL_DEBUG( + "New_timeout is NULL. RequestCtrl will " + "not manage this request any more"); RequestInfoPtr request_info = waiting_for_response_.Find(app_id, correlation_id); @@ -344,74 +332,67 @@ void RequestController::updateRequestTimeout(const uint32_t& app_id, request_info->updateTimeOut(new_timeout); waiting_for_response_.Add(request_info); UpdateTimer(); - LOGGER_INFO(logger_, - "Timeout updated for " - << " app_id: " << app_id << " correlation_id: " - << correlation_id << " new_timeout (ms): " << new_timeout); + SDL_INFO("Timeout updated for " + << " app_id: " << app_id << " correlation_id: " << correlation_id + << " new_timeout (ms): " << new_timeout); } else { - LOGGER_ERROR(logger_, - "Can't find request with " - << " app_id: " << app_id - << " correlation_id: " << correlation_id); + SDL_ERROR("Can't find request with " + << " app_id: " << app_id + << " correlation_id: " << correlation_id); } } void RequestController::OnLowVoltage() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); is_low_voltage_ = true; } void RequestController::OnWakeUp() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); terminateAllHMIRequests(); terminateAllMobileRequests(); is_low_voltage_ = false; - LOGGER_DEBUG(logger_, "Terminate old requests done"); + SDL_DEBUG("Terminate old requests done"); } bool RequestController::IsLowVoltage() { - LOGGER_TRACE(logger_, "result: " << is_low_voltage_); + SDL_TRACE("result: " << is_low_voltage_); return is_low_voltage_; } void RequestController::onTimer() { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG( - logger_, + SDL_AUTO_TRACE(); + SDL_DEBUG( "ENTER Waiting fore response count: " << waiting_for_response_.Size()); RequestInfoPtr probably_expired = waiting_for_response_.FrontWithNotNullTimeout(); while (probably_expired && probably_expired->isExpired()) { - LOGGER_INFO(logger_, - "Timeout for " - << (RequestInfo::HMIRequest == - probably_expired->requst_type() - ? "HMI" - : "Mobile") - << " request id: " << probably_expired->requestId() - << " connection_key: " << probably_expired->app_id() - << " is expired"); + SDL_INFO("Timeout for " + << (RequestInfo::HMIRequest == probably_expired->requst_type() + ? "HMI" + : "Mobile") + << " request id: " << probably_expired->requestId() + << " connection_key: " << probably_expired->app_id() + << " is expired"); const uint32_t experied_request_id = probably_expired->requestId(); const uint32_t experied_app_id = probably_expired->app_id(); probably_expired->request()->onTimeOut(); if (RequestInfo::HmiConnectoinKey == probably_expired->app_id()) { - LOGGER_DEBUG(logger_, - "Erase HMI request: " << probably_expired->requestId()); + SDL_DEBUG("Erase HMI request: " << probably_expired->requestId()); waiting_for_response_.RemoveRequest(probably_expired); } probably_expired = waiting_for_response_.FrontWithNotNullTimeout(); if (probably_expired) { if (experied_request_id == probably_expired->requestId() && experied_app_id == probably_expired->app_id()) { - LOGGER_DEBUG(logger_, "Expired request wasn't removed"); + SDL_DEBUG("Expired request wasn't removed"); break; } } } UpdateTimer(); - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "EXIT Waiting for response count : " << waiting_for_response_.Size()); } @@ -421,7 +402,7 @@ RequestController::Worker::Worker(RequestController* requestController) RequestController::Worker::~Worker() {} void RequestController::Worker::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); AutoLock auto_lock(thread_lock_); while (!stop_flag_) { // Try to pick a request @@ -431,9 +412,9 @@ void RequestController::Worker::threadMain() { (request_controller_->mobile_request_list_.empty())) { // Wait until there is a task in the queue // Unlock mutex while wait, then lock it back when signaled - LOGGER_INFO(logger_, "Unlocking and waiting"); + SDL_INFO("Unlocking and waiting"); request_controller_->cond_var_.Wait(auto_lock); - LOGGER_INFO(logger_, "Signaled and locking"); + SDL_INFO("Signaled and locking"); } // If the thread was shutdown, return from here @@ -442,7 +423,7 @@ void RequestController::Worker::threadMain() { } if (request_controller_->mobile_request_list_.empty()) { - LOGGER_WARN(logger_, "Mobile request list is empty"); + SDL_WARN("Mobile request list is empty"); break; } @@ -457,15 +438,15 @@ void RequestController::Worker::threadMain() { new MobileRequestInfo(request_ptr, timeout_in_mseconds)); request_controller_->waiting_for_response_.Add(request_info_ptr); - LOGGER_DEBUG(logger_, "timeout_in_mseconds " << timeout_in_mseconds); + SDL_DEBUG("timeout_in_mseconds " << timeout_in_mseconds); if (0 != timeout_in_mseconds) { request_controller_->UpdateTimer(); } else { - LOGGER_DEBUG(logger_, - "Default timeout was set to 0. " - "RequestController will not track timeout " - "of this request."); + SDL_DEBUG( + "Default timeout was set to 0. " + "RequestController will not track timeout " + "of this request."); } AutoUnlock unlock(auto_lock); @@ -473,10 +454,9 @@ void RequestController::Worker::threadMain() { // execute if ((false == request_controller_->IsLowVoltage()) && request_ptr->CheckPermissions() && init_res) { - LOGGER_DEBUG(logger_, - "Execute MobileRequest corr_id = " - << request_info_ptr->requestId() - << " with timeout: " << timeout_in_mseconds); + SDL_DEBUG("Execute MobileRequest corr_id = " + << request_info_ptr->requestId() + << " with timeout: " << timeout_in_mseconds); request_ptr->Run(); } } @@ -489,7 +469,7 @@ void RequestController::Worker::exitThreadMain() { } void RequestController::UpdateTimer() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); RequestInfoPtr front = waiting_for_response_.FrontWithNotNullTimeout(); // Buffer for sending request const uint32_t delay_time = 100u; @@ -500,22 +480,20 @@ void RequestController::UpdateTimer() { if (current_time < end_time) { const uint32_t msecs = static_cast<uint32_t>( date_time::DateTime::getmSecs(end_time - current_time)); - LOGGER_DEBUG(logger_, "Sleep for " << msecs << " millisecs"); + SDL_DEBUG("Sleep for " << msecs << " millisecs"); // Timeout for bigger than 5 minutes is a mistake timer_.Start(msecs, timer::kSingleShot); } else { - LOGGER_WARN( - logger_, - "Request app_id: " - << front->app_id() << " correlation_id: " << front->requestId() - << " is expired. " - << "End time (ms): " << date_time::DateTime::getmSecs(end_time) - << " Current time (ms): " - << date_time::DateTime::getmSecs(current_time) - << " Diff (current - end) (ms): " - << date_time::DateTime::getmSecs(current_time - end_time) - << " Request timeout (sec): " - << front->timeout_msec() / date_time::kMillisecondsInSecond); + SDL_WARN("Request app_id: " + << front->app_id() << " correlation_id: " << front->requestId() + << " is expired. " + << "End time (ms): " << date_time::DateTime::getmSecs(end_time) + << " Current time (ms): " + << date_time::DateTime::getmSecs(current_time) + << " Diff (current - end) (ms): " + << date_time::DateTime::getmSecs(current_time - end_time) + << " Request timeout (sec): " + << front->timeout_msec() / date_time::kMillisecondsInSecond); } } } diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index 0883411aa9..013bd9a067 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -45,7 +45,7 @@ namespace application_manager { namespace request_controller { -CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController") +SDL_CREATE_LOGGER("RequestController") uint32_t RequestInfo::HmiConnectoinKey = 0; @@ -124,10 +124,8 @@ FakeRequestInfo::FakeRequestInfo(uint32_t app_id, uint32_t correaltion_id) { bool RequestInfoSet::Add(RequestInfoPtr request_info) { DCHECK_OR_RETURN(request_info, false); - LOGGER_DEBUG( - logger_, - "Add request app_id = " << request_info->app_id() - << "; corr_id = " << request_info->requestId()); + SDL_DEBUG("Add request app_id = " << request_info->app_id() << "; corr_id = " + << request_info->requestId()); sync_primitives::AutoLock lock(this_lock_); CheckSetSizes(); const std::pair<HashSortedRequestInfoSet::iterator, bool>& insert_resilt = @@ -142,10 +140,9 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) { CheckSetSizes(); return true; } else { - LOGGER_ERROR(logger_, - "Request with app_id = " - << request_info->app_id() << "; corr_id " - << request_info->requestId() << " Already exist "); + SDL_ERROR("Request with app_id = " << request_info->app_id() << "; corr_id " + << request_info->requestId() + << " Already exist "); } CheckSetSizes(); return false; @@ -180,7 +177,7 @@ RequestInfoPtr RequestInfoSet::Front() { } RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(this_lock_); RequestInfoPtr result; TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin(); @@ -199,7 +196,7 @@ RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() { bool RequestInfoSet::Erase(const RequestInfoPtr request_info) { DCHECK(request_info); if (!request_info) { - LOGGER_ERROR(logger_, "NULL ponter request_info"); + SDL_ERROR("NULL ponter request_info"); return false; } CheckSetSizes(); @@ -211,7 +208,7 @@ bool RequestInfoSet::Erase(const RequestInfoPtr request_info) { time_sorted_pending_requests_.find(request_info); DCHECK(it != time_sorted_pending_requests_.end()); if (it == time_sorted_pending_requests_.end()) { - LOGGER_ERROR(logger_, "Can't find request in time_sorted_requests_"); + SDL_ERROR("Can't find request in time_sorted_requests_"); return false; } const RequestInfoPtr found = *it; @@ -231,7 +228,7 @@ bool RequestInfoSet::RemoveRequest(const RequestInfoPtr request_info) { uint32_t RequestInfoSet::RemoveRequests( const RequestInfoSet::AppIdCompararator& filter) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t erased = 0; sync_primitives::AutoLock lock(this_lock_); @@ -250,13 +247,13 @@ uint32_t RequestInfoSet::RemoveRequests( } uint32_t RequestInfoSet::RemoveByConnectionKey(uint32_t connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return RemoveRequests( AppIdCompararator(AppIdCompararator::Equal, connection_key)); } uint32_t RequestInfoSet::RemoveMobileRequests() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual, RequestInfo::HmiConnectoinKey)); } @@ -277,7 +274,7 @@ bool RequestInfoSet::CheckTimeScaleMaxRequest( uint32_t app_id, uint32_t app_time_scale, uint32_t max_request_per_time_scale) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (max_request_per_time_scale > 0 && app_time_scale > 0) { TimevalStruct end = date_time::DateTime::getCurrentTime(); TimevalStruct start = {0, 0}; @@ -289,15 +286,14 @@ bool RequestInfoSet::CheckTimeScaleMaxRequest( time_sorted_pending_requests_.end(), scale); if (count >= max_request_per_time_scale) { - LOGGER_WARN(logger_, - "Processing requests count " << count - << " exceed application limit " - << max_request_per_time_scale); + SDL_WARN("Processing requests count " << count + << " exceed application limit " + << max_request_per_time_scale); return false; } - LOGGER_DEBUG(logger_, "Requests count " << count); + SDL_DEBUG("Requests count " << count); } else { - LOGGER_DEBUG(logger_, "CheckTimeScaleMaxRequest disabled"); + SDL_DEBUG("CheckTimeScaleMaxRequest disabled"); } return true; } @@ -307,7 +303,7 @@ bool RequestInfoSet::CheckHMILevelTimeScaleMaxRequest( uint32_t app_id, uint32_t app_time_scale, uint32_t max_request_per_time_scale) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (max_request_per_time_scale > 0 && app_time_scale > 0) { TimevalStruct end = date_time::DateTime::getCurrentTime(); TimevalStruct start = {0, 0}; @@ -319,16 +315,14 @@ bool RequestInfoSet::CheckHMILevelTimeScaleMaxRequest( time_sorted_pending_requests_.end(), scale); if (count >= max_request_per_time_scale) { - LOGGER_WARN(logger_, - "Processing requests count " - << count << " exceed application limit " - << max_request_per_time_scale << " in hmi level " - << hmi_level); + SDL_WARN("Processing requests count " + << count << " exceed application limit " + << max_request_per_time_scale << " in hmi level " << hmi_level); return false; } - LOGGER_DEBUG(logger_, "Requests count " << count); + SDL_DEBUG("Requests count " << count); } else { - LOGGER_DEBUG(logger_, "CheckHMILevelTimeScaleMaxRequest disabled"); + SDL_DEBUG("CheckHMILevelTimeScaleMaxRequest disabled"); } return true; } diff --git a/src/components/application_manager/src/resumption/resume_ctrl.cc b/src/components/application_manager/src/resumption/resume_ctrl.cc index 1987ddb726..0f28332e72 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl.cc @@ -54,7 +54,7 @@ namespace resumption { using namespace application_manager; -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOGGER("Resumption") ResumeCtrl::ResumeCtrl(ApplicationManager& application_manager) : event_engine::EventObserver(application_manager.event_dispatcher()) @@ -90,9 +90,9 @@ bool ResumeCtrl::Init(resumption::LastState& last_state) { dynamic_cast<ResumptionDataDB*>(resumption_storage_.get()); if (!db->IsDBVersionActual()) { - LOGGER_INFO(logger_, - "DB version had been changed. " - "Rebuilding resumption DB."); + SDL_INFO( + "DB version had been changed. " + "Rebuilding resumption DB."); smart_objects::SmartObject data; db->GetAllData(data); @@ -108,7 +108,7 @@ bool ResumeCtrl::Init(resumption::LastState& last_state) { resumption_storage_.reset( new ResumptionDataJson(last_state, application_manager_)); if (!resumption_storage_->Init()) { - LOGGER_DEBUG(logger_, "Resumption storage initialisation failed"); + SDL_DEBUG("Resumption storage initialisation failed"); return false; } } @@ -130,25 +130,23 @@ void ResumeCtrl::SaveAllApplications() { } void ResumeCtrl::SaveApplication(ApplicationSharedPtr application) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); - LOGGER_INFO(logger_, - "application with appID " << application->app_id() - << " will be saved"); + SDL_INFO("application with appID " << application->app_id() + << " will be saved"); resumption_storage_->SaveApplication(application); } void ResumeCtrl::on_event(const event_engine::Event& event) { - LOGGER_DEBUG(logger_, "Event received" << event.id()); + SDL_DEBUG("Event received" << event.id()); } bool ResumeCtrl::RestoreAppHMIState(ApplicationSharedPtr application) { using namespace mobile_apis; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOGGER_DEBUG(logger_, - "app_id : " << application->app_id() << "; policy_app_id : " - << application->policy_app_id()); + SDL_DEBUG("app_id : " << application->app_id() << "; policy_app_id : " + << application->policy_app_id()); const std::string& device_mac = application->mac_address(); smart_objects::SmartObject saved_app(smart_objects::SmartType_Map); bool result = resumption_storage_->GetSavedApplication( @@ -159,20 +157,20 @@ bool ResumeCtrl::RestoreAppHMIState(ApplicationSharedPtr application) { const HMILevel::eType saved_hmi_level = static_cast<mobile_apis::HMILevel::eType>( saved_app[strings::hmi_level].asInt()); - LOGGER_DEBUG(logger_, "Saved HMI Level is : " << saved_hmi_level); + SDL_DEBUG("Saved HMI Level is : " << saved_hmi_level); return SetAppHMIState(application, saved_hmi_level, true); } else { result = false; - LOGGER_ERROR(logger_, "saved app data corrupted"); + SDL_ERROR("saved app data corrupted"); } } else { - LOGGER_ERROR(logger_, "Application not saved"); + SDL_ERROR("Application not saved"); } return result; } bool ResumeCtrl::SetupDefaultHMILevel(ApplicationSharedPtr application) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); mobile_apis::HMILevel::eType default_hmi = application_manager_.GetDefaultHmiLevel(application); @@ -180,14 +178,14 @@ bool ResumeCtrl::SetupDefaultHMILevel(ApplicationSharedPtr application) { } void ResumeCtrl::ApplicationResumptiOnTimer() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(queue_lock_); WaitingForTimerList::iterator it = waiting_for_timer_.begin(); for (; it != waiting_for_timer_.end(); ++it) { ApplicationSharedPtr app = application_manager_.application(*it); if (!app) { - LOGGER_ERROR(logger_, "Invalid app_id = " << *it); + SDL_ERROR("Invalid app_id = " << *it); continue; } StartAppHmiStateResumption(app); @@ -204,7 +202,7 @@ void ResumeCtrl::OnAppActivated(ApplicationSharedPtr application) { } void ResumeCtrl::RemoveFromResumption(uint32_t app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); queue_lock_.Acquire(); waiting_for_timer_.remove(app_id); queue_lock_.Release(); @@ -214,31 +212,28 @@ bool ResumeCtrl::SetAppHMIState(ApplicationSharedPtr application, const mobile_apis::HMILevel::eType hmi_level, bool check_policy) { using namespace mobile_apis; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOGGER_TRACE(logger_, - " app_id : " << application->app_id() - << ", hmi_level : " << hmi_level - << ", check_policy : " << check_policy); + SDL_TRACE(" app_id : " << application->app_id() << ", hmi_level : " + << hmi_level << ", check_policy : " << check_policy); const std::string& device_mac = application->mac_address(); if (check_policy && application_manager_.GetUserConsentForDevice(device_mac) != policy::DeviceConsent::kDeviceAllowed) { - LOGGER_ERROR(logger_, "Resumption abort. Data consent wasn't allowed."); + SDL_ERROR("Resumption abort. Data consent wasn't allowed."); SetupDefaultHMILevel(application); return false; } application->set_is_resuming(true); application_manager_.state_controller().SetRegularState(application, hmi_level); - LOGGER_INFO(logger_, - "Application with policy id " << application->policy_app_id() - << " got HMI level " << hmi_level); + SDL_INFO("Application with policy id " << application->policy_app_id() + << " got HMI level " << hmi_level); return true; } bool ResumeCtrl::IsHMIApplicationIdExist(uint32_t hmi_app_id) { - LOGGER_DEBUG(logger_, "hmi_app_id :" << hmi_app_id); + SDL_DEBUG("hmi_app_id :" << hmi_app_id); return resumption_storage_->IsHMIApplicationIdExist(hmi_app_id); } @@ -261,7 +256,7 @@ bool ResumeCtrl::RemoveApplicationFromSaved( } void ResumeCtrl::OnSuspend() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); StopSavePersistentDataTimer(); SaveAllApplications(); resumption_storage_->OnSuspend(); @@ -275,7 +270,7 @@ void ResumeCtrl::OnAwake() { } void ResumeCtrl::StartSavePersistentDataTimer() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!save_persistent_data_timer_.is_running()) { save_persistent_data_timer_.Start( application_manager_.get_settings() @@ -285,7 +280,7 @@ void ResumeCtrl::StartSavePersistentDataTimer() { } void ResumeCtrl::StopSavePersistentDataTimer() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (save_persistent_data_timer_.is_running()) { save_persistent_data_timer_.Stop(); } @@ -293,14 +288,12 @@ void ResumeCtrl::StopSavePersistentDataTimer() { bool ResumeCtrl::StartResumption(ApplicationSharedPtr application, const std::string& hash) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOGGER_DEBUG( - logger_, - " Resume app_id = " << application->app_id() - << " hmi_app_id = " << application->hmi_app_id() - << " policy_id = " << application->policy_app_id() - << " received hash = " << hash); + SDL_DEBUG(" Resume app_id = " << application->app_id() << " hmi_app_id = " + << application->hmi_app_id() << " policy_id = " + << application->policy_app_id() + << " received hash = " << hash); SetupDefaultHMILevel(application); smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); @@ -317,16 +310,15 @@ bool ResumeCtrl::StartResumption(ApplicationSharedPtr application, bool ResumeCtrl::StartResumptionOnlyHMILevel(ApplicationSharedPtr application) { // sync_primitives::AutoLock lock(resumtion_lock_); - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!application) { - LOGGER_WARN(logger_, "Application does not exist."); + SDL_WARN("Application does not exist."); return false; } - LOGGER_DEBUG(logger_, - "HMI level resumption requested for application id " - << application->app_id() << "with hmi_app_id " - << application->hmi_app_id() << ", policy_app_id " - << application->policy_app_id()); + SDL_DEBUG("HMI level resumption requested for application id " + << application->app_id() << "with hmi_app_id " + << application->hmi_app_id() << ", policy_app_id " + << application->policy_app_id()); SetupDefaultHMILevel(application); const std::string& device_mac = application->mac_address(); smart_objects::SmartObject saved_app; @@ -336,13 +328,13 @@ bool ResumeCtrl::StartResumptionOnlyHMILevel(ApplicationSharedPtr application) { // sync_primitives::AutoUnlock unlock(lock); AddToResumptionTimerQueue(application->app_id()); } - LOGGER_INFO(logger_, "StartResumptionOnlyHMILevel::Result = " << result); + SDL_INFO("StartResumptionOnlyHMILevel::Result = " << result); return result; } void ResumeCtrl::StartAppHmiStateResumption(ApplicationSharedPtr application) { using namespace date_time; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); @@ -355,28 +347,26 @@ void ResumeCtrl::StartAppHmiStateResumption(ApplicationSharedPtr application) { CheckAppRestrictions(application, saved_app) && ((0 == ign_off_count) || CheckIgnCycleRestrictions(saved_app)); if (restore_data_allowed) { - LOGGER_INFO(logger_, "Resume application " << application->policy_app_id()); + SDL_INFO("Resume application " << application->policy_app_id()); RestoreAppHMIState(application); RemoveApplicationFromSaved(application); } else { - LOGGER_INFO(logger_, - "Do not need to resume application " - << application->policy_app_id()); + SDL_INFO("Do not need to resume application " + << application->policy_app_id()); } } void ResumeCtrl::ResetLaunchTime() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); launch_time_ = time(NULL); } bool ResumeCtrl::CheckPersistenceFilesForResumption( ApplicationSharedPtr application) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOGGER_DEBUG(logger_, - " Resume app_id = " << application->app_id() << " policy_id = " - << application->policy_app_id()); + SDL_DEBUG(" Resume app_id = " << application->app_id() << " policy_id = " + << application->policy_app_id()); smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); bool result = resumption_storage_->GetSavedApplication( @@ -399,10 +389,9 @@ bool ResumeCtrl::CheckPersistenceFilesForResumption( bool ResumeCtrl::CheckApplicationHash(ApplicationSharedPtr application, const std::string& hash) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOGGER_DEBUG(logger_, - "app_id : " << application->app_id() << " hash : " << hash); + SDL_DEBUG("app_id : " << application->app_id() << " hash : " << hash); smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); bool result = resumption_storage_->GetSavedApplication( @@ -411,9 +400,9 @@ bool ResumeCtrl::CheckApplicationHash(ApplicationSharedPtr application, } void ResumeCtrl::SaveDataOnTimer() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (is_resumption_active_) { - LOGGER_WARN(logger_, "Resumption timer is active skip saving"); + SDL_WARN("Resumption timer is active skip saving"); return; } @@ -428,15 +417,15 @@ void ResumeCtrl::SaveDataOnTimer() { bool ResumeCtrl::IsDeviceMacAddressEqual(ApplicationSharedPtr application, const std::string& saved_device_mac) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const std::string device_mac = application->mac_address(); return device_mac == saved_device_mac; } bool ResumeCtrl::RestoreApplicationData(ApplicationSharedPtr application) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOGGER_DEBUG(logger_, "app_id : " << application->app_id()); + SDL_DEBUG("app_id : " << application->app_id()); smart_objects::SmartObject saved_app(smart_objects::SmartType_Map); const std::string& device_mac = application->mac_address(); @@ -455,19 +444,18 @@ bool ResumeCtrl::RestoreApplicationData(ApplicationSharedPtr application) { AddWayPointsSubscription(application, saved_app); result = true; } else { - LOGGER_WARN(logger_, - "Saved data of application does not contain grammar_id"); + SDL_WARN("Saved data of application does not contain grammar_id"); result = false; } } else { - LOGGER_WARN(logger_, "Application not saved"); + SDL_WARN("Application not saved"); } return result; } void ResumeCtrl::AddFiles(ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (saved_app.keyExists(strings::application_files)) { const smart_objects::SmartObject& application_files = @@ -489,13 +477,13 @@ void ResumeCtrl::AddFiles(ApplicationSharedPtr application, } } } else { - LOGGER_FATAL(logger_, "application_files section is not exists"); + SDL_FATAL("application_files section is not exists"); } } void ResumeCtrl::AddSubmenues(ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (saved_app.keyExists(strings::application_submenus)) { const smart_objects::SmartObject& app_submenus = @@ -507,13 +495,13 @@ void ResumeCtrl::AddSubmenues(ApplicationSharedPtr application, ProcessHMIRequests(MessageHelper::CreateAddSubMenuRequestToHMI( application, application_manager_.GetNextHMICorrelationID())); } else { - LOGGER_FATAL(logger_, "application_submenus section is not exists"); + SDL_FATAL("application_submenus section is not exists"); } } void ResumeCtrl::AddCommands(ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (saved_app.keyExists(strings::application_commands)) { const smart_objects::SmartObject& app_commands = @@ -526,13 +514,13 @@ void ResumeCtrl::AddCommands(ApplicationSharedPtr application, ProcessHMIRequests(MessageHelper::CreateAddCommandRequestToHMI( application, application_manager_)); } else { - LOGGER_FATAL(logger_, "application_commands section is not exists"); + SDL_FATAL("application_commands section is not exists"); } } void ResumeCtrl::AddChoicesets(ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (saved_app.keyExists(strings::application_choice_sets)) { const smart_objects::SmartObject& app_choice_sets = @@ -546,14 +534,14 @@ void ResumeCtrl::AddChoicesets(ApplicationSharedPtr application, ProcessHMIRequests(MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI( application, application_manager_)); } else { - LOGGER_FATAL(logger_, "There is no any choicesets"); + SDL_FATAL("There is no any choicesets"); } } void ResumeCtrl::SetGlobalProperties( ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (saved_app.keyExists(strings::application_global_properties)) { const smart_objects::SmartObject& properties_so = @@ -566,7 +554,7 @@ void ResumeCtrl::SetGlobalProperties( void ResumeCtrl::AddWayPointsSubscription( app_mngr::ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (saved_app.keyExists(strings::subscribed_for_way_points)) { const smart_objects::SmartObject& subscribed_for_way_points_so = @@ -579,7 +567,7 @@ void ResumeCtrl::AddWayPointsSubscription( void ResumeCtrl::AddSubscriptions(ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (saved_app.keyExists(strings::application_subscribtions)) { const smart_objects::SmartObject& subscribtions = saved_app[strings::application_subscribtions]; @@ -613,16 +601,16 @@ void ResumeCtrl::AddSubscriptions(ApplicationSharedPtr application, bool ResumeCtrl::CheckIgnCycleRestrictions( const smart_objects::SmartObject& saved_app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool result = true; if (!CheckDelayAfterIgnOn()) { - LOGGER_INFO(logger_, "Application was connected long after ign on"); + SDL_INFO("Application was connected long after ign on"); result = false; } if (!DisconnectedJustBeforeIgnOff(saved_app)) { - LOGGER_INFO(logger_, "Application was dissconnected long before ign off"); + SDL_INFO("Application was dissconnected long before ign off"); result = false; } return result; @@ -631,7 +619,7 @@ bool ResumeCtrl::CheckIgnCycleRestrictions( bool ResumeCtrl::DisconnectedJustBeforeIgnOff( const smart_objects::SmartObject& saved_app) { using namespace date_time; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false); const time_t time_stamp = @@ -639,13 +627,12 @@ bool ResumeCtrl::DisconnectedJustBeforeIgnOff( time_t ign_off_time = static_cast<time_t>(resumption_storage_->GetIgnOffTime()); const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp); - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "ign_off_time " - << ign_off_time << "; app_disconnect_time " << time_stamp - << "; sec_spent_before_ign " << sec_spent_before_ign - << "; resumption_delay_before_ign " - << application_manager_.get_settings().resumption_delay_before_ign()); + << ign_off_time << "; app_disconnect_time " << time_stamp + << "; sec_spent_before_ign " << sec_spent_before_ign + << "; resumption_delay_before_ign " + << application_manager_.get_settings().resumption_delay_before_ign()); return sec_spent_before_ign <= application_manager_.get_settings().resumption_delay_before_ign(); } @@ -655,26 +642,27 @@ bool ResumeCtrl::CheckAppRestrictions( const smart_objects::SmartObject& saved_app) { using namespace mobile_apis; using namespace helpers; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(saved_app.keyExists(strings::hmi_level), false); +#if defined(ENABLE_LOG) const bool is_media_app = application->is_media_application(); +#endif const HMILevel::eType hmi_level = static_cast<HMILevel::eType>(saved_app[strings::hmi_level].asInt()); const bool result = Compare<HMILevel::eType, EQ, ONE>( hmi_level, HMILevel::HMI_FULL, HMILevel::HMI_LIMITED) ? true : false; - LOGGER_DEBUG(logger_, - "is_media_app " << is_media_app << "; hmi_level " << hmi_level - << " result " << result); + SDL_DEBUG("is_media_app " << is_media_app << "; hmi_level " << hmi_level + << " result " << result); return result; } bool ResumeCtrl::CheckIcons(ApplicationSharedPtr application, smart_objects::SmartObject& obj) { using namespace smart_objects; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const mobile_apis::Result::eType verify_images = MessageHelper::VerifyImageFiles(obj, application, application_manager_); return mobile_apis::Result::INVALID_DATA != verify_images; @@ -682,17 +670,16 @@ bool ResumeCtrl::CheckIcons(ApplicationSharedPtr application, bool ResumeCtrl::CheckDelayAfterIgnOn() { using namespace date_time; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const time_t curr_time = time(NULL); const time_t sdl_launch_time = launch_time(); const uint32_t seconds_from_sdl_start = labs(curr_time - sdl_launch_time); const uint32_t wait_time = application_manager_.get_settings().resumption_delay_after_ign(); - LOGGER_DEBUG(logger_, - "curr_time " << curr_time << "; sdl_launch_time " - << sdl_launch_time << "; seconds_from_sdl_start " - << seconds_from_sdl_start << "; wait_time " - << wait_time); + SDL_DEBUG("curr_time " << curr_time << "; sdl_launch_time " << sdl_launch_time + << "; seconds_from_sdl_start " + << seconds_from_sdl_start << "; wait_time " + << wait_time); return seconds_from_sdl_start <= wait_time; } @@ -706,7 +693,7 @@ time_t ResumeCtrl::GetIgnOffTime() { bool ResumeCtrl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request, bool use_events) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (use_events) { const hmi_apis::FunctionID::eType function_id = static_cast<hmi_apis::FunctionID::eType>( @@ -717,7 +704,7 @@ bool ResumeCtrl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request, subscribe_on_event(function_id, hmi_correlation_id); } if (!application_manager_.ManageHMICommand(request)) { - LOGGER_ERROR(logger_, "Unable to send request"); + SDL_ERROR("Unable to send request"); return false; } return true; @@ -734,13 +721,12 @@ void ResumeCtrl::ProcessHMIRequests( } void ResumeCtrl::AddToResumptionTimerQueue(const uint32_t app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); queue_lock_.Acquire(); waiting_for_timer_.push_back(app_id); queue_lock_.Release(); - LOGGER_DEBUG(logger_, - "Application ID " << app_id << " have been added" - " to resumption queue."); + SDL_DEBUG("Application ID " << app_id << " have been added" + " to resumption queue."); if (!is_resumption_active_) { is_resumption_active_ = true; restore_hmi_level_timer_.Start( @@ -750,7 +736,7 @@ void ResumeCtrl::AddToResumptionTimerQueue(const uint32_t app_id) { } void ResumeCtrl::LoadResumeData() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject so_applications_data; resumption_storage_->GetDataForLoadResumeData(so_applications_data); size_t length = so_applications_data.length(); @@ -759,11 +745,10 @@ void ResumeCtrl::LoadResumeData() { if (IsAppDataResumptionExpired(application)) { const std::string device_id = application[strings::device_id].asString(); const std::string app_id = application[strings::app_id].asString(); - LOGGER_INFO(logger_, "Data resumption is expired."); - LOGGER_DEBUG(logger_, - "Resumption data for application " - << app_id << " and device id " << device_id - << " will be dropped."); + SDL_INFO("Data resumption is expired."); + SDL_DEBUG("Resumption data for application " + << app_id << " and device id " << device_id + << " will be dropped."); resumption_storage_->DropAppDataResumption(device_id, app_id); continue; } @@ -772,10 +757,9 @@ void ResumeCtrl::LoadResumeData() { void ResumeCtrl::OnAppRegistrationStart(const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (IsApplicationSaved(policy_app_id, device_id)) { - LOGGER_INFO( - logger_, + SDL_INFO( "Application is found in resumption " "data and will try to resume. Stopping resume data persistent timer"); StopSavePersistentDataTimer(); @@ -783,7 +767,7 @@ void ResumeCtrl::OnAppRegistrationStart(const std::string& policy_app_id, } void ResumeCtrl::OnAppRegistrationEnd() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); StartSavePersistentDataTimer(); } diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc index f3ead5157f..8e6282fc50 100644 --- a/src/components/application_manager/src/resumption/resumption_data.cc +++ b/src/components/application_manager/src/resumption/resumption_data.cc @@ -38,7 +38,7 @@ namespace resumption { -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOGGER("Resumption") ResumptionData::ResumptionData( const application_manager::ApplicationManager& application_manager) @@ -47,11 +47,11 @@ ResumptionData::ResumptionData( smart_objects::SmartObject ResumptionData::GetApplicationCommands( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject commands_array(smart_objects::SmartType_Array); DCHECK_OR_RETURN(application, commands_array); if (!application) { - LOGGER_ERROR(logger_, "NULL Pointer App"); + SDL_ERROR("NULL Pointer App"); return commands_array; } const DataAccessor<CommandsMap> accessor = application->commands_map(); @@ -66,14 +66,14 @@ smart_objects::SmartObject ResumptionData::GetApplicationCommands( smart_objects::SmartObject ResumptionData::GetApplicationSubMenus( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(application.get()); smart_objects::SmartObject submenues_array = smart_objects::SmartObject(smart_objects::SmartType_Array); if (!application) { - LOGGER_ERROR(logger_, "NULL Pointer App"); + SDL_ERROR("NULL Pointer App"); return submenues_array; } const DataAccessor<SubMenuMap> accessor = application->sub_menu_map(); @@ -88,13 +88,13 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubMenus( smart_objects::SmartObject ResumptionData::GetApplicationInteractionChoiseSets( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(application.get()); smart_objects::SmartObject interaction_choice_set_array = smart_objects::SmartObject(smart_objects::SmartType_Array); if (!application) { - LOGGER_ERROR(logger_, "NULL Pointer App"); + SDL_ERROR("NULL Pointer App"); return interaction_choice_set_array; } const DataAccessor<ChoiceSetMap> accessor = application->choice_set_map(); @@ -109,13 +109,13 @@ smart_objects::SmartObject ResumptionData::GetApplicationInteractionChoiseSets( smart_objects::SmartObject ResumptionData::GetApplicationGlobalProperties( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(application.get()); smart_objects::SmartObject global_properties = smart_objects::SmartObject(smart_objects::SmartType_Map); if (!application) { - LOGGER_ERROR(logger_, "NULL Pointer App"); + SDL_ERROR("NULL Pointer App"); return global_properties; } @@ -139,22 +139,22 @@ smart_objects::SmartObject ResumptionData::GetApplicationGlobalProperties( smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(application.get()); smart_objects::SmartObject subscriptions = smart_objects::SmartObject(smart_objects::SmartType_Map); if (!application) { - LOGGER_ERROR(logger_, "NULL Pointer App"); + SDL_ERROR("NULL Pointer App"); return subscriptions; } - LOGGER_DEBUG(logger_, "app_id:" << application->app_id()); + SDL_DEBUG("app_id:" << application->app_id()); DataAccessor<ButtonSubscriptions> button_accessor = application->SubscribedButtons(); const ButtonSubscriptions& button_subscriptions = button_accessor.GetData(); - LOGGER_DEBUG(logger_, "SubscribedButtons:" << button_subscriptions.size()); + SDL_DEBUG("SubscribedButtons:" << button_subscriptions.size()); Append(button_subscriptions.begin(), button_subscriptions.end(), strings::application_buttons, @@ -165,7 +165,7 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions( const VehicleInfoSubscriptions& vi_subscription = vi_accessor.GetData(); - LOGGER_DEBUG(logger_, "SubscribedIVI:" << vi_subscription.size()); + SDL_DEBUG("SubscribedIVI:" << vi_subscription.size()); Append(vi_subscription.begin(), vi_subscription.end(), strings::application_vehicle_info, @@ -176,14 +176,14 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions( smart_objects::SmartObject ResumptionData::GetApplicationFiles( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(application.get()); - LOGGER_TRACE(logger_, "ENTER app_id:" << application->app_id()); + SDL_TRACE("ENTER app_id:" << application->app_id()); smart_objects::SmartObject files = smart_objects::SmartObject(smart_objects::SmartType_Array); if (!application) { - LOGGER_ERROR(logger_, "NULL Pointer App"); + SDL_ERROR("NULL Pointer App"); return files; } @@ -208,7 +208,7 @@ smart_objects::SmartObject ResumptionData::GetApplicationFiles( smart_objects::SmartObject ResumptionData::PointerToSmartObj( const smart_objects::SmartObject* ptr) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObject temp; if (ptr != NULL) { temp = *ptr; diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc index 7e546a012c..8c9fe7d57f 100644 --- a/src/components/application_manager/src/resumption/resumption_data_db.cc +++ b/src/components/application_manager/src/resumption/resumption_data_db.cc @@ -49,7 +49,7 @@ #include "application_manager/application_manager_settings.h" namespace resumption { -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOGGER("Resumption") namespace { const char* kDatabaseName = "resumption"; @@ -72,7 +72,7 @@ ResumptionDataDB::ResumptionDataDB( } else if (db_storage == In_Memory_Storage) { db_ = new utils::dbms::SQLDatabase(); } else { - LOGGER_ERROR(logger_, "Get not existed type of database storage"); + SDL_ERROR("Get not existed type of database storage"); } } @@ -82,81 +82,74 @@ ResumptionDataDB::~ResumptionDataDB() { } bool ResumptionDataDB::Init() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!db_->Open()) { - LOGGER_ERROR(logger_, "Failed opening database."); - LOGGER_INFO(logger_, "Starting opening retries."); + SDL_ERROR("Failed opening database."); + SDL_INFO("Starting opening retries."); const uint16_t attempts = application_manager_.get_settings().attempts_to_open_resumption_db(); - LOGGER_DEBUG(logger_, "Total attempts number is: " << attempts); + SDL_DEBUG("Total attempts number is: " << attempts); bool is_opened = false; const uint16_t open_attempt_timeout_ms = application_manager_.get_settings() .open_attempt_timeout_ms_resumption_db(); #if defined(OS_POSIX) const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000; - LOGGER_DEBUG(logger_, - "Open attempt timeout(ms) is: " << open_attempt_timeout_ms); + SDL_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms); for (int i = 0; i < attempts; ++i) { usleep(sleep_interval_mcsec); - LOGGER_INFO(logger_, "Attempt: " << i + 1); + SDL_INFO("Attempt: " << i + 1); if (db_->Open()) { - LOGGER_INFO(logger_, "Database opened."); + SDL_INFO("Database opened."); is_opened = true; break; } } #elif defined(OS_WINDOWS) - LOGGER_DEBUG(logger_, - "Open attempt timeout(ms) is: " << open_attempt_timeout_ms); + SDL_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms); for (int i = 0; i < attempts; ++i) { Sleep(open_attempt_timeout_ms); - LOGGER_INFO(logger_, "Attempt: " << i + 1); + SDL_INFO("Attempt: " << i + 1); if (db_->Open()) { - LOGGER_INFO(logger_, "Database opened."); + SDL_INFO("Database opened."); is_opened = true; break; } } #endif if (!is_opened) { - LOGGER_ERROR(logger_, - "Open retry sequence failed. Tried " - << attempts << " attempts with " - << open_attempt_timeout_ms - << " open timeout(ms) for each."); + SDL_ERROR("Open retry sequence failed. Tried " + << attempts << " attempts with " << open_attempt_timeout_ms + << " open timeout(ms) for each."); return false; } } #ifndef __QNX__ if (!db_->IsReadWrite()) { - LOGGER_ERROR(logger_, "There are no read/write permissions for database"); + SDL_ERROR("There are no read/write permissions for database"); return false; } #endif // __QNX__ utils::dbms::SQLQuery query(db()); if (!query.Exec(kCreateSchema)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Failed creating schema of database: " << query.LastError().text()); return false; } utils::dbms::SQLQuery query_checks_resumption(db()); if (!query_checks_resumption.Prepare(kChecksResumptionData) || !query_checks_resumption.Exec()) { - LOGGER_ERROR(logger_, - "Failed verification or execution query kChecksResumptionData" - << query_checks_resumption.LastError().text()); + SDL_ERROR("Failed verification or execution query kChecksResumptionData" + << query_checks_resumption.LastError().text()); return false; } if (0 == query_checks_resumption.GetInteger(0)) { utils::dbms::SQLQuery query_insert_resumption(db()); if (!query_insert_resumption.Prepare(kInsertInitData) || !query_insert_resumption.Exec()) { - LOGGER_ERROR(logger_, - "Failed insert init data to database: " - << query_insert_resumption.LastError().text()); + SDL_ERROR("Failed insert init data to database: " + << query_insert_resumption.LastError().text()); return false; } } @@ -168,48 +161,47 @@ void ResumptionDataDB::SaveApplication( using namespace app_mngr; using namespace mobile_api; using namespace helpers; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); bool application_exist = false; const std::string& policy_app_id = application->policy_app_id(); const std::string& device_mac = application->mac_address(); - LOGGER_INFO(logger_, - "app_id : " << application->app_id() << " policy_app_id : " - << policy_app_id << " device_id : " << device_mac); + SDL_INFO("app_id : " << application->app_id() << " policy_app_id : " + << policy_app_id << " device_id : " << device_mac); if (!CheckExistenceApplication( policy_app_id, device_mac, application_exist)) { - LOGGER_ERROR(logger_, "Problem with access to DB"); + SDL_ERROR("Problem with access to DB"); return; } if (application->is_application_data_changed()) { if (application_exist) { if (!DeleteSavedApplication(policy_app_id, device_mac)) { - LOGGER_ERROR(logger_, "Deleting of application data is not finished"); + SDL_ERROR("Deleting of application data is not finished"); return; } } if (!SaveApplicationToDB(application, policy_app_id, device_mac)) { - LOGGER_ERROR(logger_, "Saving of application data is not finished"); + SDL_ERROR("Saving of application data is not finished"); return; } - LOGGER_INFO(logger_, "All data from application were saved successfully"); + SDL_INFO("All data from application were saved successfully"); application->set_is_application_data_changed(false); } else { if (application_exist) { if (!UpdateApplicationData(application, policy_app_id, device_mac)) { - LOGGER_ERROR(logger_, "Updating application data is failed"); + SDL_ERROR("Updating application data is failed"); return; } - LOGGER_INFO(logger_, "Application data were updated successfully"); + SDL_INFO("Application data were updated successfully"); } else { if (Compare<HMILevel::eType, EQ, ONE>(application->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) { if (!InsertApplicationData(application, policy_app_id, device_mac)) { - LOGGER_ERROR(logger_, "Saving data of application is failed"); + SDL_ERROR("Saving data of application is failed"); return; } } @@ -219,21 +211,21 @@ void ResumptionDataDB::SaveApplication( } bool ResumptionDataDB::IsHMIApplicationIdExist(uint32_t hmi_app_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return CheckExistenceHMIId(hmi_app_id); } uint32_t ResumptionDataDB::GetHMIApplicationID( const std::string& policy_app_id, const std::string& device_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t hmi_app_id = 0; SelectHMIId(policy_app_id, device_id, hmi_app_id); return hmi_app_id; } void ResumptionDataDB::OnSuspend() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query_update_suspend_data(db()); utils::dbms::SQLQuery query_update_last_ign_off_time(db()); @@ -244,44 +236,43 @@ void ResumptionDataDB::OnSuspend() { const int application_lifes = 3; if (DeleteAppWithIgnCount(application_lifes)) { - LOGGER_INFO(logger_, - "Saved application with ign_off_count = " << application_lifes - << " was deleted"); + SDL_INFO("Saved application with ign_off_count = " << application_lifes + << " was deleted"); } else { - LOGGER_WARN(logger_, "Problem with removing applications"); + SDL_WARN("Problem with removing applications"); } if (query_update_suspend_data.Prepare(kUpdateSuspendData)) { if (query_update_suspend_data.Exec()) { - LOGGER_INFO(logger_, "Data ign_off_count and suspend_count were updated"); + SDL_INFO("Data ign_off_count and suspend_count were updated"); } } if (query_update_last_ign_off_time.Prepare(KUpdateLastIgnOffTime)) { query_update_last_ign_off_time.Bind(0, static_cast<int64_t>(time(NULL))); if (query_update_last_ign_off_time.Exec()) { - LOGGER_INFO(logger_, "Data last_ign_off_time was updated"); + SDL_INFO("Data last_ign_off_time was updated"); } } } bool ResumptionDataDB::DeleteAppWithIgnCount(const int application_lifes) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery select_apps_for_removing(db()); utils::dbms::SQLQuery count_app(db()); if (!select_apps_for_removing.Prepare(kSelectApplicationsIgnOffCount) || !count_app.Prepare(kCountApplicationsIgnOff)) { - LOGGER_WARN(logger_, - "Problem with verification query select_apps_for_removing or" - " query count_app"); + SDL_WARN( + "Problem with verification query select_apps_for_removing or" + " query count_app"); return false; } /* Positions of binding data for "query count_app" : field "ign_off_count" from table "application" = 0*/ count_app.Bind(0, application_lifes); if (!count_app.Exec() || !count_app.GetInteger(0)) { - LOGGER_WARN(logger_, "Problem with execution or count app=0"); + SDL_WARN("Problem with execution or count app=0"); return false; } std::string policy_app_id; @@ -293,11 +284,11 @@ bool ResumptionDataDB::DeleteAppWithIgnCount(const int application_lifes) { device_id = select_apps_for_removing.GetString(0); policy_app_id = select_apps_for_removing.GetString(1); if (!DeleteSavedApplication(policy_app_id, device_id)) { - LOGGER_WARN(logger_, "Problem with removing application data"); + SDL_WARN("Problem with removing application data"); return false; } } - LOGGER_WARN(logger_, "Applications data were removed successfully"); + SDL_WARN("Applications data were removed successfully"); WriteDb(); return true; } @@ -305,13 +296,13 @@ bool ResumptionDataDB::DeleteAppWithIgnCount(const int application_lifes) { bool ResumptionDataDB::GetHashId(const std::string& policy_app_id, const std::string& device_id, std::string& hash_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return SelectHashId(policy_app_id, device_id, hash_id); } void ResumptionDataDB::OnAwake() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); UpdateDataOnAwake(); } @@ -320,65 +311,62 @@ bool ResumptionDataDB::GetSavedApplication( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool application_exist = false; if (!CheckExistenceApplication(policy_app_id, device_id, application_exist) || !application_exist) { - LOGGER_ERROR(logger_, - "Problem with access to DB or application does not exists"); + SDL_ERROR("Problem with access to DB or application does not exists"); return false; } if (!SelectDataFromAppTable(policy_app_id, device_id, saved_app)) { - LOGGER_ERROR(logger_, - "Problem with restoring of data from application table"); + SDL_ERROR("Problem with restoring of data from application table"); return false; } if (!SelectFilesData(policy_app_id, device_id, saved_app)) { - LOGGER_ERROR(logger_, "Problem with restoring of files data"); + SDL_ERROR("Problem with restoring of files data"); return false; } if (!SelectSubmenuData(policy_app_id, device_id, saved_app)) { - LOGGER_ERROR(logger_, "Problem with restoring of submenu data"); + SDL_ERROR("Problem with restoring of submenu data"); return false; } if (!SelectCommandData(policy_app_id, device_id, saved_app)) { - LOGGER_ERROR(logger_, "Problem with restoring of command data"); + SDL_ERROR("Problem with restoring of command data"); return false; } if (!SelectSubscriptionsData(policy_app_id, device_id, saved_app)) { - LOGGER_ERROR(logger_, "Problem with restoring of subscriptions data"); + SDL_ERROR("Problem with restoring of subscriptions data"); return false; } if (!SelectChoiceSetData(policy_app_id, device_id, saved_app)) { - LOGGER_ERROR(logger_, "Problem with restoring of choice set data"); + SDL_ERROR("Problem with restoring of choice set data"); return false; } if (!SelectGlobalPropertiesData(policy_app_id, device_id, saved_app)) { - LOGGER_ERROR(logger_, "Problem with restoring of global properties data"); + SDL_ERROR("Problem with restoring of global properties data"); return false; } - LOGGER_INFO(logger_, - "Application data were successfully fetched from data base"); + SDL_INFO("Application data were successfully fetched from data base"); return true; } bool ResumptionDataDB::RemoveApplicationFromSaved( const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool application_exist = false; if (!CheckExistenceApplication(policy_app_id, device_id, application_exist) || !application_exist) { - LOGGER_ERROR(logger_, - "Problem with access to DB or application does not" - " exist"); + SDL_ERROR( + "Problem with access to DB or application does not" + " exist"); return false; } bool result = false; @@ -390,18 +378,18 @@ bool ResumptionDataDB::RemoveApplicationFromSaved( } uint32_t ResumptionDataDB::GetIgnOffTime() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return SelectIgnOffTime(); } ssize_t ResumptionDataDB::IsApplicationSaved( const std::string& policy_app_id, const std::string& device_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool application_exist = false; if (CheckExistenceApplication(policy_app_id, device_id, application_exist) && application_exist) { - LOGGER_INFO(logger_, "Application exists in stored data"); + SDL_INFO("Application exists in stored data"); return 0; } return -1; @@ -409,14 +397,14 @@ ssize_t ResumptionDataDB::IsApplicationSaved( void ResumptionDataDB::GetDataForLoadResumeData( smart_objects::SmartObject& saved_data) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SelectDataForLoadResumeData(saved_data); } bool ResumptionDataDB::SelectHMILevel(const std::string& policy_app_id, const std::string& device_id, int& hmi_level) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query_count(db()); utils::dbms::SQLQuery query_select(db()); if (query_count.Prepare(kSelectCountHMILevel) && @@ -440,25 +428,24 @@ bool ResumptionDataDB::SelectHMILevel(const std::string& policy_app_id, } bool ResumptionDataDB::CheckExistenceHMIId(uint32_t hmi_app_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (query.Prepare(kCheckHMIId)) { query.Bind(0, static_cast<int64_t>(hmi_app_id)); if (query.Exec() && (query.GetInteger(0))) { - LOGGER_INFO(logger_, "Saved data has HMI appID = " << hmi_app_id); + SDL_INFO("Saved data has HMI appID = " << hmi_app_id); return true; } } - LOGGER_FATAL(logger_, - "HMI appID = " << hmi_app_id << " doesn't exist in saved data"); + SDL_FATAL("HMI appID = " << hmi_app_id << " doesn't exist in saved data"); return false; } void ResumptionDataDB::SelectHMIId(const std::string& policy_app_id, const std::string& device_id, uint32_t& hmi_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query_select(db()); utils::dbms::SQLQuery query_check(db()); @@ -476,26 +463,26 @@ void ResumptionDataDB::SelectHMIId(const std::string& policy_app_id, if (query_check.Exec() && query_check.GetInteger(0) && query_select.Exec()) { hmi_id = query_select.GetUInteger(0); - LOGGER_INFO(logger_, "HMI appID = " << hmi_id); + SDL_INFO("HMI appID = " << hmi_id); return; } } - LOGGER_FATAL(logger_, - "Saved data doesn't have application with " - "device id = " - << device_id << " and policy appID = " << policy_app_id); + SDL_FATAL( + "Saved data doesn't have application with " + "device id = " + << device_id << " and policy appID = " << policy_app_id); } bool ResumptionDataDB::SelectHashId(const std::string& policy_app_id, const std::string& device_id, std::string& hash_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery count(db()); utils::dbms::SQLQuery select_hash(db()); if (!select_hash.Prepare(kSelectHashId) || !count.Prepare(kCountHashId)) { - LOGGER_WARN(logger_, - "Problem with verification count query or" - " select_hash query"); + SDL_WARN( + "Problem with verification count query or" + " select_hash query"); return false; } /* Positions of binding data for "count" and "select_hash" : @@ -509,30 +496,29 @@ bool ResumptionDataDB::SelectHashId(const std::string& policy_app_id, field "hashID" from table "application" = 0 */ if (count.Exec() && count.GetInteger(0) && select_hash.Exec()) { hash_id = select_hash.GetString(0); - LOGGER_INFO(logger_, "Saved hash ID = " << hash_id); + SDL_INFO("Saved hash ID = " << hash_id); return true; } - LOGGER_WARN(logger_, - "Saved data doesn't have application with " - "device id = " - << device_id << " and policy appID = " << policy_app_id - << "or hashID"); + SDL_WARN( + "Saved data doesn't have application with " + "device id = " + << device_id << " and policy appID = " << policy_app_id << "or hashID"); return false; } uint32_t ResumptionDataDB::SelectIgnOffTime() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t ignOffTime = 0; utils::dbms::SQLQuery query(db()); if (query.Prepare(kSelectIgnOffTime)) { if (query.Exec()) { ignOffTime = query.GetUInteger(0); - LOGGER_INFO(logger_, "Last ign off time = " << ignOffTime); + SDL_INFO("Last ign off time = " << ignOffTime); return ignOffTime; } } - LOGGER_ERROR(logger_, "Problem with prepare query"); + SDL_ERROR("Problem with prepare query"); return ignOffTime; } @@ -540,7 +526,7 @@ bool ResumptionDataDB::CheckExistenceApplication( const std::string& policy_app_id, const std::string& device_id, bool& application_exist) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool result = false; utils::dbms::SQLQuery query(db()); /* Positions of binding data for "query": @@ -554,15 +540,14 @@ bool ResumptionDataDB::CheckExistenceApplication( /* Position of data in "query" : amount of application = 0 */ if (result && query.GetInteger(0)) { - LOGGER_INFO(logger_, - "Saved data has application with policy appID = " - << policy_app_id << " and deviceID = " << device_id); + SDL_INFO("Saved data has application with policy appID = " + << policy_app_id << " and deviceID = " << device_id); application_exist = true; } else if (result) { - LOGGER_INFO(logger_, "Saved data does not contain application"); + SDL_INFO("Saved data does not contain application"); application_exist = false; } else { - LOGGER_ERROR(logger_, "Problem with access DB"); + SDL_ERROR("Problem with access DB"); } return result; } @@ -571,22 +556,22 @@ void ResumptionDataDB::SelectDataForLoadResumeData( smart_objects::SmartObject& saved_data) const { using namespace app_mngr; using namespace smart_objects; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery select_data(db()); utils::dbms::SQLQuery count_application(db()); if (!select_data.Prepare(kSelectDataForLoadResumeData) || !count_application.Prepare(kCountApplications)) { - LOGGER_WARN(logger_, - "Problem with verification select_data query" - " or count application"); + SDL_WARN( + "Problem with verification select_data query" + " or count application"); return; } if (!count_application.Exec() || !count_application.GetInteger(0)) { - LOGGER_WARN(logger_, - "Problem with execution count_application query" - " or appliction table does not contain data"); + SDL_WARN( + "Problem with execution count_application query" + " or appliction table does not contain data"); return; } SmartObject so_array_data(SmartType_Array); @@ -612,7 +597,7 @@ void ResumptionDataDB::SelectDataForLoadResumeData( void ResumptionDataDB::UpdateHmiLevel(const std::string& policy_app_id, const std::string& device_id, mobile_apis::HMILevel::eType hmi_level) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); /* Positions of binding data for "query": @@ -624,10 +609,9 @@ void ResumptionDataDB::UpdateHmiLevel(const std::string& policy_app_id, query.Bind(1, device_id); query.Bind(2, policy_app_id); if (query.Exec()) { - LOGGER_INFO(logger_, - "Saved data has application with policy appID = " - << policy_app_id << " and deviceID = " << device_id - << " has new HMI level = " << hmi_level); + SDL_INFO("Saved data has application with policy appID = " + << policy_app_id << " and deviceID = " << device_id + << " has new HMI level = " << hmi_level); WriteDb(); } } @@ -640,19 +624,16 @@ void ResumptionDataDB::Persist() { bool ResumptionDataDB::RefreshDB() const { utils::dbms::SQLQuery query(db()); if (!query.Exec(resumption::kDropSchema)) { - LOGGER_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_WARN("Failed dropping database: " << query.LastError().text()); return false; } if (!query.Exec(resumption::kCreateSchema)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Failed creating schema of database: " << query.LastError().text()); return false; } if (!query.Exec(resumption::kInsertInitData)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -660,10 +641,10 @@ bool ResumptionDataDB::RefreshDB() const { } bool ResumptionDataDB::GetAllData(smart_objects::SmartObject& data) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(resumption::kSelectAllApps)) { - LOGGER_ERROR(logger_, "Can't get applications data from DB."); + SDL_ERROR("Can't get applications data from DB."); return false; } @@ -683,9 +664,9 @@ bool ResumptionDataDB::GetAllData(smart_objects::SmartObject& data) const { } bool ResumptionDataDB::SaveAllData(const smart_objects::SmartObject& data) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (smart_objects::SmartType_Array != data.getType()) { - LOGGER_ERROR(logger_, "Unexpected type for resumption data."); + SDL_ERROR("Unexpected type for resumption data."); return false; } const smart_objects::SmartArray* apps = data.asArray(); @@ -701,30 +682,27 @@ bool ResumptionDataDB::SaveAllData(const smart_objects::SmartObject& data) { } bool ResumptionDataDB::IsDBVersionActual() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(resumption::kSelectDBVersion) || !query.Exec()) { - LOGGER_ERROR(logger_, - "Failed to get DB version: " << query.LastError().text()); + SDL_ERROR("Failed to get DB version: " << query.LastError().text()); return false; } const int32_t saved_db_version = query.GetInteger(0); const int32_t current_db_version = GetDBVersion(); - LOGGER_DEBUG(logger_, - "Saved DB version is: " << saved_db_version - << ". Current DB vesion is: " - << current_db_version); + SDL_DEBUG("Saved DB version is: " << saved_db_version + << ". Current DB vesion is: " + << current_db_version); return current_db_version == saved_db_version; } bool ResumptionDataDB::UpdateDBVersion() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(resumption::kUpdateDBVersion)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Incorrect DB version update query: " << query.LastError().text()); return false; } @@ -732,8 +710,7 @@ bool ResumptionDataDB::UpdateDBVersion() const { query.Bind(0, GetDBVersion()); if (!query.Exec()) { - LOGGER_ERROR(logger_, - "DB version update failed: " << query.LastError().text()); + SDL_ERROR("DB version update failed: " << query.LastError().text()); return false; } @@ -742,7 +719,7 @@ bool ResumptionDataDB::UpdateDBVersion() const { bool ResumptionDataDB::DropAppDataResumption(const std::string& device_id, const std::string& app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::ScopeGuard guard = utils::MakeObjGuard(*db_, &utils::dbms::SQLDatabase::RollbackTransaction); @@ -783,7 +760,7 @@ bool ResumptionDataDB::SelectFilesData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -795,13 +772,13 @@ bool ResumptionDataDB::SelectFilesData( saved_app[strings::application_files] = SmartObject(SmartType_Array); if (0 == count_item) { - LOGGER_INFO(logger_, "Application does not contain files data"); + SDL_INFO("Application does not contain files data"); return true; } utils::dbms::SQLQuery select_files(db()); if (!PrepareSelectQuery( select_files, policy_app_id, device_id, kSelectFiles)) { - LOGGER_WARN(logger_, "Problem with verification select_files"); + SDL_WARN("Problem with verification select_files"); return false; } saved_app[strings::application_files] = SmartObject(SmartType_Array); @@ -819,7 +796,7 @@ bool ResumptionDataDB::SelectFilesData( array_item[strings::sync_file_name] = select_files.GetString(3); saved_app[strings::application_files][i++] = array_item; } - LOGGER_INFO(logger_, "File data was restored successfully"); + SDL_INFO("File data was restored successfully"); return true; } @@ -827,7 +804,7 @@ bool ResumptionDataDB::SelectSubmenuData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -839,13 +816,13 @@ bool ResumptionDataDB::SelectSubmenuData( saved_app[strings::application_submenus] = SmartObject(SmartType_Array); if (0 == count_item) { - LOGGER_INFO(logger_, "Application does not contain submenu data"); + SDL_INFO("Application does not contain submenu data"); return true; } utils::dbms::SQLQuery select_sub_menu(db()); if (!PrepareSelectQuery( select_sub_menu, policy_app_id, device_id, kSelectSubMenu)) { - LOGGER_WARN(logger_, "Problem with verification select_sub_menu"); + SDL_WARN("Problem with verification select_sub_menu"); return false; } saved_app[strings::application_submenus] = SmartObject(SmartType_Array); @@ -863,7 +840,7 @@ bool ResumptionDataDB::SelectSubmenuData( } saved_app[strings::application_submenus][i++] = array_item; } - LOGGER_INFO(logger_, "Sub menu data was restored successfully"); + SDL_INFO("Sub menu data was restored successfully"); return true; } @@ -871,7 +848,7 @@ bool ResumptionDataDB::SelectCommandData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -883,7 +860,7 @@ bool ResumptionDataDB::SelectCommandData( saved_app[strings::application_commands] = SmartObject(SmartType_Array); if (0 == count_item) { - LOGGER_INFO(logger_, "Application does not contain commands data"); + SDL_INFO("Application does not contain commands data"); return true; } @@ -951,7 +928,7 @@ bool ResumptionDataDB::SelectCommandData( select_commands.GetString(7); } } - LOGGER_INFO(logger_, "Commands were restored from DB successfully"); + SDL_INFO("Commands were restored from DB successfully"); return true; } @@ -959,7 +936,7 @@ bool ResumptionDataDB::SelectSubscriptionsData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -971,7 +948,7 @@ bool ResumptionDataDB::SelectSubscriptionsData( saved_app[strings::application_subscribtions] = SmartObject(SmartType_Map); if (0 == count_item) { - LOGGER_INFO(logger_, "Application does not contain subscriptions data"); + SDL_INFO("Application does not contain subscriptions data"); return true; } utils::dbms::SQLQuery select_subscriptions(db()); @@ -979,7 +956,7 @@ bool ResumptionDataDB::SelectSubscriptionsData( policy_app_id, device_id, kSelectSubscriptions)) { - LOGGER_WARN(logger_, "Problem with verification select_subscriptions"); + SDL_WARN("Problem with verification select_subscriptions"); return false; } SmartObject application_buttons(SmartType_Array); @@ -1006,7 +983,7 @@ bool ResumptionDataDB::SelectSubscriptionsData( saved_app[strings::application_subscribtions] [strings::application_vehicle_info] = application_vehicle_info; } - LOGGER_INFO(logger_, "Subscriptions were restored from DB successfully"); + SDL_INFO("Subscriptions were restored from DB successfully"); return true; } @@ -1014,7 +991,7 @@ bool ResumptionDataDB::SelectChoiceSetData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -1026,13 +1003,13 @@ bool ResumptionDataDB::SelectChoiceSetData( saved_app[strings::application_choice_sets] = SmartObject(SmartType_Array); if (0 == count_item) { - LOGGER_INFO(logger_, "Application does not contain choice set data"); + SDL_INFO("Application does not contain choice set data"); return true; } utils::dbms::SQLQuery select_choice_set(db()); if (!PrepareSelectQuery( select_choice_set, policy_app_id, device_id, kSelectChoiceSets)) { - LOGGER_WARN(logger_, "Problem with verification select_choice_set"); + SDL_WARN("Problem with verification select_choice_set"); return false; } @@ -1108,7 +1085,7 @@ bool ResumptionDataDB::SelectChoiceSetData( [vr_cmd_idx++] = select_choice_set.GetString(10); } - LOGGER_INFO(logger_, "Choice sets were restored from DB successfully"); + SDL_INFO("Choice sets were restored from DB successfully"); return true; } @@ -1116,7 +1093,7 @@ bool ResumptionDataDB::SelectGlobalPropertiesData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -1129,7 +1106,7 @@ bool ResumptionDataDB::SelectGlobalPropertiesData( SmartObject(SmartType_Map); if (0 == count_item) { - LOGGER_INFO(logger_, "Application does not contain global properties data"); + SDL_INFO("Application does not contain global properties data"); return true; } utils::dbms::SQLQuery select_globalproperties(db()); @@ -1137,7 +1114,7 @@ bool ResumptionDataDB::SelectGlobalPropertiesData( policy_app_id, device_id, kSelectGlobalProperties)) { - LOGGER_WARN(logger_, "Problem with verification select_globalproperties"); + SDL_WARN("Problem with verification select_globalproperties"); return false; } saved_app[strings::application_global_properties] = @@ -1236,26 +1213,26 @@ bool ResumptionDataDB::SelectGlobalPropertiesData( bool ResumptionDataDB::SelectVrHelpItemsData( int64_t global_properties_key, smart_objects::SmartObject& global_properties) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; utils::dbms::SQLQuery checks_vrhelp_item(db()); if (!checks_vrhelp_item.Prepare(kChecksVrHelpItem)) { - LOGGER_WARN(logger_, "Problem with verification checks_vrhelp_item query"); + SDL_WARN("Problem with verification checks_vrhelp_item query"); return false; } checks_vrhelp_item.Bind(0, global_properties_key); if (!checks_vrhelp_item.Exec()) { - LOGGER_WARN(logger_, "Problem with execution checks_vrhelp_item query"); + SDL_WARN("Problem with execution checks_vrhelp_item query"); return false; } if (0 == checks_vrhelp_item.GetInteger(0)) { - LOGGER_INFO(logger_, "Global properties doesn't contain vr help item"); + SDL_INFO("Global properties doesn't contain vr help item"); return true; } utils::dbms::SQLQuery select_vrhelp_item(db()); if (!select_vrhelp_item.Prepare(kSelectVrHelpItem)) { - LOGGER_WARN(logger_, "Problem with verification select_vrhelp_item query"); + SDL_WARN("Problem with verification select_vrhelp_item query"); return false; } global_properties[strings::vr_help] = SmartObject(SmartType_Array); @@ -1279,35 +1256,34 @@ bool ResumptionDataDB::SelectVrHelpItemsData( } vr_help_items[vr_help_item_idx++] = item; } - LOGGER_INFO(logger_, "VR Help items were restored successfully"); + SDL_INFO("VR Help items were restored successfully"); return true; } bool ResumptionDataDB::SelectCharactersData( int64_t global_properties_key, smart_objects::SmartObject& keyboard_properties) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; utils::dbms::SQLQuery checks_characters(db()); if (!checks_characters.Prepare(kChecksCharacter)) { - LOGGER_WARN(logger_, "Problem with verification checks_characters query"); + SDL_WARN("Problem with verification checks_characters query"); return false; } checks_characters.Bind(0, global_properties_key); if (!checks_characters.Exec()) { - LOGGER_WARN(logger_, "Problem with execution checks_characters query"); + SDL_WARN("Problem with execution checks_characters query"); return false; } if (0 == checks_characters.GetInteger(0)) { - LOGGER_INFO( - logger_, + SDL_INFO( "Keyboard properties doesn't contain table limited character list"); return true; } utils::dbms::SQLQuery select_characters(db()); if (!select_characters.Prepare(kSelectCharacter)) { - LOGGER_WARN(logger_, "Problem with verification select_characters query"); + SDL_WARN("Problem with verification select_characters query"); return false; } @@ -1327,17 +1303,17 @@ bool ResumptionDataDB::SelectCharactersData( bool ResumptionDataDB::SelectImageData( int64_t image_key, smart_objects::SmartObject& image) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery select_image(db()); if (!select_image.Prepare(kSelectImage)) { - LOGGER_WARN(logger_, "Problem with verification select_image query"); + SDL_WARN("Problem with verification select_image query"); return false; } select_image.Bind(0, image_key); if (!select_image.Exec()) { - LOGGER_WARN(logger_, "Problem with execution select_image query"); + SDL_WARN("Problem with execution select_image query"); return false; } /* Position of data in "select_image" : @@ -1350,17 +1326,17 @@ bool ResumptionDataDB::SelectImageData( bool ResumptionDataDB::SelectTTSChunkData( int64_t tts_chunk_key, smart_objects::SmartObject& tts_chunk) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery select_tts_chunk(db()); if (!select_tts_chunk.Prepare(kSelectTTSChunk)) { - LOGGER_WARN(logger_, "Problem with verification select_tts_chunk query"); + SDL_WARN("Problem with verification select_tts_chunk query"); return false; } select_tts_chunk.Bind(0, tts_chunk_key); if (!select_tts_chunk.Exec()) { - LOGGER_WARN(logger_, "Problem with execution select_tts_chunk query"); + SDL_WARN("Problem with execution select_tts_chunk query"); return false; } /* Position of data in "select_tts_chunk" : @@ -1375,17 +1351,17 @@ bool ResumptionDataDB::SelectDataFromAppTable( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery query(db()); if (!query.Prepare(kSelectAppTable)) { - LOGGER_WARN(logger_, "Problem with verification kSelectAppTable query"); + SDL_WARN("Problem with verification kSelectAppTable query"); return false; } query.Bind(0, policy_app_id); query.Bind(1, device_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Problem with execution kSelectAppTable query"); + SDL_WARN("Problem with execution kSelectAppTable query"); return false; } // Position of data in "query" : @@ -1416,7 +1392,7 @@ bool ResumptionDataDB::SelectDataFromAppTable( saved_app[strings::is_media_application] = query.GetBoolean(9); saved_app[strings::subscribed_for_way_points] = query.GetBoolean(10); - LOGGER_INFO(logger_, "Data from application table was restored successfully"); + SDL_INFO("Data from application table was restored successfully"); return true; } @@ -1425,26 +1401,26 @@ bool ResumptionDataDB::SelectCountFromArray( const std::string& text_query, const std::string& policy_app_id, const std::string& device_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(text_query)) { - LOGGER_WARN(logger_, "Problem with verification query"); + SDL_WARN("Problem with verification query"); return false; } query.Bind(0, policy_app_id); query.Bind(1, device_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Problem with execution query"); + SDL_WARN("Problem with execution query"); return false; } count_item = query.GetInteger(0); - LOGGER_INFO(logger_, "count_item=" << count_item); + SDL_INFO("count_item=" << count_item); return true; } bool ResumptionDataDB::DeleteSavedApplication(const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::ScopeGuard guard = utils::MakeObjGuard(*db_, &utils::dbms::SQLDatabase::RollbackTransaction); @@ -1479,15 +1455,15 @@ bool ResumptionDataDB::DeleteSavedApplication(const std::string& policy_app_id, bool ResumptionDataDB::DeleteSavedFiles(const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteFile)) { - LOGGER_WARN(logger_, "Incorrect delete from file."); + SDL_WARN("Incorrect delete from file."); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationFilesArray)) { - LOGGER_WARN(logger_, "Incorrect delete from applicationFilesArray."); + SDL_WARN("Incorrect delete from applicationFilesArray."); return false; } return true; @@ -1495,16 +1471,16 @@ bool ResumptionDataDB::DeleteSavedFiles(const std::string& policy_app_id, bool ResumptionDataDB::DeleteSavedSubMenu(const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteSubMenu)) { - LOGGER_WARN(logger_, "Incorrect delete from subMenu."); + SDL_WARN("Incorrect delete from subMenu."); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationSubMenuArray)) { - LOGGER_WARN(logger_, "Incorrect delete from applicationSubMenuArray."); + SDL_WARN("Incorrect delete from applicationSubMenuArray."); return false; } return true; @@ -1512,12 +1488,11 @@ bool ResumptionDataDB::DeleteSavedSubMenu(const std::string& policy_app_id, bool ResumptionDataDB::DeleteSavedSubscriptions( const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationSubscribtionsArray)) { - LOGGER_WARN(logger_, - "Incorrect delete from applicationSubscribtionsArray."); + SDL_WARN("Incorrect delete from applicationSubscribtionsArray."); return false; } return true; @@ -1525,27 +1500,27 @@ bool ResumptionDataDB::DeleteSavedSubscriptions( bool ResumptionDataDB::DeleteSavedCommands(const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteImageFromCommands)) { - LOGGER_WARN(logger_, "Incorrect delete image from commands."); + SDL_WARN("Incorrect delete image from commands."); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteVrCommands)) { - LOGGER_WARN(logger_, "Incorrect delete vrcommands from commands."); + SDL_WARN("Incorrect delete vrcommands from commands."); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteCommands)) { - LOGGER_WARN(logger_, "Incorrect delete commands."); + SDL_WARN("Incorrect delete commands."); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationCommandsArray)) { - LOGGER_WARN(logger_, "Incorrect delete applicationCommandsArray."); + SDL_WARN("Incorrect delete applicationCommandsArray."); return false; } @@ -1554,39 +1529,39 @@ bool ResumptionDataDB::DeleteSavedCommands(const std::string& policy_app_id, bool ResumptionDataDB::DeleteSavedChoiceSet(const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!ExecUnionQueryToDeleteData( policy_app_id, device_id, kDeleteImageFromChoiceSet)) { - LOGGER_WARN(logger_, "Incorrect delete image from choice set"); + SDL_WARN("Incorrect delete image from choice set"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteVrCommandsFromChoiceSet)) { - LOGGER_WARN(logger_, "Incorrect delete vrCommands from choice set"); + SDL_WARN("Incorrect delete vrCommands from choice set"); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteChoice)) { - LOGGER_WARN(logger_, "Incorrect delete choiceSet"); + SDL_WARN("Incorrect delete choiceSet"); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteChoiceArray)) { - LOGGER_WARN(logger_, "Incorrect delete from choiceArray"); + SDL_WARN("Incorrect delete from choiceArray"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationChoiceSet)) { - LOGGER_WARN(logger_, "Incorrect delete applicationChoiceSet"); + SDL_WARN("Incorrect delete applicationChoiceSet"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationChoiceSetArray)) { - LOGGER_WARN(logger_, "Incorrect delete from ApplicationChoiceSetArray"); + SDL_WARN("Incorrect delete from ApplicationChoiceSetArray"); return false; } @@ -1595,50 +1570,50 @@ bool ResumptionDataDB::DeleteSavedChoiceSet(const std::string& policy_app_id, bool ResumptionDataDB::DeleteSavedGlobalProperties( const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!ExecUnionQueryToDeleteData( policy_app_id, device_id, kDeleteImageFromGlobalProperties)) { - LOGGER_WARN(logger_, "Incorrect delete image from globalProperties"); + SDL_WARN("Incorrect delete image from globalProperties"); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeletevrHelpItem)) { - LOGGER_WARN(logger_, "Incorrect delete vrHelpItem"); + SDL_WARN("Incorrect delete vrHelpItem"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeletevrHelpItemArray)) { - LOGGER_WARN(logger_, "Incorrect delete vrHelpItemArray"); + SDL_WARN("Incorrect delete vrHelpItemArray"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteTableLimitedCharacterList)) { - LOGGER_WARN(logger_, "Incorrect delete from tableLimitedCharacterList"); + SDL_WARN("Incorrect delete from tableLimitedCharacterList"); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteCharacterArray)) { - LOGGER_WARN(logger_, "Incorrect delete from characterArray"); + SDL_WARN("Incorrect delete from characterArray"); return false; } if (!ExecUnionQueryToDeleteData(policy_app_id, device_id, kDeleteTTSChunk)) { - LOGGER_WARN(logger_, "Incorrect delete from TTSChunk"); + SDL_WARN("Incorrect delete from TTSChunk"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteHelpTimeoutPromptArray)) { - LOGGER_WARN(logger_, "Incorrect delete from HelpTimeoutPromptArray"); + SDL_WARN("Incorrect delete from HelpTimeoutPromptArray"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteGlobalProperties)) { - LOGGER_WARN(logger_, "Incorrect delete from GlobalProperties"); + SDL_WARN("Incorrect delete from GlobalProperties"); return false; } @@ -1647,11 +1622,11 @@ bool ResumptionDataDB::DeleteSavedGlobalProperties( bool ResumptionDataDB::DeleteDataFromApplicationTable( const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteFromApplicationTable)) { - LOGGER_WARN(logger_, "Incorrect delete data from application table"); + SDL_WARN("Incorrect delete data from application table"); return false; } @@ -1661,7 +1636,7 @@ bool ResumptionDataDB::DeleteDataFromApplicationTable( bool ResumptionDataDB::ExecQueryToDeleteData(const std::string& policy_app_id, const std::string& device_id, const std::string& text_query) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); bool result = query.Prepare(text_query); if (result) { @@ -1676,7 +1651,7 @@ bool ResumptionDataDB::ExecUnionQueryToDeleteData( const std::string& policy_app_id, const std::string& device_id, const std::string& text_query) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); bool result = query.Prepare(text_query); if (result) { @@ -1691,7 +1666,7 @@ bool ResumptionDataDB::ExecUnionQueryToDeleteData( bool ResumptionDataDB::ExecInsertImage( int64_t& image_primary_key, const smart_objects::SmartObject& image) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery count_image_query(db()); utils::dbms::SQLQuery query(db()); @@ -1705,8 +1680,7 @@ bool ResumptionDataDB::ExecInsertImage( } } if (!result) { - LOGGER_WARN(logger_, - "Problem with preparing or execution count_image_query."); + SDL_WARN("Problem with preparing or execution count_image_query."); return false; } if (count_image) { @@ -1719,9 +1693,9 @@ bool ResumptionDataDB::ExecInsertImage( } } if (!result) { - LOGGER_WARN(logger_, - "Problem with preparing or execution " - "query for select primary key of image"); + SDL_WARN( + "Problem with preparing or execution " + "query for select primary key of image"); } } else { result = query.Prepare(kInsertImage); @@ -1734,9 +1708,9 @@ bool ResumptionDataDB::ExecInsertImage( } } if (!result) { - LOGGER_WARN(logger_, - "Problem with preparing or execution " - "query for insert image to image table"); + SDL_WARN( + "Problem with preparing or execution " + "query for insert image to image table"); } } return result; @@ -1745,12 +1719,12 @@ bool ResumptionDataDB::ExecInsertImage( bool ResumptionDataDB::ExecInsertChoice( int64_t choice_set_key, const smart_objects::SmartObject& choice_array) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery insert_choice(db()); if (!insert_choice.Prepare(kInsertChoice)) { - LOGGER_WARN(logger_, "Incorrect preparation insert_choice query"); + SDL_WARN("Incorrect preparation insert_choice query"); return false; } /* Positions of binding data for "insert_choice": @@ -1773,7 +1747,7 @@ bool ResumptionDataDB::ExecInsertChoice( if (choice_array[i].keyExists(strings::image)) { if (!ExecInsertImage(image_primary_key, choice_array[i][strings::image])) { - LOGGER_WARN(logger_, "Problem with insert image to choice"); + SDL_WARN("Problem with insert image to choice"); return false; } insert_choice.Bind(4, image_primary_key); @@ -1783,7 +1757,7 @@ bool ResumptionDataDB::ExecInsertChoice( if (choice_array[i].keyExists(strings::secondary_image)) { if (!ExecInsertImage(image_primary_key, choice_array[i][strings::secondary_image])) { - LOGGER_WARN(logger_, "Problem with insert secondary_image to choice"); + SDL_WARN("Problem with insert secondary_image to choice"); return false; } insert_choice.Bind(5, image_primary_key); @@ -1791,7 +1765,7 @@ bool ResumptionDataDB::ExecInsertChoice( insert_choice.Bind(5); } if (!insert_choice.Exec()) { - LOGGER_WARN(logger_, "Problem with execution insert_choice query"); + SDL_WARN("Problem with execution insert_choice query"); return false; } choice_primary_key = insert_choice.LastInsertId(); @@ -1800,17 +1774,17 @@ bool ResumptionDataDB::ExecInsertChoice( choice_array[i][strings::vr_commands], kVRCommandFromChoice)) || !insert_choice.Reset()) { - LOGGER_WARN(logger_, "problemm with add vr commands to choice"); + SDL_WARN("problemm with add vr commands to choice"); return false; } if (!ExecInsertDataToArray( choice_set_key, choice_primary_key, kInsertChoiceArray)) { - LOGGER_INFO(logger_, "Problem with insertion data to choiceArray table"); + SDL_INFO("Problem with insertion data to choiceArray table"); return false; } } - LOGGER_INFO(logger_, "Choice data were saved to DB successfully"); + SDL_INFO("Choice data were saved to DB successfully"); return true; } @@ -1818,11 +1792,11 @@ bool ResumptionDataDB::ExecInsertVrCommands( const int64_t primary_key, const smart_objects::SmartObject& vr_commands_array, AccessoryVRCommand value) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery insert_vr_command(db()); if (!insert_vr_command.Prepare(kInsertVrCommand)) { - LOGGER_WARN(logger_, "Incorrect preparation insert_vr_command query"); + SDL_WARN("Incorrect preparation insert_vr_command query"); return false; } size_t length_vr_commands = vr_commands_array.length(); @@ -1841,11 +1815,11 @@ bool ResumptionDataDB::ExecInsertVrCommands( insert_vr_command.Bind(2, primary_key); } if (!insert_vr_command.Exec() || !insert_vr_command.Reset()) { - LOGGER_WARN(logger_, "Problem with insert vr_command to DB"); + SDL_WARN("Problem with insert vr_command to DB"); return false; } } - LOGGER_INFO(logger_, "Insertion of Vr command were executed successfully"); + SDL_INFO("Insertion of Vr command were executed successfully"); return true; } @@ -1853,7 +1827,7 @@ bool ResumptionDataDB::ExecInsertDataToArray( int64_t first_primary_key, int64_t second_primary_key, const std::string& text_query) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool result; utils::dbms::SQLQuery query_insert_array(db()); result = query_insert_array.Prepare(text_query); @@ -1869,13 +1843,13 @@ bool ResumptionDataDB::SaveApplicationToDB( app_mngr::ApplicationSharedPtr application, const std::string& policy_app_id, const std::string& device_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); int64_t application_primary_key = 0; int64_t global_properties_key = 0; db_->BeginTransaction(); if (!InsertGlobalPropertiesData(GetApplicationGlobalProperties(application), global_properties_key)) { - LOGGER_WARN(logger_, "Incorrect insert globalProperties data to DB."); + SDL_WARN("Incorrect insert globalProperties data to DB."); db_->RollbackTransaction(); return false; } @@ -1885,38 +1859,38 @@ bool ResumptionDataDB::SaveApplicationToDB( device_id, &application_primary_key, global_properties_key)) { - LOGGER_WARN(logger_, "Incorrect insert application data to DB."); + SDL_WARN("Incorrect insert application data to DB."); db_->RollbackTransaction(); return false; } if (!InsertFilesData(GetApplicationFiles(application), application_primary_key)) { - LOGGER_WARN(logger_, "Incorrect insert file data to DB."); + SDL_WARN("Incorrect insert file data to DB."); db_->RollbackTransaction(); return false; } if (!InsertSubMenuData(GetApplicationSubMenus(application), application_primary_key)) { - LOGGER_WARN(logger_, "Incorrect insert submenu data to DB."); + SDL_WARN("Incorrect insert submenu data to DB."); db_->RollbackTransaction(); return false; } if (!InsertCommandsData(GetApplicationCommands(application), application_primary_key)) { - LOGGER_WARN(logger_, "Incorrect insert commands data to DB."); + SDL_WARN("Incorrect insert commands data to DB."); db_->RollbackTransaction(); return false; } if (!InsertSubscriptionsData(GetApplicationSubscriptions(application), application_primary_key)) { - LOGGER_WARN(logger_, "Incorrect insert subscribtions data to DB."); + SDL_WARN("Incorrect insert subscribtions data to DB."); db_->RollbackTransaction(); return false; } if (!InsertChoiceSetData(GetApplicationInteractionChoiseSets(application), application_primary_key)) { - LOGGER_WARN(logger_, "Incorrect insert choiceset data to DB."); + SDL_WARN("Incorrect insert choiceset data to DB."); db_->RollbackTransaction(); return false; } @@ -1928,14 +1902,14 @@ bool ResumptionDataDB::SaveApplicationToDB( const smart_objects::SmartObject& application, const std::string& policy_app_id, const std::string& device_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); int64_t application_primary_key = 0; int64_t global_properties_key = 0; db_->BeginTransaction(); if (!InsertGlobalPropertiesData(application["globalProperties"], global_properties_key)) { - LOGGER_WARN(logger_, "Incorrect insert globalProperties data to DB."); + SDL_WARN("Incorrect insert globalProperties data to DB."); db_->RollbackTransaction(); return false; } @@ -1944,38 +1918,38 @@ bool ResumptionDataDB::SaveApplicationToDB( device_id, &application_primary_key, global_properties_key)) { - LOGGER_WARN(logger_, "Incorrect insert application data to DB."); + SDL_WARN("Incorrect insert application data to DB."); db_->RollbackTransaction(); return false; } if (!InsertFilesData(application["applicationFiles"], application_primary_key)) { - LOGGER_WARN(logger_, "Incorrect insert file data to DB."); + SDL_WARN("Incorrect insert file data to DB."); db_->RollbackTransaction(); return false; } if (!InsertSubMenuData(application["applicationSubMenus"], application_primary_key)) { - LOGGER_WARN(logger_, "Incorrect insert submenu data to DB."); + SDL_WARN("Incorrect insert submenu data to DB."); db_->RollbackTransaction(); return false; } if (!InsertCommandsData(application["applicationCommands"], application_primary_key)) { - LOGGER_WARN(logger_, "Incorrect insert commands data to DB."); + SDL_WARN("Incorrect insert commands data to DB."); db_->RollbackTransaction(); return false; } if (!InsertSubscriptionsData(application["subscribtions"], application_primary_key)) { - LOGGER_WARN(logger_, "Incorrect insert subscribtions data to DB."); + SDL_WARN("Incorrect insert subscribtions data to DB."); db_->RollbackTransaction(); return false; } if (!InsertChoiceSetData(application["applicationChoiceSets"], application_primary_key)) { - LOGGER_WARN(logger_, "Incorrect insert choiceset data to DB."); + SDL_WARN("Incorrect insert choiceset data to DB."); db_->RollbackTransaction(); return false; } @@ -1985,20 +1959,19 @@ bool ResumptionDataDB::SaveApplicationToDB( bool ResumptionDataDB::InsertFilesData(const smart_objects::SmartObject& files, int64_t application_primary_key) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; const size_t length_files_array = files.length(); if (0 == length_files_array) { - LOGGER_INFO(logger_, "Application doesn't contain files"); + SDL_INFO("Application doesn't contain files"); return true; } utils::dbms::SQLQuery query_insert_file(db()); if (!query_insert_file.Prepare(kInsertToFile)) { - LOGGER_WARN(logger_, - "Problem with verification queries for insertion files"); + SDL_WARN("Problem with verification queries for insertion files"); return false; } /* Positions of binding data for "query_insert_file": @@ -2014,7 +1987,7 @@ bool ResumptionDataDB::InsertFilesData(const smart_objects::SmartObject& files, query_insert_file.Bind(3, (files[i][strings::sync_file_name]).asString()); if (!query_insert_file.Exec()) { - LOGGER_WARN(logger_, "Incorrect insertion of files data"); + SDL_WARN("Incorrect insertion of files data"); return false; } @@ -2022,31 +1995,30 @@ bool ResumptionDataDB::InsertFilesData(const smart_objects::SmartObject& files, query_insert_file.LastInsertId(), kInsertToApplicationFilesArray)) || !query_insert_file.Reset()) { - LOGGER_WARN(logger_, "Incorrect insertion to application files array"); + SDL_WARN("Incorrect insertion to application files array"); return false; } } - LOGGER_INFO(logger_, "Files data were inserted successfully to DB"); + SDL_INFO("Files data were inserted successfully to DB"); return true; } bool ResumptionDataDB::InsertSubMenuData( const smart_objects::SmartObject& submenus, int64_t application_primary_key) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; const size_t length_submenu_array = submenus.length(); if (0 == length_submenu_array) { - LOGGER_INFO(logger_, "Application doesn't contain submenu"); + SDL_INFO("Application doesn't contain submenu"); return true; } utils::dbms::SQLQuery query_insert_submenu(db()); if (!query_insert_submenu.Prepare(kInsertToSubMenu)) { - LOGGER_WARN(logger_, - "Problem with verification queries for insertion submenu"); + SDL_WARN("Problem with verification queries for insertion submenu"); return false; } /* Positions of binding data for "query_insert_submenu": @@ -2059,7 +2031,7 @@ bool ResumptionDataDB::InsertSubMenuData( CustomBind(strings::position, submenus[i], query_insert_submenu, 2); if (!query_insert_submenu.Exec()) { - LOGGER_WARN(logger_, "Incorrect insertion of submenu data"); + SDL_WARN("Incorrect insertion of submenu data"); return false; } @@ -2067,24 +2039,24 @@ bool ResumptionDataDB::InsertSubMenuData( query_insert_submenu.LastInsertId(), kInsertToApplicationSubMenuArray)) || !query_insert_submenu.Reset()) { - LOGGER_WARN(logger_, "Incorrect insertion to application submenu array"); + SDL_WARN("Incorrect insertion to application submenu array"); return false; } } - LOGGER_INFO(logger_, "Data about submenu were inserted successfully to DB"); + SDL_INFO("Data about submenu were inserted successfully to DB"); return true; } bool ResumptionDataDB::InsertCommandsData( const smart_objects::SmartObject& commands, int64_t application_primary_key) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; const size_t length_command_array = commands.length(); if (0 == length_command_array) { - LOGGER_INFO(logger_, "Application doesn't contain command"); + SDL_INFO("Application doesn't contain command"); return true; } utils::dbms::SQLQuery query_insert_command(db()); @@ -2092,8 +2064,7 @@ bool ResumptionDataDB::InsertCommandsData( int64_t command_primary_key = 0; if (!query_insert_command.Prepare(kInsertToCommand)) { - LOGGER_WARN(logger_, - "Problem with verification queries for insertion commands"); + SDL_WARN("Problem with verification queries for insertion commands"); return false; } /* Positions of binding data for "query_insert_command": @@ -2106,7 +2077,7 @@ bool ResumptionDataDB::InsertCommandsData( query_insert_command.Bind(0, commands[i][strings::cmd_id].asInt()); if (commands[i].keyExists(strings::cmd_icon)) { if (!ExecInsertImage(image_primary_key, commands[i][strings::cmd_icon])) { - LOGGER_WARN(logger_, "Problem with insert command image to DB"); + SDL_WARN("Problem with insert command image to DB"); return false; } query_insert_command.Bind(1, image_primary_key); @@ -2126,7 +2097,7 @@ bool ResumptionDataDB::InsertCommandsData( query_insert_command.Bind(4); } if (!query_insert_command.Exec()) { - LOGGER_WARN(logger_, "Incorrect insertion of command data to DB"); + SDL_WARN("Incorrect insertion of command data to DB"); return false; } command_primary_key = query_insert_command.LastInsertId(); @@ -2141,7 +2112,7 @@ bool ResumptionDataDB::InsertCommandsData( command_primary_key, kInsertApplicationCommandArray)) || !query_insert_command.Reset()) { - LOGGER_WARN(logger_, "Incorrect insertion to application commands array"); + SDL_WARN("Incorrect insertion to application commands array"); return false; } } @@ -2151,12 +2122,12 @@ bool ResumptionDataDB::InsertCommandsData( bool ResumptionDataDB::InsertSubscriptionsData( const smart_objects::SmartObject& subscriptions, int64_t application_primary_key) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; if (subscriptions.empty()) { - LOGGER_INFO(logger_, "Application doesn't contain subscriptions"); + SDL_INFO("Application doesn't contain subscriptions"); return true; } const SmartObject& btn_sub = subscriptions[strings::application_buttons]; @@ -2168,9 +2139,7 @@ bool ResumptionDataDB::InsertSubscriptionsData( utils::dbms::SQLQuery insert_subscriptions(db()); if (!insert_subscriptions.Prepare(kInsertSubscriptions)) { - LOGGER_WARN( - logger_, - "Problem with verification queries for insertion subscriptions"); + SDL_WARN("Problem with verification queries for insertion subscriptions"); return false; } /* Positions of binding data for "insert_subscriptions": @@ -2190,23 +2159,23 @@ bool ResumptionDataDB::InsertSubscriptionsData( insert_subscriptions.Bind(2); } if (!insert_subscriptions.Exec() || !insert_subscriptions.Reset()) { - LOGGER_WARN(logger_, "Incorrect insertion of buttons to subscriptions"); + SDL_WARN("Incorrect insertion of buttons to subscriptions"); return false; } } - LOGGER_INFO(logger_, "Subscriptions data were saved successfully"); + SDL_INFO("Subscriptions data were saved successfully"); return true; } bool ResumptionDataDB::InsertChoiceSetData( const smart_objects::SmartObject& choicesets, int64_t application_primary_key) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; if (choicesets.empty()) { - LOGGER_INFO(logger_, "Application doesn't contain choiceSet"); + SDL_INFO("Application doesn't contain choiceSet"); return true; } int64_t choice_set_key = 0; @@ -2223,27 +2192,27 @@ bool ResumptionDataDB::InsertChoiceSetData( if (!ExecInsertDataToArray(choice_set_key, application_primary_key, kInsertApplicationChoiceSetArray)) { - LOGGER_WARN(logger_, - "Problem with insertion data to" - " applicationChoiceSetArray table"); + SDL_WARN( + "Problem with insertion data to" + " applicationChoiceSetArray table"); return false; } } - LOGGER_INFO(logger_, "Choice set data were saved to DB successfully"); + SDL_INFO("Choice set data were saved to DB successfully"); return true; } bool ResumptionDataDB::ExecInsertApplicationChoiceSet( int64_t& choice_set_primary_key, const smart_objects::SmartObject& choiceset) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery insert_application_choice_set(db()); if (!insert_application_choice_set.Prepare(kInsertApplicationChoiceSet)) { - LOGGER_WARN(logger_, - "Problem with preparation insert " - "application choice set query"); + SDL_WARN( + "Problem with preparation insert " + "application choice set query"); return false; } /* Positions of binding data for "insert_application_choice_set": @@ -2255,19 +2224,18 @@ bool ResumptionDataDB::ExecInsertApplicationChoiceSet( 1, choiceset[strings::interaction_choice_set_id].asInt()); if (!insert_application_choice_set.Exec()) { - LOGGER_WARN(logger_, - "Problem with execution insert application choice set query"); + SDL_WARN("Problem with execution insert application choice set query"); return false; } choice_set_primary_key = insert_application_choice_set.LastInsertId(); - LOGGER_INFO(logger_, "Application choice data were saved successfully"); + SDL_INFO("Application choice data were saved successfully"); return true; } bool ResumptionDataDB::InsertGlobalPropertiesData( const smart_objects::SmartObject& global_properties, int64_t& global_properties_key) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; SmartMap::iterator it_begin = global_properties.map_begin(); @@ -2275,22 +2243,22 @@ bool ResumptionDataDB::InsertGlobalPropertiesData( bool data_exists = false; while (it_begin != it_end) { if (SmartType::SmartType_Null != ((it_begin->second).getType())) { - LOGGER_INFO(logger_, "Global properties contains - " << it_begin->first); + SDL_INFO("Global properties contains - " << it_begin->first); data_exists = true; break; } ++it_begin; } if (!data_exists) { - LOGGER_INFO(logger_, "Application doesn't contain global properties"); + SDL_INFO("Application doesn't contain global properties"); return true; } utils::dbms::SQLQuery insert_global_properties(db()); if (!insert_global_properties.Prepare(kInsertGlobalProperties)) { - LOGGER_WARN(logger_, - "Problem with preparation query " - "insert_global_properties"); + SDL_WARN( + "Problem with preparation query " + "insert_global_properties"); return false; } /* Positions of binding data for "insert_global_properties": @@ -2315,7 +2283,7 @@ bool ResumptionDataDB::InsertGlobalPropertiesData( if (ExecInsertImage(image_key, global_properties[strings::menu_icon])) { insert_global_properties.Bind(2, image_key); } else { - LOGGER_WARN(logger_, "Problem with insert image to global properties"); + SDL_WARN("Problem with insert image to global properties"); return false; } } @@ -2338,7 +2306,7 @@ bool ResumptionDataDB::InsertGlobalPropertiesData( strings::auto_complete_text, kb_prop, insert_global_properties, 6); } if (!insert_global_properties.Exec()) { - LOGGER_WARN(logger_, "Problem with insert data to global properties table"); + SDL_WARN("Problem with insert data to global properties table"); return false; } @@ -2351,8 +2319,7 @@ bool ResumptionDataDB::InsertGlobalPropertiesData( global_properties_key, global_properties[strings::keyboard_properties] [strings::limited_character_list])) { - LOGGER_WARN(logger_, - "Problem with insert data to limited_character table"); + SDL_WARN("Problem with insert data to limited_character table"); return false; } } @@ -2361,25 +2328,24 @@ bool ResumptionDataDB::InsertGlobalPropertiesData( global_properties[strings::vr_help].getType()) { if (!ExecInsertVRHelpItem(global_properties_key, global_properties[strings::vr_help])) { - LOGGER_WARN(logger_, "Problem with insert data to vrHelpItem table"); + SDL_WARN("Problem with insert data to vrHelpItem table"); return false; } } if (!ExecInsertHelpTimeoutArray(global_properties, global_properties_key)) { - LOGGER_WARN(logger_, - "Problem with insert data to HelpTimeoutPromptArray table"); + SDL_WARN("Problem with insert data to HelpTimeoutPromptArray table"); return false; } - LOGGER_INFO(logger_, "Global properties data were saved successfully"); + SDL_INFO("Global properties data were saved successfully"); return true; } bool ResumptionDataDB::ExecInsertHelpTimeoutArray( const smart_objects::SmartObject& global_properties, int64_t global_properties_key) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; size_t timeout_prompt_length = 0; @@ -2395,16 +2361,14 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray( timeout_prompt_length = global_properties[strings::timeout_prompt].length(); } if (0 == timeout_prompt_length && 0 == help_prompt_length) { - LOGGER_INFO(logger_, - "Application doesn't HelpPrompt and timoutPrompt data"); + SDL_INFO("Application doesn't HelpPrompt and timoutPrompt data"); return true; } utils::dbms::SQLQuery insert_help_prompt_array(db()); if (!insert_help_prompt_array.Prepare(kInsertHelpTimeoutPromptArray)) { - LOGGER_WARN(logger_, - "Problem with verification query insert_help_prompt_array"); + SDL_WARN("Problem with verification query insert_help_prompt_array"); return false; } int64_t tts_chunk_key = 0; @@ -2421,7 +2385,7 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray( if (i < timeout_prompt_length) { if (!ExecInsertTTSChunks(global_properties[strings::timeout_prompt][i], tts_chunk_key)) { - LOGGER_WARN(logger_, "Problem with insertion timeoutPrompt's ttsChunk"); + SDL_WARN("Problem with insertion timeoutPrompt's ttsChunk"); return false; } insert_help_prompt_array.Bind(1, tts_chunk_key); @@ -2432,7 +2396,7 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray( if (i < help_prompt_length) { if (!ExecInsertTTSChunks(global_properties[strings::help_prompt][i], tts_chunk_key)) { - LOGGER_WARN(logger_, "Problem with insertion helpPrompt's ttsChunk"); + SDL_WARN("Problem with insertion helpPrompt's ttsChunk"); return false; } insert_help_prompt_array.Bind(2, tts_chunk_key); @@ -2440,23 +2404,22 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray( insert_help_prompt_array.Bind(2); } if (!insert_help_prompt_array.Exec() || !insert_help_prompt_array.Reset()) { - LOGGER_WARN( - logger_, + SDL_WARN( "Problem with execution or resetting insert_help_prompt_array query"); return false; } } - LOGGER_INFO(logger_, "Data were saved to helpTimeoutPromptArray table"); + SDL_INFO("Data were saved to helpTimeoutPromptArray table"); return true; } bool ResumptionDataDB::ExecInsertTTSChunks( const smart_objects::SmartObject& tts_chunk, int64_t& tts_chunk_key) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery insert_tts_chunk(db()); if (!insert_tts_chunk.Prepare(kInsertTTSChunk)) { - LOGGER_WARN(logger_, "Problem with verification insert_tts_chunk query"); + SDL_WARN("Problem with verification insert_tts_chunk query"); return false; } /* Positions of binding data for "insert_tts_chunk": @@ -2465,24 +2428,24 @@ bool ResumptionDataDB::ExecInsertTTSChunks( insert_tts_chunk.Bind(0, tts_chunk[strings::type].asInt()); insert_tts_chunk.Bind(1, tts_chunk[strings::text].asString()); if (!insert_tts_chunk.Exec()) { - LOGGER_WARN(logger_, "Problem with execution insert_tts_chunk query"); + SDL_WARN("Problem with execution insert_tts_chunk query"); return false; } tts_chunk_key = insert_tts_chunk.LastInsertId(); - LOGGER_WARN(logger_, "TTSChunk was saved successfully"); + SDL_WARN("TTSChunk was saved successfully"); return true; } bool ResumptionDataDB::ExecInsertLimitedCharacters( int64_t global_properties_key, const smart_objects::SmartObject& characters_array) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery insert_characters(db()); if (!insert_characters.Prepare(kInsertTableLimitedCharacter)) { - LOGGER_WARN(logger_, - "Problem with preparation query " - "insert_characters"); + SDL_WARN( + "Problem with preparation query " + "insert_characters"); return false; } size_t length_characters_array = characters_array.length(); @@ -2492,31 +2455,29 @@ bool ResumptionDataDB::ExecInsertLimitedCharacters( insert_characters.Bind(0, characters_array[i].asString()); if (!insert_characters.Exec()) { - LOGGER_WARN(logger_, - "Problem with insert data to limited_character table"); + SDL_WARN("Problem with insert data to limited_character table"); return false; } if ((!ExecInsertDataToArray(global_properties_key, insert_characters.LastInsertId(), kInsertCharacterArray)) || (!insert_characters.Reset())) { - LOGGER_WARN(logger_, "Problem with insert data to characterArray table"); + SDL_WARN("Problem with insert data to characterArray table"); return false; } } - LOGGER_INFO(logger_, - "Data were saved successfully to limited_character table"); + SDL_INFO("Data were saved successfully to limited_character table"); return true; } bool ResumptionDataDB::ExecInsertVRHelpItem( int64_t global_properties_key, const smart_objects::SmartObject& vrhelp_array) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery insert_vrhelp_item(db()); if (!insert_vrhelp_item.Prepare(kInsertVRHelpItem)) { - LOGGER_WARN(logger_, "Problem with preparation query insert_vrhelp_item"); + SDL_WARN("Problem with preparation query insert_vrhelp_item"); return false; } int64_t image_primary_key = 0; @@ -2531,7 +2492,7 @@ bool ResumptionDataDB::ExecInsertVRHelpItem( if (vrhelp_array[i].keyExists(strings::image)) { if (!ExecInsertImage(image_primary_key, vrhelp_array[i][strings::image])) { - LOGGER_INFO(logger_, "Problem with insert image to vrHelpItem table"); + SDL_INFO("Problem with insert image to vrHelpItem table"); return false; } insert_vrhelp_item.Bind(2, image_primary_key); @@ -2540,7 +2501,7 @@ bool ResumptionDataDB::ExecInsertVRHelpItem( } if (!insert_vrhelp_item.Exec()) { - LOGGER_INFO(logger_, "Problem with insert data vrHelpItem table"); + SDL_INFO("Problem with insert data vrHelpItem table"); return false; } @@ -2548,12 +2509,11 @@ bool ResumptionDataDB::ExecInsertVRHelpItem( insert_vrhelp_item.LastInsertId(), kInsertVRHelpItemArray)) || (!insert_vrhelp_item.Reset())) { - LOGGER_WARN(logger_, "Problem with insert data to vrHelpItemArray table"); + SDL_WARN("Problem with insert data to vrHelpItemArray table"); return false; } } - LOGGER_INFO(logger_, - "Data were saved successfully to vrHelpItem array table"); + SDL_INFO("Data were saved successfully to vrHelpItem array table"); return true; } @@ -2561,7 +2521,7 @@ bool ResumptionDataDB::InsertApplicationData( app_mngr::ApplicationSharedPtr application, const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationParams app(application); return InsertApplicationData(app, policy_app_id, device_id, NULL, 0); } @@ -2572,12 +2532,12 @@ bool ResumptionDataDB::InsertApplicationData( const std::string& device_id, int64_t* application_primary_key, int64_t global_properties_key) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery query(db()); if (!application.m_is_valid) { - LOGGER_ERROR(logger_, "Invalid application params passed."); + SDL_ERROR("Invalid application params passed."); return false; } @@ -2592,9 +2552,9 @@ bool ResumptionDataDB::InsertApplicationData( application_manager_.IsAppSubscribedForWayPoints(connection_key); if (!query.Prepare(kInsertApplication)) { - LOGGER_WARN(logger_, - "Problem with verification query " - "for insert to table application"); + SDL_WARN( + "Problem with verification query " + "for insert to table application"); return false; } @@ -2629,13 +2589,13 @@ bool ResumptionDataDB::InsertApplicationData( query.Bind(11, is_subscribed_for_way_points); if (!query.Exec()) { - LOGGER_WARN(logger_, "Problem with execution query"); + SDL_WARN("Problem with execution query"); return false; } if (NULL != application_primary_key) { *application_primary_key = query.LastInsertId(); } - LOGGER_INFO(logger_, "Data were saved successfully to application table"); + SDL_INFO("Data were saved successfully to application table"); return true; } @@ -2643,7 +2603,7 @@ void ResumptionDataDB::CustomBind(const std::string& key, const smart_objects::SmartObject& so, utils::dbms::SQLQuery& query, const int pos) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace smart_objects; if (so.keyExists(key) && SmartType::SmartType_Null != so[key].getType()) { switch (so[key].getType()) { @@ -2656,7 +2616,7 @@ void ResumptionDataDB::CustomBind(const std::string& key, break; } default: { - LOGGER_WARN(logger_, "Incorrect type"); + SDL_WARN("Incorrect type"); break; } } @@ -2669,9 +2629,9 @@ bool ResumptionDataDB::PrepareSelectQuery(utils::dbms::SQLQuery& query, const std::string& policy_app_id, const std::string& device_id, const std::string& text_query) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!query.Prepare(text_query)) { - LOGGER_WARN(logger_, "Problem with verification query"); + SDL_WARN("Problem with verification query"); return false; } query.Bind(0, policy_app_id); @@ -2680,13 +2640,12 @@ bool ResumptionDataDB::PrepareSelectQuery(utils::dbms::SQLQuery& query, } void ResumptionDataDB::UpdateDataOnAwake() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (query.Prepare(kUpdateIgnOffCount)) { if (query.Exec()) { - LOGGER_INFO(logger_, - "Values of ignition off counts were updated successfully"); + SDL_INFO("Values of ignition off counts were updated successfully"); WriteDb(); } } @@ -2696,7 +2655,7 @@ bool ResumptionDataDB::UpdateApplicationData( app_mngr::ApplicationConstSharedPtr application, const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery query(db()); @@ -2704,9 +2663,9 @@ bool ResumptionDataDB::UpdateApplicationData( const mobile_apis::HMILevel::eType hmi_level = application->hmi_level(); if (!query.Prepare(kUpdateApplicationData)) { - LOGGER_WARN(logger_, - "Problem with verification query " - "for updating some application data"); + SDL_WARN( + "Problem with verification query " + "for updating some application data"); return false; } @@ -2721,28 +2680,27 @@ bool ResumptionDataDB::UpdateApplicationData( query.Bind(3, device_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Problem with execution query"); + SDL_WARN("Problem with execution query"); return false; } - LOGGER_INFO(logger_, "Data were updated successfully in application table"); + SDL_INFO("Data were updated successfully in application table"); return true; } void ResumptionDataDB::WriteDb() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); db_->Backup(); } bool ResumptionDataDB::UpdateGrammarID(const std::string& policy_app_id, const std::string& device_id, const uint32_t grammar_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery query(db()); if (!query.Prepare(kUpdateGrammarID)) { - LOGGER_WARN(logger_, - "Problem with verification query for updating grammar id."); + SDL_WARN("Problem with verification query for updating grammar id."); return false; } @@ -2755,10 +2713,10 @@ bool ResumptionDataDB::UpdateGrammarID(const std::string& policy_app_id, query.Bind(2, device_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Problem with execution query"); + SDL_WARN("Problem with execution query"); return false; } - LOGGER_INFO(logger_, "Data were updated successfully in application table"); + SDL_INFO("Data were updated successfully in application table"); return true; } diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc index fcf0b6cb89..bb2faa412c 100644 --- a/src/components/application_manager/src/resumption/resumption_data_json.cc +++ b/src/components/application_manager/src/resumption/resumption_data_json.cc @@ -46,7 +46,7 @@ namespace resumption { namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOGGER("Resumption") ResumptionDataJson::ResumptionDataJson( LastState& last_state, @@ -57,13 +57,12 @@ void ResumptionDataJson::SaveApplication( app_mngr::ApplicationSharedPtr application) { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); const std::string& policy_app_id = application->policy_app_id(); - LOGGER_DEBUG(logger_, - "app_id : " << application->app_id() - << " policy_app_id : " << policy_app_id); + SDL_DEBUG("app_id : " << application->app_id() + << " policy_app_id : " << policy_app_id); const std::string hash = application->curHash(); const uint32_t grammar_id = application->get_grammar_id(); const utils::json::JsonValue::UInt time_stamp = @@ -108,13 +107,13 @@ void ResumptionDataJson::SaveApplication( json_app[strings::application_files] = tmp; json_app[strings::time_stamp] = time_stamp; json_app[strings::subscribed_for_way_points] = is_subscribed_for_way_points; - LOGGER_DEBUG(logger_, "SaveApplication : " << json_app.ToJson()); + SDL_DEBUG("SaveApplication : " << json_app.ToJson()); } bool ResumptionDataJson::IsHMIApplicationIdExist(uint32_t hmi_app_id) const { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); const JsonValueRef saved_applications = GetSavedApplications(); for (JsonValue::const_iterator itr = saved_applications.begin(), @@ -135,13 +134,13 @@ uint32_t ResumptionDataJson::GetHMIApplicationID( using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); uint32_t hmi_app_id = 0; const int idx = GetObjectIndex(policy_app_id, device_id); if (-1 == idx) { - LOGGER_WARN(logger_, "Application not saved"); + SDL_WARN("Application not saved"); return hmi_app_id; } @@ -150,7 +149,7 @@ uint32_t ResumptionDataJson::GetHMIApplicationID( json_app.HasMember(strings::device_id)) { hmi_app_id = json_app[strings::hmi_app_id].AsUInt(); } - LOGGER_DEBUG(logger_, "hmi_app_id :" << hmi_app_id); + SDL_DEBUG("hmi_app_id :" << hmi_app_id); return hmi_app_id; } @@ -158,7 +157,7 @@ void ResumptionDataJson::OnSuspend() { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); JsonValue to_save; JsonValueRef saved_applications = GetSavedApplications(); @@ -171,20 +170,20 @@ void ResumptionDataJson::OnSuspend() { const uint32_t counter_value = ign_off_count.AsUInt(); ign_off_count = utils::json::JsonValue::UInt(counter_value + 1); } else { - LOGGER_WARN(logger_, "Unknown key among saved applications"); + SDL_WARN("Unknown key among saved applications"); (*itr)[strings::ign_off_count] = utils::json::JsonValue::UInt(1); } to_save.Append(*itr); } SetSavedApplication(to_save); SetLastIgnOffTime(time(NULL)); - LOGGER_DEBUG(logger_, GetResumptionData().ToJson()); + SDL_DEBUG(GetResumptionData().ToJson()); } void ResumptionDataJson::OnAwake() { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); JsonValueRef saved_applications = GetSavedApplications(); for (JsonValue::iterator itr = saved_applications.begin(), @@ -194,13 +193,13 @@ void ResumptionDataJson::OnAwake() { if ((*itr).HasMember(strings::ign_off_count)) { const uint32_t ign_off_count = (*itr)[strings::ign_off_count].AsUInt(); if (0 == ign_off_count) { - LOGGER_WARN(logger_, "Application has not been suspended"); + SDL_WARN("Application has not been suspended"); } else { (*itr)[strings::ign_off_count] = utils::json::JsonValue::UInt(ign_off_count - 1); } } else { - LOGGER_WARN(logger_, "Unknown key among saved applications"); + SDL_WARN("Unknown key among saved applications"); (*itr)[strings::ign_off_count] = utils::json::JsonValue::UInt(0); } } @@ -211,22 +210,22 @@ bool ResumptionDataJson::GetHashId(const std::string& policy_app_id, std::string& hash_id) const { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); const int idx = GetObjectIndex(policy_app_id, device_id); if (-1 == idx) { - LOGGER_WARN(logger_, "Application not saved"); + SDL_WARN("Application not saved"); return false; } const JsonValueRef json_app = GetSavedApplications()[idx]; - LOGGER_DEBUG(logger_, "Saved_application_data: " << json_app.ToJson()); + SDL_DEBUG("Saved_application_data: " << json_app.ToJson()); if (json_app.HasMember(strings::hash_id) && json_app.HasMember(strings::time_stamp)) { hash_id = json_app[strings::hash_id].AsString(); return true; } - LOGGER_WARN(logger_, "There are some unknown keys in the dictionary."); + SDL_WARN("There are some unknown keys in the dictionary."); return false; } @@ -235,7 +234,7 @@ bool ResumptionDataJson::GetSavedApplication( const std::string& device_id, smart_objects::SmartObject& saved_app) const { using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); const int idx = GetObjectIndex(policy_app_id, device_id); if (-1 == idx) { @@ -250,7 +249,7 @@ bool ResumptionDataJson::RemoveApplicationFromSaved( const std::string& policy_app_id, const std::string& device_id) { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); bool result = false; std::vector<JsonValue> temp; @@ -276,7 +275,7 @@ bool ResumptionDataJson::RemoveApplicationFromSaved( } if (false == result) { - LOGGER_TRACE(logger_, "EXIT result: " << (result ? "true" : "false")); + SDL_TRACE("EXIT result: " << (result ? "true" : "false")); return result; } @@ -285,26 +284,26 @@ bool ResumptionDataJson::RemoveApplicationFromSaved( ++it) { saved_applications.Append((*it)); } - LOGGER_TRACE(logger_, "EXIT result: " << (result ? "true" : "false")); + SDL_TRACE("EXIT result: " << (result ? "true" : "false")); return result; } uint32_t ResumptionDataJson::GetIgnOffTime() const { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); JsonValueRef resumption = GetResumptionData(); if (!resumption.HasMember(strings::last_ign_off_time)) { resumption[strings::last_ign_off_time] = utils::json::JsonValue::UInt(0); - LOGGER_WARN(logger_, "last_save_time section is missed"); + SDL_WARN("last_save_time section is missed"); } return resumption[strings::last_ign_off_time].AsUInt(); } ssize_t ResumptionDataJson::IsApplicationSaved( const std::string& policy_app_id, const std::string& device_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); return GetObjectIndex(policy_app_id, device_id); } @@ -313,7 +312,7 @@ utils::json::JsonValueRef ResumptionDataJson::GetFromSavedOrAppend( const std::string& policy_app_id, const std::string& device_id) const { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); JsonValueRef saved_applications = GetSavedApplications(); for (JsonValue::iterator itr = saved_applications.begin(), @@ -333,7 +332,7 @@ void ResumptionDataJson::GetDataForLoadResumeData( smart_objects::SmartObject& saved_data) const { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); smart_objects::SmartObject so_array_data(smart_objects::SmartType_Array); int i = 0; @@ -370,14 +369,13 @@ void ResumptionDataJson::UpdateHmiLevel( const std::string& policy_app_id, const std::string& device_id, mobile_apis::HMILevel::eType hmi_level) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; int idx = GetObjectIndex(policy_app_id, device_id); if (-1 == idx) { - LOGGER_WARN(logger_, - "Application isn't saved with mobile_app_id = " - << policy_app_id << " device_id = " << device_id); + SDL_WARN("Application isn't saved with mobile_app_id = " + << policy_app_id << " device_id = " << device_id); return; } GetSavedApplications()[idx][strings::hmi_level] = @@ -387,16 +385,16 @@ void ResumptionDataJson::UpdateHmiLevel( utils::json::JsonValueRef ResumptionDataJson::GetSavedApplications() const { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); JsonValueRef resumption = GetResumptionData(); if (!resumption.HasMember(strings::resume_app_list)) { resumption[strings::resume_app_list] = JsonValue(ValueType::ARRAY_VALUE); - LOGGER_WARN(logger_, "app_list section is missed"); + SDL_WARN("app_list section is missed"); } JsonValueRef resume_app_list = resumption[strings::resume_app_list]; if (!resume_app_list.IsArray()) { - LOGGER_ERROR(logger_, "resume_app_list type INVALID rewrite"); + SDL_ERROR("resume_app_list type INVALID rewrite"); resume_app_list = JsonValue(ValueType::ARRAY_VALUE); } return resume_app_list; @@ -405,16 +403,16 @@ utils::json::JsonValueRef ResumptionDataJson::GetSavedApplications() const { utils::json::JsonValueRef ResumptionDataJson::GetResumptionData() const { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); JsonValue& last_state = last_state_.dictionary(); if (!last_state.HasMember(strings::resumption)) { last_state[strings::resumption] = JsonValue(ValueType::OBJECT_VALUE); - LOGGER_WARN(logger_, "resumption section is missed"); + SDL_WARN("resumption section is missed"); } utils::json::JsonValueRef resumption = last_state[strings::resumption]; if (!resumption.IsObject()) { - LOGGER_ERROR(logger_, "resumption type INVALID rewrite"); + SDL_ERROR("resumption type INVALID rewrite"); resumption = JsonValue(ValueType::OBJECT_VALUE); } return resumption; @@ -424,7 +422,7 @@ ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id, const std::string& device_id) const { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); const JsonValueRef apps = GetSavedApplications(); const JsonValue::ArrayIndex size = apps.Size(); @@ -436,7 +434,7 @@ ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id, const std::string& saved_device_id = apps[idx][strings::device_id].AsString(); if (device_id == saved_device_id && policy_app_id == saved_app_id) { - LOGGER_DEBUG(logger_, "Found " << idx); + SDL_DEBUG("Found " << idx); return idx; } } @@ -447,7 +445,7 @@ ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id, bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const { using namespace app_mngr; using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); const JsonValueRef json_app = GetSavedApplications()[index]; if (!json_app.HasMember(strings::app_id) || @@ -456,13 +454,13 @@ bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const { !json_app.HasMember(strings::hmi_app_id) || !json_app.HasMember(strings::time_stamp) || !json_app.HasMember(strings::device_id)) { - LOGGER_ERROR(logger_, "Wrong resumption data"); + SDL_ERROR("Wrong resumption data"); return false; } if (json_app.HasMember(strings::hmi_app_id) && 0 >= json_app[strings::hmi_app_id].AsUInt()) { - LOGGER_ERROR(logger_, "Wrong resumption hmi app ID"); + SDL_ERROR("Wrong resumption hmi app ID"); return false; } @@ -471,7 +469,7 @@ bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const { void ResumptionDataJson::SetSavedApplication( utils::json::JsonValueRef apps_json) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); utils::json::JsonValueRef app_list = GetSavedApplications(); app_list = apps_json; @@ -479,30 +477,29 @@ void ResumptionDataJson::SetSavedApplication( void ResumptionDataJson::SetLastIgnOffTime(time_t ign_off_time) { using namespace app_mngr; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); - LOGGER_WARN(logger_, "ign_off_time = " << ign_off_time); + SDL_WARN("ign_off_time = " << ign_off_time); utils::json::JsonValueRef resumption = GetResumptionData(); resumption[strings::last_ign_off_time] = utils::json::JsonValue::UInt(ign_off_time); } bool ResumptionDataJson::Init() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return true; } bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id, const std::string& app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace app_mngr; sync_primitives::AutoLock autolock(resumption_lock_); utils::json::JsonValueRef application = GetFromSavedOrAppend(app_id, device_id); if (application.IsNull()) { - LOGGER_DEBUG(logger_, - "Application " << app_id << " with device_id " << device_id - << " hasn't been found in resumption data."); + SDL_DEBUG("Application " << app_id << " with device_id " << device_id + << " hasn't been found in resumption data."); return false; } application[strings::application_commands].Clear(); @@ -514,10 +511,9 @@ bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id, // Seems there is no interface for json wrapper - needs to be created // application.removeMember(strings::grammar_id); application[strings::grammar_id].Clear(); - LOGGER_DEBUG(logger_, - "Resumption data for application " - << app_id << " with device_id " << device_id - << " has been dropped."); + SDL_DEBUG("Resumption data for application " << app_id << " with device_id " + << device_id + << " has been dropped."); return true; } diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index f3c15a1a6a..182a135daa 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE. namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "StateControllerImpl") +SDL_CREATE_LOGGER("StateControllerImpl") bool IsStatusChanged(HmiStatePtr old_state, HmiStatePtr new_state) { if (old_state->hmi_level() != new_state->hmi_level() || @@ -65,10 +65,10 @@ StateControllerImpl::StateControllerImpl(ApplicationManager& app_mngr) void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, HmiStatePtr state, const bool send_activate_app) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); - LOGGER_AUTO_TRACE(logger_); + SDL_CREATE_LOGGER("StateControllerImpl"); + SDL_AUTO_TRACE(); if (!app) { - LOGGER_ERROR(logger_, "Invalid application pointer"); + SDL_ERROR("Invalid application pointer"); return; } DCHECK_OR_RETURN_VOID(state); @@ -78,7 +78,7 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, state->audio_streaming_state() == mobile_apis::AudioStreamingState::INVALID_ENUM || state->system_context() == mobile_apis::SystemContext::INVALID_ENUM) { - LOGGER_ERROR(logger_, "Get invalid state"); + SDL_ERROR("Get invalid state"); return; } @@ -106,7 +106,7 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, waiting_for_activate[app->app_id()] = resolved_state; return; } - LOGGER_ERROR(logger_, "Unable to send BC.ActivateApp"); + SDL_ERROR("Unable to send BC.ActivateApp"); return; } ApplyRegularState(app, resolved_state); @@ -117,10 +117,10 @@ void StateControllerImpl::SetRegularState( const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, const bool send_activate_app) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); - LOGGER_AUTO_TRACE(logger_); + SDL_CREATE_LOGGER("StateControllerImpl"); + SDL_AUTO_TRACE(); if (!app) { - LOGGER_ERROR(logger_, "Invalid application pointer"); + SDL_ERROR("Invalid application pointer"); return; } HmiStatePtr prev_regular = app->RegularHmiState(); @@ -140,10 +140,10 @@ void StateControllerImpl::SetRegularState( const bool send_activate_app) { using namespace mobile_apis; using namespace helpers; - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); - LOGGER_AUTO_TRACE(logger_); + SDL_CREATE_LOGGER("StateControllerImpl"); + SDL_AUTO_TRACE(); if (!app) { - LOGGER_ERROR(logger_, "Invalid application pointer"); + SDL_ERROR("Invalid application pointer"); return; } const HmiStatePtr hmi_state = @@ -162,10 +162,10 @@ void StateControllerImpl::SetRegularState( const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::SystemContext::eType system_context, const bool send_activate_app) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); - LOGGER_AUTO_TRACE(logger_); + SDL_CREATE_LOGGER("StateControllerImpl"); + SDL_AUTO_TRACE(); if (!app) { - LOGGER_ERROR(logger_, "Invalid application pointer"); + SDL_ERROR("Invalid application pointer"); return; } HmiStatePtr hmi_state = @@ -179,10 +179,10 @@ void StateControllerImpl::SetRegularState( void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); - LOGGER_AUTO_TRACE(logger_); + SDL_CREATE_LOGGER("StateControllerImpl"); + SDL_AUTO_TRACE(); if (!app) { - LOGGER_ERROR(logger_, "Invalid application pointer"); + SDL_ERROR("Invalid application pointer"); return; } HmiStatePtr prev_state = app->RegularHmiState(); @@ -200,10 +200,10 @@ void StateControllerImpl::SetRegularState( void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, const mobile_apis::SystemContext::eType system_context) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); - LOGGER_AUTO_TRACE(logger_); + SDL_CREATE_LOGGER("StateControllerImpl"); + SDL_AUTO_TRACE(); if (!app) { - LOGGER_ERROR(logger_, "Invalid application pointer"); + SDL_ERROR("Invalid application pointer"); return; } HmiStatePtr prev_regular = app->RegularHmiState(); @@ -221,10 +221,10 @@ void StateControllerImpl::SetRegularState( void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, const mobile_apis::AudioStreamingState::eType audio_state) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); - LOGGER_AUTO_TRACE(logger_); + SDL_CREATE_LOGGER("StateControllerImpl"); + SDL_AUTO_TRACE(); if (!app) { - LOGGER_ERROR(logger_, "Invalid application pointer"); + SDL_ERROR("Invalid application pointer"); return; } HmiStatePtr prev_state = app->RegularHmiState(); @@ -240,10 +240,10 @@ void StateControllerImpl::SetRegularState( void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, HmiStatePtr state) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); - LOGGER_AUTO_TRACE(logger_); + SDL_CREATE_LOGGER("StateControllerImpl"); + SDL_AUTO_TRACE(); if (!app) { - LOGGER_ERROR(logger_, "Invalid application pointer"); + SDL_ERROR("Invalid application pointer"); return; } DCHECK_OR_RETURN_VOID(state); @@ -300,19 +300,17 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()( result_hmi_level = HMILevel::HMI_BACKGROUND; if (cur_state->hmi_level() != result_hmi_level) { - LOGGER_DEBUG(logger_, - "Application " << to_resolve->app_id() - << " will change HMI level to " - << result_hmi_level); + SDL_DEBUG("Application " << to_resolve->app_id() + << " will change HMI level to " + << result_hmi_level); state_ctrl_->SetupRegularHmiState(to_resolve, result_hmi_level, result_hmi_level == HMILevel::HMI_LIMITED ? AudioStreamingState::AUDIBLE : AudioStreamingState::NOT_AUDIBLE); } else { - LOGGER_DEBUG(logger_, - "Application " << to_resolve->app_id() - << " will not change HMI level"); + SDL_DEBUG("Application " << to_resolve->app_id() + << " will not change HMI level"); } } @@ -320,12 +318,11 @@ HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app, HmiStatePtr state) const { using namespace mobile_apis; using namespace helpers; - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "State to resolve: hmi_level " - << state->hmi_level() << ", audio_state " - << state->audio_streaming_state() << ", system_context " - << state->system_context()); + SDL_AUTO_TRACE(); + SDL_DEBUG("State to resolve: hmi_level " + << state->hmi_level() << ", audio_state " + << state->audio_streaming_state() << ", system_context " + << state->system_context()); HmiStatePtr available_state = CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); @@ -347,29 +344,27 @@ HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app, bool StateControllerImpl::IsResumptionAllowed(ApplicationSharedPtr app, HmiStatePtr state) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace helpers; using namespace mobile_apis; if (!app->is_resuming() || !Compare<HMILevel::eType, EQ, ONE>( state->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) { - LOGGER_DEBUG(logger_, "Application is not in resuming mode."); + SDL_DEBUG("Application is not in resuming mode."); return true; } if (IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE) && app->is_media_application()) { - LOGGER_DEBUG(logger_, - "Resumption for media app is not allowed. " - << "AUDIO_SOURCE event is active"); + SDL_DEBUG("Resumption for media app is not allowed. " + << "AUDIO_SOURCE event is active"); return false; } if (IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI) && app->is_navi()) { - LOGGER_DEBUG(logger_, - "Resumption for navi app is not allowed. " - << "EMBEDDED_NAVI event is active"); + SDL_DEBUG("Resumption for navi app is not allowed. " + << "EMBEDDED_NAVI event is active"); return false; } @@ -380,7 +375,7 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel( ApplicationSharedPtr app, mobile_apis::HMILevel::eType hmi_level) const { using namespace mobile_apis; using namespace helpers; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); mobile_apis::HMILevel::eType result = hmi_level; if (!Compare<HMILevel::eType, EQ, ONE>( @@ -406,15 +401,15 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel( result = mobile_apis::HMILevel::HMI_LIMITED; } else if (app->is_navi() && IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE)) { - LOGGER_DEBUG(logger_, - "Navigation app will be resumed to LIMITED, " - "because of AUDIO_SOURCE ia active."); + SDL_DEBUG( + "Navigation app will be resumed to LIMITED, " + "because of AUDIO_SOURCE ia active."); result = mobile_apis::HMILevel::HMI_LIMITED; } else if (app->is_media_application() && IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI)) { - LOGGER_DEBUG(logger_, - "Media app will be resumed to LIMITED, " - "because of EMBEDDED_NAVI is active."); + SDL_DEBUG( + "Media app will be resumed to LIMITED, " + "because of EMBEDDED_NAVI is active."); result = mobile_apis::HMILevel::HMI_LIMITED; } } else if (is_active_app_exist) { @@ -428,12 +423,11 @@ bool StateControllerImpl::IsStateAvailable(ApplicationSharedPtr app, HmiStatePtr state) const { using namespace mobile_apis; using namespace helpers; - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "Checking state: hmi_level " - << state->hmi_level() << ", audio_state " - << state->audio_streaming_state() << ", system_context " - << state->system_context()); + SDL_AUTO_TRACE(); + SDL_DEBUG("Checking state: hmi_level " + << state->hmi_level() << ", audio_state " + << state->audio_streaming_state() << ", system_context " + << state->system_context()); if (app->is_resuming()) { return IsStateAvailableForResumption(app, state); @@ -442,54 +436,49 @@ bool StateControllerImpl::IsStateAvailable(ApplicationSharedPtr app, if (IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE) || IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI)) { if (HMILevel::HMI_FULL == state->hmi_level()) { - LOGGER_DEBUG(logger_, - "AUDIO_SOURCE or EMBEDDED_NAVI is active." - << " Requested state is not available"); + SDL_DEBUG("AUDIO_SOURCE or EMBEDDED_NAVI is active." + << " Requested state is not available"); return false; } } - LOGGER_DEBUG(logger_, "Requested state is available"); + SDL_DEBUG("Requested state is available"); return true; } bool StateControllerImpl::IsStateAvailableForResumption( ApplicationSharedPtr app, HmiStatePtr state) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace mobile_apis; using namespace helpers; if (!app->is_resuming() || !Compare<HMILevel::eType, EQ, ONE>( state->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) { - LOGGER_DEBUG(logger_, - "Application is not in resuming mode." - << " Requested state is available"); + SDL_DEBUG("Application is not in resuming mode." + << " Requested state is available"); return true; } if (IsTempStateActive(HmiState::StateID::STATE_ID_VR_SESSION) || IsTempStateActive(HmiState::StateID::STATE_ID_SAFETY_MODE)) { - LOGGER_DEBUG(logger_, - "Requested state is not available. " - << "VR session or emergency event is active"); + SDL_DEBUG("Requested state is not available. " + << "VR session or emergency event is active"); return false; } if (IsTempStateActive(HmiState::StateID::STATE_ID_PHONE_CALL) && app->is_media_application()) { - LOGGER_DEBUG(logger_, - "Requested state for media application " - << "is not available. Phone call is active"); + SDL_DEBUG("Requested state for media application " + << "is not available. Phone call is active"); return false; } if (IsTempStateActive(HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) { - LOGGER_DEBUG(logger_, - "Requested state is not available. " - << "Deactivate HMI event is active"); + SDL_DEBUG("Requested state is not available. " + << "Deactivate HMI event is active"); return false; } - LOGGER_DEBUG(logger_, "Requested state is available"); + SDL_DEBUG("Requested state is available"); return true; } @@ -497,12 +486,11 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app, HmiStatePtr state) { namespace HMILevel = mobile_apis::HMILevel; namespace AudioStreamingState = mobile_apis::AudioStreamingState; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); - LOGGER_DEBUG(logger_, - "hmi_level " << state->hmi_level() << ", audio_state " - << state->audio_streaming_state() - << ", system_context " << state->system_context()); + SDL_DEBUG("hmi_level " << state->hmi_level() << ", audio_state " + << state->audio_streaming_state() + << ", system_context " << state->system_context()); HmiStatePtr curr_state = app->CurrentHmiState(); HmiStatePtr old_state = CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); @@ -513,9 +501,8 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app, app->SetRegularState(state); if (HMILevel::HMI_LIMITED == state->hmi_level() && app->is_resuming()) { - LOGGER_DEBUG(logger_, - "Resuming to LIMITED level. " - << "Send OnResumeAudioSource notification"); + SDL_DEBUG("Resuming to LIMITED level. " + << "Send OnResumeAudioSource notification"); MessageHelper::SendOnResumeAudioSourceToHMI(app->app_id(), app_mngr_); } app->set_is_resuming(false); @@ -531,7 +518,7 @@ void StateControllerImpl::SetupRegularHmiState( namespace HMILevel = mobile_apis::HMILevel; namespace AudioStreamingState = mobile_apis::AudioStreamingState; using helpers::Compare; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_state = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_state); @@ -546,7 +533,7 @@ void StateControllerImpl::SetupRegularHmiState( void StateControllerImpl::ApplyRegularState(ApplicationSharedPtr app, HmiStatePtr state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR); @@ -573,7 +560,7 @@ void StateControllerImpl::on_event(const event_engine::Event& event) { using namespace hmi_apis; namespace FunctionID = hmi_apis::FunctionID; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const SmartObject& message = event.smart_object(); const FunctionID::eType id = static_cast<FunctionID::eType>(event.id()); switch (id) { @@ -666,20 +653,18 @@ void StateControllerImpl::on_event(const event_engine::Event& event) { void StateControllerImpl::OnStateChanged(ApplicationSharedPtr app, HmiStatePtr old_state, HmiStatePtr new_state) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(old_state); DCHECK_OR_RETURN_VOID(new_state); - LOGGER_DEBUG(logger_, - "old: hmi_level " << old_state->hmi_level() << ", audio_state " - << old_state->audio_streaming_state() - << ", system_context " - << old_state->system_context()); - LOGGER_DEBUG(logger_, - "new: hmi_level " << new_state->hmi_level() << ", audio_state " - << new_state->audio_streaming_state() - << ", system_context " - << new_state->system_context()); + SDL_DEBUG("old: hmi_level " << old_state->hmi_level() << ", audio_state " + << old_state->audio_streaming_state() + << ", system_context " + << old_state->system_context()); + SDL_DEBUG("new: hmi_level " << new_state->hmi_level() << ", audio_state " + << new_state->audio_streaming_state() + << ", system_context " + << new_state->system_context()); if (IsStatusChanged(old_state, new_state)) { app_mngr_.SendHMIStatusNotification(app); if (new_state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) { @@ -689,7 +674,7 @@ void StateControllerImpl::OnStateChanged(ApplicationSharedPtr app, app->app_id(), old_state->hmi_level(), new_state->hmi_level()); app->usage_report().RecordHmiStateChanged(new_state->hmi_level()); } else { - LOGGER_ERROR(logger_, "Status not changed"); + SDL_ERROR("Status not changed"); } } @@ -706,7 +691,7 @@ void StateControllerImpl::OnApplicationRegistered( namespace HMILevel = mobile_apis::HMILevel; namespace AudioStreamingState = mobile_apis::AudioStreamingState; namespace SystemContext = mobile_apis::SystemContext; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); active_states_lock_.Acquire(); @@ -741,7 +726,7 @@ int64_t StateControllerImpl::SendBCActivateApp( ApplicationConstSharedPtr app, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); smart_objects::SmartObjectSPtr bc_activate_app_request = MessageHelper::GetBCActivateAppRequestToHMI( app, @@ -751,11 +736,11 @@ int64_t StateControllerImpl::SendBCActivateApp( send_policy_priority, app_mngr_); if (!bc_activate_app_request) { - LOGGER_ERROR(logger_, "Unable to create BC.ActivateAppRequest"); + SDL_ERROR("Unable to create BC.ActivateAppRequest"); return -1; } if (!app_mngr_.ManageHMICommand(bc_activate_app_request)) { - LOGGER_ERROR(logger_, "Unable to send BC.ActivateAppRequest"); + SDL_ERROR("Unable to send BC.ActivateAppRequest"); return -1; } const int64_t corr_id = @@ -765,7 +750,7 @@ int64_t StateControllerImpl::SendBCActivateApp( } void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HmiStatePtr state = app->PostponedHmiState(); if (state) { app->RemovePostponedState(); @@ -775,19 +760,19 @@ void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) { } void StateControllerImpl::TempStateStarted(HmiState::StateID ID) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock autolock(active_states_lock_); StateIDList::iterator it = std::find(active_states_.begin(), active_states_.end(), ID); if (it == active_states_.end()) { active_states_.push_back(ID); } else { - LOGGER_ERROR(logger_, "StateID " << ID << " is already active"); + SDL_ERROR("StateID " << ID << " is already active"); } } void StateControllerImpl::TempStateStopped(HmiState::StateID ID) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); { sync_primitives::AutoLock autolock(active_states_lock_); active_states_.remove(ID); @@ -798,7 +783,7 @@ void StateControllerImpl::TempStateStopped(HmiState::StateID ID) { void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) { using namespace mobile_apis; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); HmiStatePtr regular = app->RegularHmiState(); @@ -836,12 +821,12 @@ void StateControllerImpl::OnActivateAppResponse( void StateControllerImpl::OnAppActivated( const smart_objects::SmartObject& message) { using namespace mobile_apis; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t app_id = message[strings::msg_params][strings::app_id].asUInt(); ApplicationSharedPtr app = app_mngr_.application(app_id); if (!app) { - LOGGER_ERROR(logger_, "Application with id " << app_id << " not found"); + SDL_ERROR("Application with id " << app_id << " not found"); return; } @@ -853,13 +838,13 @@ void StateControllerImpl::OnAppDeactivated( using namespace hmi_apis; using namespace mobile_apis; using namespace helpers; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t app_id = message[strings::msg_params][strings::app_id].asUInt(); ApplicationSharedPtr app = app_mngr_.application(app_id); if (!app) { - LOGGER_ERROR(logger_, "Application with id " << app_id << " not found"); + SDL_ERROR("Application with id " << app_id << " not found"); return; } @@ -881,7 +866,7 @@ void StateControllerImpl::OnNaviStreamingStopped() { } bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); switch (state_id) { case HmiState::STATE_ID_CURRENT: case HmiState::STATE_ID_REGULAR: @@ -895,7 +880,7 @@ bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const { HmiStatePtr StateControllerImpl::CreateHmiState( uint32_t app_id, HmiState::StateID state_id) const { using namespace utils; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HmiStatePtr new_state; switch (state_id) { case HmiState::STATE_ID_PHONE_CALL: { @@ -939,7 +924,7 @@ HmiStatePtr StateControllerImpl::CreateHmiState( break; } default: - LOGGER_FATAL(logger_, "Invalid state_id " << state_id); + SDL_FATAL("Invalid state_id " << state_id); NOTREACHED(); break; } diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index e662edd068..7881275530 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -48,19 +48,16 @@ #endif // ENABLE_SECURITY namespace { -#define LOG_UPDATED_VALUE(value, key, section) \ - { \ - LOGGER_INFO(logger_, \ - "Setting value '" << value << "' for key '" << key \ - << "' in section '" << section << "'."); \ +#define LOG_UPDATED_VALUE(value, key, section) \ + { \ + SDL_INFO("Setting value '" << value << "' for key '" << key \ + << "' in section '" << section << "'."); \ } -#define LOG_UPDATED_BOOL_VALUE(value, key, section) \ - { \ - LOGGER_INFO(logger_, \ - "Setting value '" << std::boolalpha << value << "' for key '" \ - << key << "' in section '" << section \ - << "'."); \ +#define LOG_UPDATED_BOOL_VALUE(value, key, section) \ + { \ + SDL_INFO("Setting value '" << std::boolalpha << value << "' for key '" \ + << key << "' in section '" << section << "'."); \ } const char* kDefaultConfigFileName = "smartDeviceLink.ini"; @@ -284,7 +281,7 @@ const uint16_t kDefaultOpenAttemptTimeoutMsResumptionDB = 500; namespace profile { -CREATE_LOGGERPTR_GLOBAL(logger_, "Profile") +SDL_CREATE_LOGGER("Profile") Profile::Profile() : sdl_version_(kDefaultSDLVersion) @@ -825,7 +822,7 @@ uint16_t Profile::open_attempt_timeout_ms_resumption_db() const { } void Profile::UpdateValues() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // SDL version ReadStringValue( diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc index 5fd302654a..ae4734b760 100644 --- a/src/components/connection_handler/src/connection.cc +++ b/src/components/connection_handler/src/connection.cc @@ -51,7 +51,7 @@ */ namespace connection_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler") +SDL_CREATE_LOGGER("ConnectionHandler") Service* Session::FindService( const protocol_handler::ServiceType& service_type) { @@ -82,7 +82,7 @@ Connection::Connection(ConnectionHandle connection_handle, , connection_device_handle_(connection_device_handle) , session_map_lock_(true) , heartbeat_timeout_(heartbeat_timeout) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(connection_handler_); heartbeat_monitor_ = new HeartBeatMonitor(heartbeat_timeout_, this); @@ -92,7 +92,7 @@ Connection::Connection(ConnectionHandle connection_handle, } Connection::~Connection() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); heart_beat_monitor_thread_->join(); delete heartbeat_monitor_; threads::DeleteThread(heart_beat_monitor_thread_); @@ -115,7 +115,7 @@ uint32_t findGap(const std::map<unsigned char, T>& map) { } // namespace uint32_t Connection::AddNewSession() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(session_map_lock_); const uint32_t session_id = findGap(session_map_); if (session_id > 0) { @@ -131,7 +131,7 @@ uint32_t Connection::RemoveSession(uint8_t session_id) { sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator it = session_map_.find(session_id); if (session_map_.end() == it) { - LOGGER_WARN(logger_, "Session not found in this connection!"); + SDL_WARN("Session not found in this connection!"); return 0; } heartbeat_monitor_->RemoveSession(session_id); @@ -145,14 +145,14 @@ bool Connection::AddNewService(uint8_t session_id, // Ignore wrong services if (protocol_handler::kControl == service_type || protocol_handler::kInvalidServiceType == service_type) { - LOGGER_WARN(logger_, "Wrong service " << static_cast<int>(service_type)); + SDL_WARN("Wrong service " << static_cast<int>(service_type)); return false; } sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_it == session_map_.end()) { - LOGGER_WARN(logger_, "Session not found in this connection!"); + SDL_WARN("Session not found in this connection!"); return false; } Session& session = session_it->second; @@ -161,17 +161,15 @@ bool Connection::AddNewService(uint8_t session_id, if (service) { #ifdef ENABLE_SECURITY if (!request_protection) { - LOGGER_WARN(logger_, - "Session " << static_cast<int>(session_id) - << " already has unprotected service " - << static_cast<int>(service_type)); + SDL_WARN("Session " << static_cast<int>(session_id) + << " already has unprotected service " + << static_cast<int>(service_type)); return false; } if (service->is_protected_) { - LOGGER_WARN(logger_, - "Session " << static_cast<int>(session_id) - << " already has protected service " - << static_cast<int>(service_type)); + SDL_WARN("Session " << static_cast<int>(session_id) + << " already has protected service " + << static_cast<int>(service_type)); return false; } // For unproteced service could be start protection @@ -202,15 +200,14 @@ bool Connection::RemoveService(uint8_t session_id, protocol_handler::ServiceType service_type) { // Ignore wrong and required for Session services if (is_incorrect_for_remove_service(service_type)) { - LOGGER_WARN(logger_, - "Could not remove service " << static_cast<int>(service_type)); + SDL_WARN("Could not remove service " << static_cast<int>(service_type)); return false; } sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_map_.end() == session_it) { - LOGGER_WARN(logger_, "Session not found in this connection!"); + SDL_WARN("Session not found in this connection!"); return false; } @@ -218,9 +215,8 @@ bool Connection::RemoveService(uint8_t session_id, ServiceList::iterator service_it = find(service_list.begin(), service_list.end(), service_type); if (service_list.end() == service_it) { - LOGGER_WARN(logger_, - "Session " << session_id << " didn't established" - " service " << service_type); + SDL_WARN("Session " << session_id << " didn't established" + " service " << service_type); return false; } service_list.erase(service_it); @@ -233,7 +229,7 @@ int Connection::SetSSLContext(uint8_t session_id, sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_it == session_map_.end()) { - LOGGER_WARN(logger_, "Session not found in this connection!"); + SDL_WARN("Session not found in this connection!"); return security_manager::SecurityManager::ERROR_INTERNAL; } Session& session = session_it->second; @@ -244,11 +240,11 @@ int Connection::SetSSLContext(uint8_t session_id, security_manager::SSLContext* Connection::GetSSLContext( const uint8_t session_id, const protocol_handler::ServiceType& service_type) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(session_map_lock_); SessionMap::const_iterator session_it = session_map_.find(session_id); if (session_it == session_map_.end()) { - LOGGER_WARN(logger_, "Session not found in this connection!"); + SDL_WARN("Session not found in this connection!"); return NULL; } const Session& session = session_it->second; @@ -257,29 +253,29 @@ security_manager::SSLContext* Connection::GetSSLContext( return session.ssl_context; const Service* service = session.FindService(service_type); if (!service) { - LOGGER_WARN(logger_, "Service not found in this session!"); + SDL_WARN("Service not found in this session!"); return NULL; } if (!service->is_protected_) return NULL; - LOGGER_TRACE(logger_, "SSLContext is " << session.ssl_context); + SDL_TRACE("SSLContext is " << session.ssl_context); return session.ssl_context; } void Connection::SetProtectionFlag( const uint8_t session_id, const protocol_handler::ServiceType& service_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_it == session_map_.end()) { - LOGGER_WARN(logger_, "Session not found in this connection!"); + SDL_WARN("Session not found in this connection!"); return; } Session& session = session_it->second; Service* service = session.FindService(service_type); if (!service) { - LOGGER_WARN(logger_, "Service not found in this session!"); + SDL_WARN("Service not found in this session!"); return; } service->is_protected_ = true; @@ -335,7 +331,7 @@ void Connection::UpdateProtocolVersionSession(uint8_t session_id, sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_map_.end() == session_it) { - LOGGER_WARN(logger_, "Session not found in this connection!"); + SDL_WARN("Session not found in this connection!"); return; } Session& session = session_it->second; @@ -343,11 +339,11 @@ void Connection::UpdateProtocolVersionSession(uint8_t session_id, } bool Connection::SupportHeartBeat(uint8_t session_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_map_.end() == session_it) { - LOGGER_WARN(logger_, "Session not found in this connection!"); + SDL_WARN("Session not found in this connection!"); return false; } Session& session = session_it->second; @@ -359,11 +355,11 @@ bool Connection::SupportHeartBeat(uint8_t session_id) { bool Connection::ProtocolVersion(uint8_t session_id, uint8_t& protocol_version) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_map_.end() == session_it) { - LOGGER_WARN(logger_, "Session not found in this connection!"); + SDL_WARN("Session not found in this connection!"); return false; } protocol_version = (session_it->second).protocol_version; diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index a38494612f..f362bd2b5a 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -53,7 +53,7 @@ */ namespace connection_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler") +SDL_CREATE_LOGGER("ConnectionHandler") ConnectionHandle HandleFromConnectionUID(transport_manager::ConnectionUID uid) { return ConnectionHandle(uid); @@ -76,11 +76,11 @@ ConnectionHandlerImpl::ConnectionHandlerImpl( , connection_list_deleter_(&connection_list_) {} ConnectionHandlerImpl::~ConnectionHandlerImpl() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } void ConnectionHandlerImpl::Stop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ConnectionList::iterator itr = connection_list_.begin(); while (itr != connection_list_.end()) { RemoveConnection(itr->second->connection_handle()); @@ -90,30 +90,28 @@ void ConnectionHandlerImpl::Stop() { void ConnectionHandlerImpl::set_connection_handler_observer( ConnectionHandlerObserver* observer) { - LOGGER_DEBUG(logger_, - "ConnectionHandlerImpl::set_connection_handler_observer() " - << observer); + SDL_DEBUG("ConnectionHandlerImpl::set_connection_handler_observer() " + << observer); sync_primitives::AutoWriteLock write_lock(connection_handler_observer_lock_); if (!observer) { - LOGGER_WARN(logger_, "Set Null pointer to observer."); + SDL_WARN("Set Null pointer to observer."); } connection_handler_observer_ = observer; } void ConnectionHandlerImpl::set_protocol_handler( protocol_handler::ProtocolHandler* protocol_handler) { - LOGGER_DEBUG(logger_, - "ConnectionHandlerImpl::set_protocol_handler()" - << protocol_handler); + SDL_DEBUG("ConnectionHandlerImpl::set_protocol_handler()" + << protocol_handler); if (!protocol_handler) { - LOGGER_WARN(logger_, "Set Null pointer to protocol handler."); + SDL_WARN("Set Null pointer to protocol handler."); } protocol_handler_ = protocol_handler; } void ConnectionHandlerImpl::OnDeviceListUpdated( const std::vector<transport_manager::DeviceInfo>&) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_) { connection_handler_observer_->OnDeviceListUpdated(device_list_); @@ -129,12 +127,12 @@ void ConnectionHandlerImpl::OnFindNewApplicationsRequest() { void ConnectionHandlerImpl::OnDeviceFound( const transport_manager::DeviceInfo&) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } void ConnectionHandlerImpl::OnDeviceAdded( const transport_manager::DeviceInfo& device_info) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); device_list_.insert( DeviceMap::value_type(device_info.device_handle(), Device(device_info.device_handle(), @@ -149,7 +147,7 @@ void ConnectionHandlerImpl::OnDeviceAdded( void ConnectionHandlerImpl::OnDeviceRemoved( const transport_manager::DeviceInfo& device_info) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // Device has been removed. Perform all needed actions. // 1. Delete all the connections and sessions of this device // 2. Delete device from a list @@ -181,25 +179,25 @@ void ConnectionHandlerImpl::OnDeviceRemoved( } void ConnectionHandlerImpl::OnScanDevicesFinished() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } void ConnectionHandlerImpl::OnScanDevicesFailed( const transport_manager::SearchDeviceError& error) { - LOGGER_WARN(logger_, "Scan devices failed. " << error.text()); + SDL_WARN("Scan devices failed. " << error.text()); } void ConnectionHandlerImpl::OnConnectionEstablished( const transport_manager::DeviceInfo& device_info, const transport_manager::ConnectionUID connection_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DeviceMap::iterator it = device_list_.find(device_info.device_handle()); if (device_list_.end() == it) { - LOGGER_ERROR(logger_, "Unknown device!"); + SDL_ERROR("Unknown device!"); return; } - LOGGER_DEBUG(logger_, "Add Connection #" << connection_id << " to the list."); + SDL_DEBUG("Add Connection #" << connection_id << " to the list."); sync_primitives::AutoWriteLock lock(connection_list_lock_); connection_list_.insert(ConnectionList::value_type( connection_id, @@ -213,12 +211,12 @@ void ConnectionHandlerImpl::OnConnectionFailed( const transport_manager::DeviceInfo& device_info, const transport_manager::ConnectError& error) { // TODO(PV): implement - LOGGER_ERROR(logger_, "Failed connecting."); + SDL_ERROR("Failed connecting."); } void ConnectionHandlerImpl::OnConnectionClosed( transport_manager::ConnectionUID connection_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); OnConnectionEnded(connection_id); } @@ -227,13 +225,13 @@ void ConnectionHandlerImpl::OnConnectionClosedFailure( transport_manager::ConnectionUID connection_id, const transport_manager::DisconnectError& error) { // TODO(PV): implement - LOGGER_ERROR(logger_, "ConnectionHandlerImpl::OnConnectionClosedFailure"); + SDL_ERROR("ConnectionHandlerImpl::OnConnectionClosedFailure"); } void ConnectionHandlerImpl::OnUnexpectedDisconnect( transport_manager::ConnectionUID connection_id, const transport_manager::CommunicationError& error) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); OnConnectionEnded(connection_id); } @@ -242,19 +240,19 @@ void ConnectionHandlerImpl::OnDeviceConnectionLost( const transport_manager::DeviceHandle& device, const transport_manager::DisconnectDeviceError& error) { // TODO(PV): implement - LOGGER_ERROR(logger_, "Lost connection with device " << device); + SDL_ERROR("Lost connection with device " << device); } void ConnectionHandlerImpl::OnDisconnectFailed( const transport_manager::DeviceHandle& device, const transport_manager::DisconnectDeviceError& error) { // TODO(PV): implement - LOGGER_ERROR(logger_, "Trying to Disconnect device failed."); + SDL_ERROR("Trying to Disconnect device failed."); } void ConnectionHandlerImpl::RemoveConnection( const ConnectionHandle connection_handle) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); OnConnectionEnded(connection_handle); } @@ -270,13 +268,11 @@ bool AllowProtection(const ConnectionHandlerSettings& settings, if (std::find(force_unprotected_list.begin(), force_unprotected_list.end(), service_type) != force_unprotected_list.end()) { - LOGGER_ERROR(logger_, - "Service " << static_cast<int>(service_type) - << " shall be protected"); + SDL_ERROR("Service " << static_cast<int>(service_type) + << " shall be protected"); return false; } - LOGGER_DEBUG(logger_, - "Service " << static_cast<int>(service_type) << " allowed"); + SDL_DEBUG("Service " << static_cast<int>(service_type) << " allowed"); return true; } #endif // ENABLE_SECURITY @@ -287,7 +283,7 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( const protocol_handler::ServiceType& service_type, const bool is_protected, uint32_t* hash_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (hash_id) { *hash_id = protocol_handler::HASH_ID_WRONG; @@ -300,7 +296,7 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( sync_primitives::AutoReadLock lock(connection_list_lock_); ConnectionList::iterator it = connection_list_.find(connection_handle); if (connection_list_.end() == it) { - LOGGER_ERROR(logger_, "Unknown connection!"); + SDL_ERROR("Unknown connection!"); return 0; } uint32_t new_session_id = 0; @@ -309,7 +305,7 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( if ((0 == session_id) && (protocol_handler::kRpc == service_type)) { new_session_id = connection->AddNewSession(); if (0 == new_session_id) { - LOGGER_ERROR(logger_, "Couldn't start new session!"); + SDL_ERROR("Couldn't start new session!"); return 0; } if (hash_id) { @@ -318,16 +314,14 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( } else { // Could be create new service or protected exists one if (!connection->AddNewService(session_id, service_type, is_protected)) { #ifdef ENABLE_SECURITY - LOGGER_ERROR(logger_, - "Couldn't establish " - << (is_protected ? "protected" : "non-protected") - << " service " << static_cast<int>(service_type) - << " for session " << static_cast<int>(session_id)); + SDL_ERROR("Couldn't establish " + << (is_protected ? "protected" : "non-protected") << " service " + << static_cast<int>(service_type) << " for session " + << static_cast<int>(session_id)); #else - LOGGER_ERROR(logger_, - "Couldn't establish " - << " service " << static_cast<int>(service_type) - << " for session " << static_cast<int>(session_id)); + SDL_ERROR("Couldn't establish " + << " service " << static_cast<int>(service_type) + << " for session " << static_cast<int>(session_id)); #endif // ENABLE_SECURITY return 0; @@ -343,8 +337,7 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( const bool success = connection_handler_observer_->OnServiceStartedCallback( connection->connection_device_handle(), session_key, service_type); if (!success) { - LOGGER_WARN(logger_, - "Service starting forbidden by connection_handler_observer"); + SDL_WARN("Service starting forbidden by connection_handler_observer"); if (protocol_handler::kRpc == service_type) { connection->RemoveSession(new_session_id); } else { @@ -358,13 +351,13 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( void ConnectionHandlerImpl::OnApplicationFloodCallBack( const uint32_t& connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); - LOGGER_INFO(logger_, "Disconnect flooding application"); + SDL_INFO("Disconnect flooding application"); if (session_id != 0) { CloseSession(connection_handle, session_id, kFlood); } else { @@ -375,13 +368,13 @@ void ConnectionHandlerImpl::OnApplicationFloodCallBack( void ConnectionHandlerImpl::OnMalformedMessageCallback( const uint32_t& connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); - LOGGER_INFO(logger_, "Disconnect malformed messaging application"); + SDL_INFO("Disconnect malformed messaging application"); CloseConnectionSessions(connection_handle, kMalformed); CloseConnection(connection_handle); } @@ -391,12 +384,12 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( const uint8_t session_id, const uint32_t& hashCode, const protocol_handler::ServiceType& service_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); connection_list_lock_.AcquireForReading(); ConnectionList::iterator it = connection_list_.find(connection_handle); if (connection_list_.end() == it) { - LOGGER_WARN(logger_, "Unknown connection!"); + SDL_WARN("Unknown connection!"); return 0; } std::pair<int32_t, Connection*> connection_item = *it; @@ -406,33 +399,27 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( const uint32_t session_key = KeyFromPair(connection_handle, session_id); if (protocol_handler::kRpc == service_type) { - LOGGER_INFO(logger_, - "Session " << static_cast<uint32_t>(session_id) - << " to be removed"); + SDL_INFO("Session " << static_cast<uint32_t>(session_id) + << " to be removed"); // old version of protocol doesn't support hash if (protocol_handler::HASH_ID_NOT_SUPPORTED != hashCode) { if (protocol_handler::HASH_ID_WRONG == hashCode || session_key != hashCode) { - LOGGER_WARN(logger_, - "Wrong hash_id for session " - << static_cast<uint32_t>(session_id)); + SDL_WARN("Wrong hash_id for session " + << static_cast<uint32_t>(session_id)); return 0; } } if (!connection->RemoveSession(session_id)) { - LOGGER_WARN(logger_, - "Couldn't remove session " - << static_cast<uint32_t>(session_id)); + SDL_WARN("Couldn't remove session " << static_cast<uint32_t>(session_id)); return 0; } } else { - LOGGER_INFO(logger_, - "Service " << static_cast<uint32_t>(service_type) - << " to be removed"); + SDL_INFO("Service " << static_cast<uint32_t>(service_type) + << " to be removed"); if (!connection->RemoveService(session_id, service_type)) { - LOGGER_WARN(logger_, - "Couldn't remove service " - << static_cast<uint32_t>(service_type)); + SDL_WARN("Couldn't remove service " + << static_cast<uint32_t>(service_type)); return 0; } } @@ -449,15 +436,14 @@ uint32_t ConnectionHandlerImpl::KeyFromPair( transport_manager::ConnectionUID connection_handle, uint8_t session_id) const { const uint32_t key = connection_handle | (session_id << 16); - LOGGER_DEBUG(logger_, - "Key for ConnectionHandle:" - << static_cast<uint32_t>(connection_handle) - << " Session:" << static_cast<uint32_t>(session_id) - << " is: " << static_cast<uint32_t>(key)); + SDL_DEBUG("Key for ConnectionHandle:" + << static_cast<uint32_t>(connection_handle) + << " Session:" << static_cast<uint32_t>(session_id) + << " is: " << static_cast<uint32_t>(key)); if (protocol_handler::HASH_ID_WRONG == key) { - LOGGER_ERROR(logger_, - "Connection key is WRONG_HASH_ID " - "(session id shall be greater 0)"); + SDL_ERROR( + "Connection key is WRONG_HASH_ID " + "(session id shall be greater 0)"); } return key; } @@ -468,11 +454,10 @@ void ConnectionHandlerImpl::PairFromKey( uint8_t* session_id) const { *connection_handle = key & 0xFF00FFFF; *session_id = key >> 16; - LOGGER_DEBUG( - logger_, - "ConnectionHandle:" << static_cast<int32_t>(*connection_handle) - << " Session:" << static_cast<int32_t>(*session_id) - << " for key:" << static_cast<int32_t>(key)); + SDL_DEBUG("ConnectionHandle:" << static_cast<int32_t>(*connection_handle) + << " Session:" + << static_cast<int32_t>(*session_id) + << " for key:" << static_cast<int32_t>(key)); } int32_t ConnectionHandlerImpl::GetDataOnSessionKey( @@ -480,7 +465,7 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey( uint32_t* app_id, std::list<int32_t>* sessions_list, uint32_t* device_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const int32_t error_result = -1; transport_manager::ConnectionUID conn_handle = 0; @@ -489,16 +474,15 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey( ConnectionList::const_iterator it = connection_list_.find(conn_handle); if (connection_list_.end() == it) { - LOGGER_ERROR(logger_, "Connection not found for key: " << key); + SDL_ERROR("Connection not found for key: " << key); return error_result; } const Connection& connection = *it->second; const SessionMap session_map = connection.session_map(); if (0 == session_id || session_map.end() == session_map.find(session_id)) { - LOGGER_ERROR(logger_, - "Session not found in connection: " - << static_cast<int32_t>(conn_handle)); + SDL_ERROR("Session not found in connection: " + << static_cast<int32_t>(conn_handle)); return error_result; } @@ -517,9 +501,8 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey( } } - LOGGER_INFO(logger_, - "Connection " << static_cast<int32_t>(conn_handle) << " has " - << session_map.size() << " sessions."); + SDL_INFO("Connection " << static_cast<int32_t>(conn_handle) << " has " + << session_map.size() << " sessions."); return 0; } @@ -565,12 +548,12 @@ int32_t ConnectionHandlerImpl::GetDataOnDeviceID( std::list<uint32_t>* applications_list, std::string* mac_address, std::string* connection_type) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); int32_t result = -1; DeviceMap::const_iterator it = device_list_.find(device_handle); if (device_list_.end() == it) { - LOGGER_ERROR(logger_, "Device not found!"); + SDL_ERROR("Device not found!"); return result; } @@ -624,7 +607,7 @@ void ConnectionHandlerImpl::GetConnectedDevicesMAC( #ifdef ENABLE_SECURITY int ConnectionHandlerImpl::SetSSLContext( const uint32_t& key, security_manager::SSLContext* context) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; PairFromKey(key, &connection_handle, &session_id); @@ -632,7 +615,7 @@ int ConnectionHandlerImpl::SetSSLContext( sync_primitives::AutoReadLock lock(connection_list_lock_); ConnectionList::iterator it = connection_list_.find(connection_handle); if (connection_list_.end() == it) { - LOGGER_ERROR(logger_, "Unknown connection!"); + SDL_ERROR("Unknown connection!"); return security_manager::SecurityManager::ERROR_INTERNAL; } Connection& connection = *it->second; @@ -641,7 +624,7 @@ int ConnectionHandlerImpl::SetSSLContext( security_manager::SSLContext* ConnectionHandlerImpl::GetSSLContext( const uint32_t& key, const protocol_handler::ServiceType& service_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; PairFromKey(key, &connection_handle, &session_id); @@ -649,7 +632,7 @@ security_manager::SSLContext* ConnectionHandlerImpl::GetSSLContext( sync_primitives::AutoReadLock lock(connection_list_lock_); ConnectionList::iterator it = connection_list_.find(connection_handle); if (connection_list_.end() == it) { - LOGGER_ERROR(logger_, "Unknown connection!"); + SDL_ERROR("Unknown connection!"); return NULL; } Connection& connection = *it->second; @@ -658,7 +641,7 @@ security_manager::SSLContext* ConnectionHandlerImpl::GetSSLContext( void ConnectionHandlerImpl::SetProtectionFlag( const uint32_t& key, const protocol_handler::ServiceType& service_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; PairFromKey(key, &connection_handle, &session_id); @@ -666,7 +649,7 @@ void ConnectionHandlerImpl::SetProtectionFlag( sync_primitives::AutoReadLock lock(connection_list_lock_); ConnectionList::iterator it = connection_list_.find(connection_handle); if (connection_list_.end() == it) { - LOGGER_ERROR(logger_, "Unknown connection!"); + SDL_ERROR("Unknown connection!"); return; } Connection& connection = *it->second; @@ -680,7 +663,7 @@ ConnectionHandlerImpl::GetHandshakeContext(uint32_t key) const { #endif // ENABLE_SECURITY void ConnectionHandlerImpl::StartDevicesDiscovery() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); transport_manager_.SearchDevices(); sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); @@ -694,14 +677,12 @@ void ConnectionHandlerImpl::ConnectToDevice( connection_handler::DeviceMap::const_iterator it_in; it_in = device_list_.find(device_handle); if (device_list_.end() != it_in) { - LOGGER_INFO(logger_, "Connecting to device with handle " << device_handle); + SDL_INFO("Connecting to device with handle " << device_handle); if (transport_manager::E_SUCCESS != transport_manager_.ConnectDevice(device_handle)) { - LOGGER_WARN(logger_, "Can't connect to device"); + SDL_WARN("Can't connect to device"); } else { - LOGGER_ERROR( - logger_, - "Application Manager wanted to connect to non-existing device"); + SDL_ERROR("Application Manager wanted to connect to non-existing device"); } } } @@ -715,12 +696,12 @@ void ConnectionHandlerImpl::ConnectToAllDevices() { } void ConnectionHandlerImpl::StartTransportManager() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); transport_manager_.Visibility(true); } void ConnectionHandlerImpl::CloseRevokedConnection(uint32_t connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t connection_handle = 0; uint8_t session_id = 0; @@ -731,7 +712,7 @@ void ConnectionHandlerImpl::CloseRevokedConnection(uint32_t connection_key) { void ConnectionHandlerImpl::CloseConnection( ConnectionHandle connection_handle) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); transport_manager::ConnectionUID connection_uid = ConnectionUIDFromHandle(connection_handle); transport_manager_.DisconnectForce(connection_uid); @@ -747,7 +728,7 @@ void ConnectionHandlerImpl::CloseConnection( uint32_t ConnectionHandlerImpl::GetConnectionSessionsCount( uint32_t connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); @@ -774,8 +755,8 @@ void ConnectionHandlerImpl::CloseSession(uint32_t key, void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle, uint8_t session_id, CloseSessionReason close_reason) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Closing session with id: " << session_id); + SDL_AUTO_TRACE(); + SDL_DEBUG("Closing session with id: " << session_id); // In case of malformed message the connection should be broke up without // any other notification to mobile. @@ -796,15 +777,14 @@ void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle, session_map = connection_list_itr->second->session_map(); connection_list_itr->second->RemoveSession(session_id); } else { - LOGGER_ERROR(logger_, - "Connection with id: " << connection_id << " not found"); + SDL_ERROR("Connection with id: " << connection_id << " not found"); return; } } sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (!connection_handler_observer_) { - LOGGER_ERROR(logger_, "Connection handler observer not found"); + SDL_ERROR("Connection handler observer not found"); return; } @@ -823,25 +803,22 @@ void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle, session_key, service_type, close_reason); } } else { - LOGGER_ERROR(logger_, "Session with id: " << session_id << " not found"); + SDL_ERROR("Session with id: " << session_id << " not found"); return; } - LOGGER_DEBUG(logger_, - "Session with id: " << session_id - << " has been closed successfully"); + SDL_DEBUG("Session with id: " << session_id + << " has been closed successfully"); } void ConnectionHandlerImpl::CloseConnectionSessions( ConnectionHandle connection_handle, CloseSessionReason close_reason) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); transport_manager::ConnectionUID connection_id = ConnectionUIDFromHandle(connection_handle); - LOGGER_DEBUG( - logger_, - "Closing all sessions for connection with id: " << connection_id); + SDL_DEBUG("Closing all sessions for connection with id: " << connection_id); typedef std::vector<uint8_t> SessionIdVector; SessionIdVector session_id_vector; @@ -858,8 +835,7 @@ void ConnectionHandlerImpl::CloseConnectionSessions( session_id_vector.push_back(session_map_itr->first); } } else { - LOGGER_ERROR(logger_, - "Connection with id: " << connection_id << " not found"); + SDL_ERROR("Connection with id: " << connection_id << " not found"); return; } } @@ -869,9 +845,8 @@ void ConnectionHandlerImpl::CloseConnectionSessions( } session_id_vector.clear(); - LOGGER_DEBUG(logger_, - "All sessions for connection with id: " - << connection_id << " have been closed successfully"); + SDL_DEBUG("All sessions for connection with id: " + << connection_id << " have been closed successfully"); } void ConnectionHandlerImpl::SendEndService(uint32_t key, uint8_t service_type) { @@ -885,7 +860,7 @@ void ConnectionHandlerImpl::SendEndService(uint32_t key, uint8_t service_type) { } void ConnectionHandlerImpl::StartSessionHeartBeat(uint32_t connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); @@ -899,7 +874,7 @@ void ConnectionHandlerImpl::StartSessionHeartBeat(uint32_t connection_key) { void ConnectionHandlerImpl::SetHeartBeatTimeout(uint32_t connection_key, uint32_t timeout) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); @@ -921,7 +896,7 @@ void ConnectionHandlerImpl::SendHeartBeat(ConnectionHandle connection_handle, void ConnectionHandlerImpl::KeepConnectionAlive(uint32_t connection_key, uint8_t session_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoReadLock lock(connection_list_lock_); ConnectionList::iterator it = connection_list_.find(connection_key); if (connection_list_.end() != it) { @@ -931,13 +906,12 @@ void ConnectionHandlerImpl::KeepConnectionAlive(uint32_t connection_key, void ConnectionHandlerImpl::OnConnectionEnded( const transport_manager::ConnectionUID connection_id) { - LOGGER_INFO(logger_, - "Delete Connection: " << static_cast<int32_t>(connection_id) - << " from the list."); + SDL_INFO("Delete Connection: " << static_cast<int32_t>(connection_id) + << " from the list."); connection_list_lock_.AcquireForWriting(); ConnectionList::iterator itr = connection_list_.find(connection_id); if (connection_list_.end() == itr) { - LOGGER_ERROR(logger_, "Connection not found!"); + SDL_ERROR("Connection not found!"); return; } std::auto_ptr<Connection> connection(itr->second); @@ -967,7 +941,7 @@ void ConnectionHandlerImpl::OnConnectionEnded( void ConnectionHandlerImpl::BindProtocolVersionWithSession( uint32_t connection_key, uint8_t protocol_version) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint32_t connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); @@ -982,12 +956,12 @@ void ConnectionHandlerImpl::BindProtocolVersionWithSession( bool ConnectionHandlerImpl::IsHeartBeatSupported( transport_manager::ConnectionUID connection_handle, uint8_t session_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoReadLock lock(connection_list_lock_); uint32_t connection = static_cast<uint32_t>(connection_handle); ConnectionList::const_iterator it = connection_list_.find(connection); if (connection_list_.end() == it) { - LOGGER_WARN(logger_, "Connection not found !"); + SDL_WARN("Connection not found !"); return false; } return it->second->SupportHeartBeat(session_id); @@ -997,13 +971,13 @@ bool ConnectionHandlerImpl::ProtocolVersionUsed( uint32_t connection_id, uint8_t session_id, uint8_t& protocol_version) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoReadLock lock(connection_list_lock_); ConnectionList::const_iterator it = connection_list_.find(connection_id); if (connection_list_.end() != it) { return it->second->ProtocolVersion(session_id, protocol_version); } - LOGGER_WARN(logger_, "Connection not found !"); + SDL_WARN("Connection not found !"); return false; } diff --git a/src/components/connection_handler/src/device.cc b/src/components/connection_handler/src/device.cc index bd4fab5c4e..11c6fa0070 100644 --- a/src/components/connection_handler/src/device.cc +++ b/src/components/connection_handler/src/device.cc @@ -43,7 +43,7 @@ */ namespace connection_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler") +SDL_CREATE_LOGGER("ConnectionHandler") Device::Device(DeviceHandle device_handle, const std::string& user_friendly_name, @@ -54,9 +54,8 @@ Device::Device(DeviceHandle device_handle, , mac_address_(mac_address) , connection_type_(connection_type) { mac_address_ = encryption::MakeHash(mac_address); - LOGGER_DEBUG(logger_, - "Device: MAC address - " << mac_address << ", hash - " - << mac_address_); + SDL_DEBUG("Device: MAC address - " << mac_address << ", hash - " + << mac_address_); } DeviceHandle Device::device_handle() const { diff --git a/src/components/connection_handler/src/heartbeat_monitor.cc b/src/components/connection_handler/src/heartbeat_monitor.cc index 877bf50781..83cb2161a1 100644 --- a/src/components/connection_handler/src/heartbeat_monitor.cc +++ b/src/components/connection_handler/src/heartbeat_monitor.cc @@ -44,7 +44,7 @@ namespace connection_handler { using namespace sync_primitives; -CREATE_LOGGERPTR_GLOBAL(logger_, "HeartBeatMonitor") +SDL_CREATE_LOGGER("HeartBeatMonitor") HeartBeatMonitor::HeartBeatMonitor(uint32_t heartbeat_timeout_mseconds, Connection* connection) @@ -61,7 +61,7 @@ void HeartBeatMonitor::Process() { if (state.HasTimeoutElapsed()) { const uint8_t session_id = it->first; if (state.IsReadyToClose()) { - LOGGER_WARN(logger_, "Will close session"); + SDL_WARN("Will close session"); sessions_list_lock_.Release(); RemoveSession(session_id); connection_->CloseSession(session_id); @@ -69,9 +69,8 @@ void HeartBeatMonitor::Process() { it = sessions_.begin(); continue; } else { - LOGGER_DEBUG(logger_, - "Send heart beat into session with id " - << static_cast<int32_t>(session_id)); + SDL_DEBUG("Send heart beat into session with id " + << static_cast<int32_t>(session_id)); state.PrepareToClose(); connection_->SendHeartBeat(it->first); } @@ -83,9 +82,8 @@ void HeartBeatMonitor::Process() { void HeartBeatMonitor::threadMain() { AutoLock main_lock(main_thread_lock_); - LOGGER_DEBUG(logger_, - "Start heart beat monitor. Timeout is " - << default_heartbeat_timeout_); + SDL_DEBUG("Start heart beat monitor. Timeout is " + << default_heartbeat_timeout_); while (run_) { heartbeat_monitor_.WaitFor(main_lock, kDefaultCycleTimeout); Process(); @@ -93,42 +91,37 @@ void HeartBeatMonitor::threadMain() { } void HeartBeatMonitor::AddSession(uint8_t session_id) { - LOGGER_DEBUG(logger_, - "Add session with id " << static_cast<int32_t>(session_id)); + SDL_DEBUG("Add session with id " << static_cast<int32_t>(session_id)); AutoLock auto_lock(sessions_list_lock_); if (sessions_.end() != sessions_.find(session_id)) { - LOGGER_WARN(logger_, - "Session with id " << static_cast<int32_t>(session_id) - << " already exists"); + SDL_WARN("Session with id " << static_cast<int32_t>(session_id) + << " already exists"); return; } sessions_.insert( std::make_pair(session_id, SessionState(default_heartbeat_timeout_))); - LOGGER_INFO(logger_, "Start heartbeat for session " << session_id); + SDL_INFO("Start heartbeat for session " << session_id); } void HeartBeatMonitor::RemoveSession(uint8_t session_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); AutoLock auto_lock(sessions_list_lock_); - LOGGER_DEBUG(logger_, - "Remove session with id " << static_cast<int>(session_id)); + SDL_DEBUG("Remove session with id " << static_cast<int>(session_id)); if (sessions_.erase(session_id) == 0) { - LOGGER_WARN(logger_, - "Remove session with id " << static_cast<int>(session_id) - << " was unsuccessful"); + SDL_WARN("Remove session with id " << static_cast<int>(session_id) + << " was unsuccessful"); } } void HeartBeatMonitor::KeepAlive(uint8_t session_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); AutoLock auto_lock(sessions_list_lock_); if (sessions_.end() != sessions_.find(session_id)) { - LOGGER_INFO(logger_, - "Resetting heart beat timer for session with id " - << static_cast<int32_t>(session_id)); + SDL_INFO("Resetting heart beat timer for session with id " + << static_cast<int32_t>(session_id)); sessions_[session_id].KeepAlive(); } @@ -138,7 +131,7 @@ void HeartBeatMonitor::exitThreadMain() { // FIXME (dchmerev@luxoft.com): thread requested to stop should stop as soon // as possible, // not running one more iteration before actual stop - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); AutoLock main_lock(main_thread_lock_); run_ = false; heartbeat_monitor_.NotifyOne(); @@ -146,9 +139,8 @@ void HeartBeatMonitor::exitThreadMain() { void HeartBeatMonitor::set_heartbeat_timeout_milliseconds(uint32_t timeout, uint8_t session_id) { - LOGGER_DEBUG(logger_, - "Set new heart beat timeout " << timeout - << "For session: " << session_id); + SDL_DEBUG("Set new heart beat timeout " << timeout + << "For session: " << session_id); AutoLock session_locker(sessions_list_lock_); if (sessions_.end() != sessions_.find(session_id)) { @@ -160,12 +152,12 @@ HeartBeatMonitor::SessionState::SessionState( uint32_t heartbeat_timeout_mseconds) : heartbeat_timeout_mseconds_(heartbeat_timeout_mseconds) , is_heartbeat_sent_(false) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); RefreshExpiration(); } void HeartBeatMonitor::SessionState::RefreshExpiration() { - LOGGER_DEBUG(logger_, "Refresh expiration: " << heartbeat_timeout_mseconds_); + SDL_DEBUG("Refresh expiration: " << heartbeat_timeout_mseconds_); using namespace date_time; TimevalStruct time = DateTime::getCurrentTime(); DateTime::AddMilliseconds(time, heartbeat_timeout_mseconds_); @@ -174,15 +166,14 @@ void HeartBeatMonitor::SessionState::RefreshExpiration() { void HeartBeatMonitor::SessionState::UpdateTimeout( uint32_t heartbeat_timeout_mseconds) { - LOGGER_DEBUG(logger_, - "Update timout with value " << heartbeat_timeout_mseconds_); + SDL_DEBUG("Update timout with value " << heartbeat_timeout_mseconds_); heartbeat_timeout_mseconds_ = heartbeat_timeout_mseconds; RefreshExpiration(); } void HeartBeatMonitor::SessionState::PrepareToClose() { is_heartbeat_sent_ = true; - LOGGER_DEBUG(logger_, "Prepare to close"); + SDL_DEBUG("Prepare to close"); RefreshExpiration(); } @@ -191,7 +182,7 @@ bool HeartBeatMonitor::SessionState::IsReadyToClose() const { } void HeartBeatMonitor::SessionState::KeepAlive() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); is_heartbeat_sent_ = false; RefreshExpiration(); } diff --git a/src/components/dbus/src/dbus_adapter.cc b/src/components/dbus/src/dbus_adapter.cc index c3dc0f712b..dbd46a2333 100644 --- a/src/components/dbus/src/dbus_adapter.cc +++ b/src/components/dbus/src/dbus_adapter.cc @@ -44,7 +44,7 @@ extern char introspection_xml[]; namespace dbus { -CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler") +SDL_CREATE_LOGGER("HMIMessageHandler") std::vector<std::string>& split(const std::string& s, char delim, @@ -79,36 +79,34 @@ bool DBusAdapter::Init() { int ret; dbus_error_init(&err); if (!dbus_threads_init_default()) { - LOGGER_ERROR(logger_, "DBus: Can't initializes threads"); + SDL_ERROR("DBus: Can't initializes threads"); return false; } conn_ = dbus_bus_get(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { - LOGGER_ERROR(logger_, "DBus: Connection Error " << err.message); + SDL_ERROR("DBus: Connection Error " << err.message); dbus_error_free(&err); return false; } ret = dbus_bus_request_name( conn_, sdl_service_name_.c_str(), DBUS_NAME_FLAG_DO_NOT_QUEUE, &err); if (ret == -1 || dbus_error_is_set(&err)) { - LOGGER_ERROR(logger_, "DBus: Can't request name " << err.name); + SDL_ERROR("DBus: Can't request name " << err.name); dbus_error_free(&err); return false; } if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { - LOGGER_ERROR(logger_, - "DBus: Service '" << sdl_service_name_ - << "' is already running"); + SDL_ERROR("DBus: Service '" << sdl_service_name_ << "' is already running"); return false; } - LOGGER_INFO(logger_, "DBus: Success init dbus adaptor"); + SDL_INFO("DBus: Success init dbus adaptor"); return true; } bool DBusAdapter::Process(smart_objects::SmartObject& obj) { if (conn_ == NULL) { - LOGGER_ERROR(logger_, "DBus: DBusAdaptor isn't initialized"); + SDL_ERROR("DBus: DBusAdaptor isn't initialized"); return false; } DBusMessage* msg = dbus_connection_pop_message(conn_); @@ -135,34 +133,34 @@ void DBusAdapter::MethodReturn(uint id, const MessageId func_id, const MessageName& name, const smart_objects::SmartObject& obj) { - LOGGER_DEBUG(logger_, "Method return " << name.first << "." << name.second); + SDL_DEBUG("Method return " << name.first << "." << name.second); if (conn_ == NULL) { - LOGGER_ERROR(logger_, "DBus: DBusAdaptor isn't init"); + SDL_ERROR("DBus: DBusAdaptor isn't init"); return; } if (func_id == hmi_apis::FunctionID::INVALID_ENUM) { - LOGGER_ERROR(logger_, "DBus: Invalid name method"); + SDL_ERROR("DBus: Invalid name method"); return; } DBusMessage* msg = GetRequestFromHMI(id); if (!msg) { - LOGGER_WARN(logger_, "DBus: request from HMI is not found"); + SDL_WARN("DBus: request from HMI is not found"); return; } DBusMessage* reply; reply = dbus_message_new_method_return(msg); if (NULL == reply) { - LOGGER_WARN(logger_, "DBus: Failed call method (Message Null)"); + SDL_WARN("DBus: Failed call method (Message Null)"); return; } const ListArgs& args = schema_->getListArgs(func_id, hmi_apis::messageType::response); if (!SetArguments(reply, args, obj)) { - LOGGER_ERROR(logger_, "DBus: Failed call method (Signature is wrong)"); + SDL_ERROR("DBus: Failed call method (Signature is wrong)"); dbus_message_unref(reply); dbus_message_unref(msg); return; @@ -170,7 +168,7 @@ void DBusAdapter::MethodReturn(uint id, dbus_uint32_t serial; if (!dbus_connection_send(conn_, reply, &serial)) { - LOGGER_ERROR(logger_, "DBus: Failed call method (Can't send message)"); + SDL_ERROR("DBus: Failed call method (Can't send message)"); dbus_message_unref(reply); dbus_message_unref(msg); return; @@ -178,34 +176,34 @@ void DBusAdapter::MethodReturn(uint id, dbus_connection_flush(conn_); dbus_message_unref(reply); dbus_message_unref(msg); - LOGGER_INFO(logger_, "DBus: Success return method"); + SDL_INFO("DBus: Success return method"); } void DBusAdapter::Error(uint id, const std::string& name, const std::string& description) { - LOGGER_DEBUG(logger_, "Error " << name << ": " << description); + SDL_DEBUG("Error " << name << ": " << description); if (conn_ == NULL) { - LOGGER_ERROR(logger_, "DBus: DBusAdaptor isn't init"); + SDL_ERROR("DBus: DBusAdaptor isn't init"); return; } DBusMessage* msg = GetRequestFromHMI(id); if (!msg) { - LOGGER_WARN(logger_, "DBus: request from HMI is not found"); + SDL_WARN("DBus: request from HMI is not found"); return; } DBusMessage* error; error = dbus_message_new_error(msg, name.c_str(), description.c_str()); if (NULL == error) { - LOGGER_WARN(logger_, "DBus: Failed call method (Message Null)"); + SDL_WARN("DBus: Failed call method (Message Null)"); return; } dbus_uint32_t serial; if (!dbus_connection_send(conn_, error, &serial)) { - LOGGER_ERROR(logger_, "DBus: Failed call method (Can't send message)"); + SDL_ERROR("DBus: Failed call method (Can't send message)"); dbus_message_unref(error); dbus_message_unref(msg); return; @@ -213,21 +211,21 @@ void DBusAdapter::Error(uint id, dbus_connection_flush(conn_); dbus_message_unref(error); dbus_message_unref(msg); - LOGGER_INFO(logger_, "DBus: Success error"); + SDL_INFO("DBus: Success error"); } void DBusAdapter::MethodCall(uint id, const MessageId func_id, const MessageName& name, const smart_objects::SmartObject& obj) { - LOGGER_DEBUG(logger_, "Method call " << name.first << "." << name.second); + SDL_DEBUG("Method call " << name.first << "." << name.second); if (conn_ == NULL) { - LOGGER_ERROR(logger_, "DBus: DBusAdaptor isn't init"); + SDL_ERROR("DBus: DBusAdaptor isn't init"); return; } if (func_id == hmi_apis::FunctionID::INVALID_ENUM) { - LOGGER_ERROR(logger_, "DBus: Invalid name method"); + SDL_ERROR("DBus: Invalid name method"); return; } @@ -238,40 +236,40 @@ void DBusAdapter::MethodCall(uint id, (hmi_service_name_ + "." + name.first).c_str(), name.second.c_str()); if (NULL == msg) { - LOGGER_WARN(logger_, "DBus: Failed call method (Message Null)"); + SDL_WARN("DBus: Failed call method (Message Null)"); return; } const ListArgs& args = schema_->getListArgs(func_id, hmi_apis::messageType::request); if (!SetArguments(msg, args, obj)) { - LOGGER_ERROR(logger_, "DBus: Failed call method (Signature is wrong)"); + SDL_ERROR("DBus: Failed call method (Signature is wrong)"); dbus_message_unref(msg); return; } dbus_uint32_t serial; if (!dbus_connection_send(conn_, msg, &serial)) { - LOGGER_ERROR(logger_, "DBus: Failed call method (Can't send message)"); + SDL_ERROR("DBus: Failed call method (Can't send message)"); dbus_message_unref(msg); return; } SaveRequestToHMI(serial, std::make_pair(id, func_id)); dbus_message_unref(msg); - LOGGER_INFO(logger_, "DBus: Success call method"); + SDL_INFO("DBus: Success call method"); } void DBusAdapter::Signal(const MessageId func_id, const MessageName& name, const smart_objects::SmartObject& obj) { - LOGGER_DEBUG(logger_, "Signal " << name.first << "." << name.second); + SDL_DEBUG("Signal " << name.first << "." << name.second); if (conn_ == NULL) { - LOGGER_ERROR(logger_, "DBus: DBusAdaptor isn't init"); + SDL_ERROR("DBus: DBusAdaptor isn't init"); return; } if (func_id == hmi_apis::FunctionID::INVALID_ENUM) { - LOGGER_ERROR(logger_, "DBus: Invalid name method"); + SDL_ERROR("DBus: Invalid name method"); return; } @@ -280,29 +278,29 @@ void DBusAdapter::Signal(const MessageId func_id, (sdl_service_name_ + "." + name.first).c_str(), name.second.c_str()); if (NULL == msg) { - LOGGER_WARN(logger_, "DBus: Failed emit signal (Message Null)"); + SDL_WARN("DBus: Failed emit signal (Message Null)"); return; } const ListArgs& args = schema_->getListArgs(func_id, hmi_apis::messageType::notification); if (!SetArguments(msg, args, obj)) { - LOGGER_ERROR(logger_, "DBus: Failed call method (Signature is wrong)"); + SDL_ERROR("DBus: Failed call method (Signature is wrong)"); dbus_message_unref(msg); return; } if (!dbus_connection_send(conn_, msg, NULL)) { // serial isn't required - LOGGER_WARN(logger_, "DBus: Failed emit signal (Out Of Memory)"); + SDL_WARN("DBus: Failed emit signal (Out Of Memory)"); dbus_message_unref(msg); return; } dbus_message_unref(msg); - LOGGER_INFO(logger_, "DBus: Success emit signal"); + SDL_INFO("DBus: Success emit signal"); } void DBusAdapter::AddMatch(const std::string& rule) { - LOGGER_INFO(logger_, "Subscription: " << rule); + SDL_INFO("Subscription: " << rule); dbus_bus_add_match(conn_, rule.c_str(), NULL); } @@ -310,11 +308,11 @@ bool DBusAdapter::ProcessMethodCall(DBusMessage* msg, smart_objects::SmartObject& obj) { std::string method = dbus_message_get_member(msg); std::string interface = dbus_message_get_interface(msg); - LOGGER_INFO(logger_, "DBus: name of method " << interface << " " << method); + SDL_INFO("DBus: name of method " << interface << " " << method); if (interface == "org.freedesktop.DBus.Introspectable" && method == "Introspect") { - LOGGER_INFO(logger_, "DBus: INTROSPECT"); + SDL_INFO("DBus: INTROSPECT"); Introspect(msg); return false; } @@ -324,13 +322,13 @@ bool DBusAdapter::ProcessMethodCall(DBusMessage* msg, MessageName name(elems.back(), method); MessageId m_id = schema_->getMessageId(name); if (m_id == hmi_apis::FunctionID::INVALID_ENUM) { - LOGGER_ERROR(logger_, "DBus: Invalid name method call from hmi"); + SDL_ERROR("DBus: Invalid name method call from hmi"); return false; } uint32_t serial = dbus_message_get_serial(msg); if (!serial) { - LOGGER_ERROR(logger_, "DBus: Serial of request from HMI isn't defined"); + SDL_ERROR("DBus: Serial of request from HMI isn't defined"); return false; } @@ -354,11 +352,11 @@ bool DBusAdapter::ProcessMethodCall(DBusMessage* msg, bool DBusAdapter::ProcessMethodReturn(DBusMessage* msg, smart_objects::SmartObject& obj) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); dbus_uint32_t reply_serial = dbus_message_get_reply_serial(msg); std::pair<uint, MessageId> ids = GetRequestToHMI(reply_serial); if (ids.second == hmi_apis::FunctionID::INVALID_ENUM) { - LOGGER_ERROR(logger_, "DBus: Invalid name method"); + SDL_ERROR("DBus: Invalid name method"); return false; } @@ -399,7 +397,7 @@ bool DBusAdapter::ProcessError(DBusMessage* msg, dbus_uint32_t reply_serial = dbus_message_get_reply_serial(msg); std::pair<uint, MessageId> ids = GetRequestToHMI(reply_serial); if (ids.second == hmi_apis::FunctionID::INVALID_ENUM) { - LOGGER_ERROR(logger_, "DBus: Invalid name method"); + SDL_ERROR("DBus: Invalid name method"); return false; } @@ -431,13 +429,11 @@ bool DBusAdapter::ProcessError(DBusMessage* msg, smart_objects::SmartObject(smart_objects::SmartType_Map); obj[sos::S_PARAMS]["data"]["method"] = method.first + "." + method.second; - LOGGER_WARN(logger_, - "DBus: Call of method " << method.first << "." << method.second - << " returned error " << name.asInt() - << ": " - << description[rule.name].asString()); + SDL_WARN("DBus: Call of method " + << method.first << "." << method.second << " returned error " + << name.asInt() << ": " << description[rule.name].asString()); } else { - LOGGER_ERROR(logger_, "DBus: Type message isn't error"); + SDL_ERROR("DBus: Type message isn't error"); } dbus_message_unref(msg); @@ -448,14 +444,14 @@ bool DBusAdapter::ProcessSignal(DBusMessage* msg, smart_objects::SmartObject& obj) { std::string method = dbus_message_get_member(msg); std::string interface = dbus_message_get_interface(msg); - LOGGER_INFO(logger_, "DBus: name of signal " << method); + SDL_INFO("DBus: name of signal " << method); std::vector<std::string> elems; split(interface, '.', elems); MessageName name(elems.back(), method); MessageId m_id = schema_->getMessageId(name); if (m_id == hmi_apis::FunctionID::INVALID_ENUM) { - LOGGER_ERROR(logger_, "DBus: Invalid name signal"); + SDL_ERROR("DBus: Invalid name signal"); return false; } @@ -496,8 +492,7 @@ bool DBusAdapter::SetOneArgument(DBusMessageIter* iter, if (param.isValid()) { return SetValue(iter, rules, param); } else { - LOGGER_WARN(logger_, - "DBus: Argument '" << rules->name << "' is obligatory!"); + SDL_WARN("DBus: Argument '" << rules->name << "' is obligatory!"); return false; } } else { @@ -509,7 +504,7 @@ bool DBusAdapter::SetValue( DBusMessageIter* iter, const ford_message_descriptions::ParameterDescription* rules, const smart_objects::SmartObject& param) { - // LOGGER_DEBUG(logger_, "DBus: Set param " << rules->name << " = " << + // SDL_DEBUG( "DBus: Set param " << rules->name << " = " << // param.asString()); int type = 0; void* value = 0; @@ -554,7 +549,7 @@ bool DBusAdapter::SetValue( value = &stringValue; break; default: - LOGGER_ERROR(logger_, "DBus: Unknown type of argument"); + SDL_ERROR("DBus: Unknown type of argument"); return false; } return dbus_message_iter_append_basic(iter, type, value); @@ -567,8 +562,7 @@ bool DBusAdapter::SetOptionalValue( DBusMessageIter sub_iter; if (!dbus_message_iter_open_container( iter, DBUS_TYPE_STRUCT, NULL, &sub_iter)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "DBus: Can't open container type (STRUCT) for optional parameter"); return false; } @@ -583,8 +577,7 @@ bool DBusAdapter::SetOptionalValue( } if (!dbus_message_iter_close_container(iter, &sub_iter)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "DBus: Can't close container type (STRUCT) for optional parameter"); return false; } @@ -598,13 +591,13 @@ bool DBusAdapter::SetArrayValue( smart_objects::SmartType type = param.getType(); if (type != smart_objects::SmartType_Array && type != smart_objects::SmartType_Invalid) { - LOGGER_ERROR(logger_, "DBus: SmartObject is not a map"); + SDL_ERROR("DBus: SmartObject is not a map"); return false; } DBusMessageIter sub_iter; if (!dbus_message_iter_open_container( iter, DBUS_TYPE_ARRAY, rules->element_dbus_signature, &sub_iter)) { - LOGGER_ERROR(logger_, "DBus: Can't open container type (ARRAY)"); + SDL_ERROR("DBus: Can't open container type (ARRAY)"); return false; } size_t size = param.length(); @@ -614,7 +607,7 @@ bool DBusAdapter::SetArrayValue( } } if (!dbus_message_iter_close_container(iter, &sub_iter)) { - LOGGER_ERROR(logger_, "DBus: Can't close container type (ARRAY)"); + SDL_ERROR("DBus: Can't close container type (ARRAY)"); return false; } return true; @@ -627,13 +620,13 @@ bool DBusAdapter::SetStructValue( smart_objects::SmartType type = structure.getType(); if (type != smart_objects::SmartType_Map && type != smart_objects::SmartType_Invalid) { - LOGGER_ERROR(logger_, "DBus: SmartObject is not a map"); + SDL_ERROR("DBus: SmartObject is not a map"); return false; } DBusMessageIter sub_iter; if (!dbus_message_iter_open_container( iter, DBUS_TYPE_STRUCT, NULL, &sub_iter)) { - LOGGER_ERROR(logger_, "DBus: Can't open container type (STRUCT)"); + SDL_ERROR("DBus: Can't open container type (STRUCT)"); return false; } const ParameterDescription** entry; @@ -647,7 +640,7 @@ bool DBusAdapter::SetStructValue( entry++; } if (!dbus_message_iter_close_container(iter, &sub_iter)) { - LOGGER_ERROR(logger_, "DBus: Can't close container type (STRUCT)"); + SDL_ERROR("DBus: Can't close container type (STRUCT)"); return false; } return true; @@ -660,25 +653,25 @@ bool DBusAdapter::GetHeader(DBusMessageIter* iter, dbus_int32_t intValue; int type = dbus_message_iter_get_arg_type(iter); if (type != DBUS_TYPE_INT32) { - LOGGER_ERROR(logger_, "DBus: Unknown format of header"); + SDL_ERROR("DBus: Unknown format of header"); return false; } dbus_message_iter_get_basic(iter, &intValue); *code = intValue; - LOGGER_DEBUG(logger_, "DBus: Code of response " << *code); + SDL_DEBUG("DBus: Code of response " << *code); dbus_message_iter_next(iter); // Get message of response type = dbus_message_iter_get_arg_type(iter); if (type != DBUS_TYPE_STRING) { - LOGGER_ERROR(logger_, "DBus: Unknown format of header"); + SDL_ERROR("DBus: Unknown format of header"); return false; } const char* stringValue; dbus_message_iter_get_basic(iter, &stringValue); *message = stringValue; - LOGGER_DEBUG(logger_, "DBus: message of response " << *message); + SDL_DEBUG("DBus: message of response " << *message); dbus_message_iter_next(iter); return true; @@ -687,7 +680,7 @@ bool DBusAdapter::GetHeader(DBusMessageIter* iter, bool DBusAdapter::GetArguments(DBusMessageIter* iter, const ListArgs& rules, smart_objects::SmartObject& args) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); size_t size = rules.size(); for (size_t i = 0; i < size; ++i) { @@ -718,7 +711,7 @@ bool DBusAdapter::GetValue( DBusMessageIter* iter, const ford_message_descriptions::ParameterDescription* rules, smart_objects::SmartObject& param) { - LOGGER_DEBUG(logger_, "DBus: Get param " << rules->name); + SDL_DEBUG("DBus: Get param " << rules->name); int type = dbus_message_iter_get_arg_type(iter); switch (rules->type) { case ford_message_descriptions::ParameterType::Array: @@ -730,7 +723,7 @@ bool DBusAdapter::GetValue( const ford_message_descriptions::ArrayDescription*>(rules), param); } else { - LOGGER_ERROR(logger_, "DBus: Not expected type of argument"); + SDL_ERROR("DBus: Not expected type of argument"); return false; } break; @@ -742,7 +735,7 @@ bool DBusAdapter::GetValue( const ford_message_descriptions::StructDescription*>(rules), param); } else { - LOGGER_ERROR(logger_, "DBus: Not expected type of argument"); + SDL_ERROR("DBus: Not expected type of argument"); return false; } break; @@ -753,9 +746,9 @@ bool DBusAdapter::GetValue( dbus_message_iter_get_basic(iter, &integerValue); smart_objects::SmartObject value(integerValue); param = value; - LOGGER_DEBUG(logger_, "DBus: " << rules->name << " = " << integerValue); + SDL_DEBUG("DBus: " << rules->name << " = " << integerValue); } else { - LOGGER_ERROR(logger_, "DBus: Not expected type of argument"); + SDL_ERROR("DBus: Not expected type of argument"); return false; } break; @@ -765,9 +758,9 @@ bool DBusAdapter::GetValue( dbus_message_iter_get_basic(iter, &floatValue); smart_objects::SmartObject value(floatValue); param = value; - LOGGER_DEBUG(logger_, "DBus: " << rules->name << " = " << floatValue); + SDL_DEBUG("DBus: " << rules->name << " = " << floatValue); } else { - LOGGER_ERROR(logger_, "DBus: Not expected type of argument"); + SDL_ERROR("DBus: Not expected type of argument"); return false; } break; @@ -777,11 +770,10 @@ bool DBusAdapter::GetValue( dbus_message_iter_get_basic(iter, &booleanValue); smart_objects::SmartObject value(static_cast<bool>(booleanValue)); param = value; - LOGGER_DEBUG(logger_, - "DBus: " << rules->name << " = " << std::boolalpha - << booleanValue); + SDL_DEBUG("DBus: " << rules->name << " = " << std::boolalpha + << booleanValue); } else { - LOGGER_ERROR(logger_, "DBus: Not expected type of argument"); + SDL_ERROR("DBus: Not expected type of argument"); return false; } break; @@ -792,15 +784,14 @@ bool DBusAdapter::GetValue( std::string strValue = stringValue; smart_objects::SmartObject value(strValue); param = value; - LOGGER_DEBUG(logger_, - "DBus: " << rules->name << " = \"" << strValue << "\""); + SDL_DEBUG("DBus: " << rules->name << " = \"" << strValue << "\""); } else { - LOGGER_ERROR(logger_, "DBus: Not expected type of argument"); + SDL_ERROR("DBus: Not expected type of argument"); return false; } break; default: - LOGGER_ERROR(logger_, "DBus: Unknown type of argument"); + SDL_ERROR("DBus: Unknown type of argument"); return false; } return true; @@ -852,8 +843,7 @@ bool DBusAdapter::GetOptionalValue( smart_objects::SmartObject& param) { int type = dbus_message_iter_get_arg_type(iter); if (type != DBUS_TYPE_STRUCT) { - LOGGER_WARN( - logger_, + SDL_WARN( "DBus: Not expected type of argument. It is not optional parameter."); return false; } @@ -896,7 +886,7 @@ void DBusAdapter::Introspect(DBusMessage* msg) { dbus_uint32_t serial = dbus_message_get_serial(msg); reply = dbus_message_new_method_return(msg); if (!reply) { - LOGGER_WARN(logger_, "DBus: Failed return method for introspection"); + SDL_WARN("DBus: Failed return method for introspection"); return; } @@ -911,19 +901,19 @@ void DBusAdapter::Introspect(DBusMessage* msg) { } void DBusAdapter::SaveRequestFromHMI(uint32_t serial, DBusMessage* request) { - LOGGER_DEBUG(logger_, "Save correlation id (serial id) : " << serial); - LOGGER_DEBUG(logger_, "D-Bus message: " << request); + SDL_DEBUG("Save correlation id (serial id) : " << serial); + SDL_DEBUG("D-Bus message: " << request); requests_from_hmi_.insert(std::make_pair(serial, request)); } DBusMessage* DBusAdapter::GetRequestFromHMI(uint32_t serial) { - LOGGER_DEBUG(logger_, "Get correlation id (serial id) : " << serial); + SDL_DEBUG("Get correlation id (serial id) : " << serial); std::map<uint32_t, DBusMessage*>::iterator it; it = requests_from_hmi_.find(serial); if (it != requests_from_hmi_.end()) { DBusMessage* msg = it->second; requests_from_hmi_.erase(it); - LOGGER_DEBUG(logger_, "D-Bus message: " << msg); + SDL_DEBUG("D-Bus message: " << msg); return msg; } return 0; diff --git a/src/components/hmi_message_handler/src/dbus_message_adapter.cc b/src/components/hmi_message_handler/src/dbus_message_adapter.cc index fc8410ea8b..aac69d5060 100644 --- a/src/components/hmi_message_handler/src/dbus_message_adapter.cc +++ b/src/components/hmi_message_handler/src/dbus_message_adapter.cc @@ -40,7 +40,7 @@ namespace sos = NsSmartDeviceLink::NsJSONHandler::strings; namespace hmi_message_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler") +SDL_CREATE_LOGGER("HMIMessageHandler") const std::string DBusMessageAdapter::SDL_SERVICE_NAME = "com.ford.sdl.core"; const std::string DBusMessageAdapter::SDL_OBJECT_PATH = "/"; @@ -64,13 +64,13 @@ DBusMessageAdapter::DBusMessageAdapter(HMIMessageHandler* hmi_msg_handler) SDL_OBJECT_PATH, HMI_SERVICE_NAME, HMI_OBJECT_PATH) { - LOGGER_INFO(logger_, "Created DBusMessageAdapter"); + SDL_INFO("Created DBusMessageAdapter"); } DBusMessageAdapter::~DBusMessageAdapter() {} void DBusMessageAdapter::SendMessageToHMI(MessageSharedPointer message) { - LOGGER_INFO(logger_, "DBusMessageAdapter::sendMessageToHMI"); + SDL_INFO("DBusMessageAdapter::sendMessageToHMI"); const smart_objects::SmartObject& smart = message->smart_object(); switch (smart[sos::S_PARAMS][sos::S_MESSAGE_TYPE].asInt()) { @@ -88,12 +88,12 @@ void DBusMessageAdapter::SendMessageToHMI(MessageSharedPointer message) { break; case hmi_apis::messageType::INVALID_ENUM: default: - LOGGER_WARN(logger_, "Message type is invalid"); + SDL_WARN("Message type is invalid"); } } void DBusMessageAdapter::SubscribeTo() { - LOGGER_INFO(logger_, "DBusMessageAdapter::subscribeTo"); + SDL_INFO("DBusMessageAdapter::subscribeTo"); DBusMessageController::SubscribeTo("Buttons", "OnButtonEvent"); DBusMessageController::SubscribeTo("Buttons", "OnButtonPress"); DBusMessageController::SubscribeTo("UI", "OnCommand"); @@ -162,15 +162,15 @@ void DBusMessageAdapter::SubscribeTo() { DBusMessageController::SubscribeTo("SDL", "AddStatisticsInfo"); DBusMessageController::SubscribeTo("SDL", "OnDeviceStateChanged"); - LOGGER_INFO(logger_, "Subscribed to notifications."); + SDL_INFO("Subscribed to notifications."); } void DBusMessageAdapter::SendMessageToCore( const smart_objects::SmartObject& obj) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!handler()) { - LOGGER_WARN(logger_, "DBusMessageAdapter hasn't handler"); + SDL_WARN("DBusMessageAdapter hasn't handler"); return; } @@ -184,11 +184,11 @@ void DBusMessageAdapter::SendMessageToCore( message->set_protocol_version(application_manager::ProtocolVersion::kHMI); message->set_smart_object(obj); handler()->OnMessageReceived(message); - LOGGER_INFO(logger_, "Successfully sent to observer"); + SDL_INFO("Successfully sent to observer"); } void DBusMessageAdapter::Request(const smart_objects::SmartObject& obj) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); dbus::MessageId func_id = static_cast<dbus::MessageId>( obj[sos::S_PARAMS][sos::S_FUNCTION_ID].asInt()); dbus::MessageName name = get_schema().getMessageName(func_id); @@ -197,7 +197,7 @@ void DBusMessageAdapter::Request(const smart_objects::SmartObject& obj) { } void DBusMessageAdapter::Notification(const smart_objects::SmartObject& obj) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); dbus::MessageId func_id = static_cast<dbus::MessageId>( obj[sos::S_PARAMS][sos::S_FUNCTION_ID].asInt()); dbus::MessageName name = get_schema().getMessageName(func_id); @@ -205,7 +205,7 @@ void DBusMessageAdapter::Notification(const smart_objects::SmartObject& obj) { } void DBusMessageAdapter::Response(const smart_objects::SmartObject& obj) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); dbus::MessageId func_id = static_cast<dbus::MessageId>( obj[sos::S_PARAMS][sos::S_FUNCTION_ID].asInt()); dbus::MessageName name = get_schema().getMessageName(func_id); @@ -214,7 +214,7 @@ void DBusMessageAdapter::Response(const smart_objects::SmartObject& obj) { } void DBusMessageAdapter::ErrorResponse(const smart_objects::SmartObject& obj) { - LOGGER_DEBUG(logger_, "Error"); + SDL_DEBUG("Error"); std::string error = obj[sos::S_PARAMS][sos::kCode].asString(); std::string description = obj[sos::S_PARAMS][sos::kMessage].asString(); uint id = obj[sos::S_PARAMS][sos::S_CORRELATION_ID].asInt(); diff --git a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc index 0534702ac6..ef100f0a8f 100644 --- a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc +++ b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc @@ -35,7 +35,7 @@ namespace hmi_message_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler") +SDL_CREATE_LOGGER("HMIMessageHandler") HMIMessageHandlerImpl::HMIMessageHandlerImpl( const HMIMessageHandlerSettings& settings) @@ -51,47 +51,47 @@ HMIMessageHandlerImpl::HMIMessageHandlerImpl( threads::ThreadOptions(get_settings().thread_min_stack_size())) {} HMIMessageHandlerImpl::~HMIMessageHandlerImpl() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); messages_to_hmi_.Shutdown(); messages_from_hmi_.Shutdown(); set_message_observer(NULL); } void HMIMessageHandlerImpl::OnMessageReceived(MessageSharedPointer message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(observer_locker_); if (!observer_) { - LOGGER_WARN(logger_, "No HMI message observer set!"); + SDL_WARN("No HMI message observer set!"); return; } messages_from_hmi_.PostMessage(impl::MessageFromHmi(message)); } void HMIMessageHandlerImpl::SendMessageToHMI(MessageSharedPointer message) { - LOGGER_INFO(logger_, "HMIMessageHandlerImpl::~sendMessageToHMI()"); + SDL_INFO("HMIMessageHandlerImpl::~sendMessageToHMI()"); messages_to_hmi_.PostMessage(impl::MessageToHmi(message)); } void HMIMessageHandlerImpl::set_message_observer(HMIMessageObserver* observer) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(observer_locker_); observer_ = observer; } void HMIMessageHandlerImpl::OnErrorSending(MessageSharedPointer message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(observer_locker_); if (!observer_) { - LOGGER_WARN(logger_, "No HMI message observer set!"); + SDL_WARN("No HMI message observer set!"); return; } observer_->OnErrorSending(message); } void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter* adapter) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!adapter) { - LOGGER_WARN(logger_, "HMIMessageAdapter is not valid!"); + SDL_WARN("HMIMessageAdapter is not valid!"); return; } message_adapters_.insert(adapter); @@ -99,9 +99,9 @@ void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter* adapter) { void HMIMessageHandlerImpl::RemoveHMIMessageAdapter( HMIMessageAdapter* adapter) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!adapter) { - LOGGER_WARN(logger_, "HMIMessageAdapter is not valid!"); + SDL_WARN("HMIMessageAdapter is not valid!"); return; } message_adapters_.erase(adapter); @@ -112,15 +112,15 @@ const HMIMessageHandlerSettings& HMIMessageHandlerImpl::get_settings() const { } void HMIMessageHandlerImpl::Handle(const impl::MessageFromHmi message) { - LOGGER_INFO(logger_, "Received message from hmi"); + SDL_INFO("Received message from hmi"); sync_primitives::AutoLock lock(observer_locker_); if (!observer_) { - LOGGER_ERROR(logger_, "Observer is not set for HMIMessageHandler"); + SDL_ERROR("Observer is not set for HMIMessageHandler"); return; } observer_->OnMessageReceived(message); - LOGGER_INFO(logger_, "Message from hmi given away."); + SDL_INFO("Message from hmi given away."); } void HMIMessageHandlerImpl::Handle(const impl::MessageToHmi message) { for (std::set<HMIMessageAdapter*>::iterator it = message_adapters_.begin(); diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc index 7686d10008..c5b2558c2d 100644 --- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc +++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc @@ -37,7 +37,7 @@ namespace hmi_message_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler") +SDL_CREATE_LOGGER("HMIMessageHandler") typedef NsMessageBroker::CMessageBrokerController MessageBrokerController; @@ -46,24 +46,24 @@ MessageBrokerAdapter::MessageBrokerAdapter(HMIMessageHandler* handler_param, uint16_t port) : HMIMessageAdapterImpl(handler_param) , MessageBrokerController(server_address, port, "SDL") { - LOGGER_TRACE(logger_, "Created MessageBrokerAdapter"); + SDL_TRACE("Created MessageBrokerAdapter"); } MessageBrokerAdapter::~MessageBrokerAdapter() {} void MessageBrokerAdapter::SendMessageToHMI( hmi_message_handler::MessageSharedPointer message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!message.valid()) { - LOGGER_ERROR(logger_, "Can`t send not valid message"); + SDL_ERROR("Can`t send not valid message"); return; } Json::Reader reader; Json::Value json_value; if (!reader.parse(message->json_message(), json_value, false)) { - LOGGER_ERROR(logger_, "Received invalid json string."); + SDL_ERROR("Received invalid json string."); return; } @@ -72,22 +72,22 @@ void MessageBrokerAdapter::SendMessageToHMI( void MessageBrokerAdapter::processResponse(std::string method, Json::Value& root) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ProcessRecievedFromMB(root); } void MessageBrokerAdapter::processRequest(Json::Value& root) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ProcessRecievedFromMB(root); } void MessageBrokerAdapter::processNotification(Json::Value& root) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ProcessRecievedFromMB(root); } void MessageBrokerAdapter::SubscribeTo() { - LOGGER_INFO(logger_, "MessageBrokerAdapter::subscribeTo"); + SDL_INFO("MessageBrokerAdapter::subscribeTo"); MessageBrokerController::subscribeTo("Buttons.OnButtonEvent"); MessageBrokerController::subscribeTo("Buttons.OnButtonPress"); MessageBrokerController::subscribeTo("UI.OnCommand"); @@ -136,7 +136,7 @@ void MessageBrokerAdapter::SubscribeTo() { MessageBrokerController::subscribeTo("SDL.OnPolicyUpdate"); MessageBrokerController::subscribeTo("BasicCommunication.OnEventChanged"); - LOGGER_INFO(logger_, "Subscribed to notifications."); + SDL_INFO("Subscribed to notifications."); } void* MessageBrokerAdapter::SubscribeAndBeginReceiverThread(void* param) { @@ -149,7 +149,7 @@ void* MessageBrokerAdapter::SubscribeAndBeginReceiverThread(void* param) { } void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (root.isNull()) { // LOG return; @@ -174,12 +174,12 @@ void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) { message->set_protocol_version(application_manager::ProtocolVersion::kHMI); if (!handler()) { - LOGGER_WARN(logger_, "handler is NULL"); + SDL_WARN("handler is NULL"); return; } handler()->OnMessageReceived(message); - LOGGER_INFO(logger_, "Successfully sent to observer"); + SDL_INFO("Successfully sent to observer"); } } // namespace hmi_message_handler diff --git a/src/components/hmi_message_handler/src/mqueue_adapter.cc b/src/components/hmi_message_handler/src/mqueue_adapter.cc index 2db158a3c4..7f18135e69 100644 --- a/src/components/hmi_message_handler/src/mqueue_adapter.cc +++ b/src/components/hmi_message_handler/src/mqueue_adapter.cc @@ -41,7 +41,7 @@ const uint32_t kMqueueMessageSize = 65536; const char* kSdlToHmiQueue = "/sdl_to_hmi"; const char* kHmiToSdlQueue = "/hmi_to_sdl"; -CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler") +SDL_CREATE_LOGGER("HMIMessageHandler") class ReceiverThreadDelegate : public threads::ThreadDelegate { public: @@ -57,11 +57,11 @@ class ReceiverThreadDelegate : public threads::ThreadDelegate { const ssize_t size = mq_receive(mqueue_descriptor_, buffer, kMqueueMessageSize, NULL); if (-1 == size) { - LOGGER_ERROR(logger_, "Message queue receive failed, error " << errno); + SDL_ERROR("Message queue receive failed, error " << errno); continue; } const std::string message_string(buffer, buffer + size); - LOGGER_DEBUG(logger_, "Message: " << message_string); + SDL_DEBUG("Message: " << message_string); MessageSharedPointer message(new application_manager::Message( protocol_handler::MessagePriority::kDefault)); message->set_json_message(message_string); @@ -85,17 +85,15 @@ MqueueAdapter::MqueueAdapter(HMIMessageHandler* hmi_message_handler) sdl_to_hmi_mqueue_ = mq_open(kSdlToHmiQueue, O_CREAT | O_RDWR, S_IRWXU, &mq_attributes); if (-1 == sdl_to_hmi_mqueue_) { - LOGGER_ERROR(logger_, - "Could not open message queue " << kSdlToHmiQueue << ", error " - << errno); + SDL_ERROR("Could not open message queue " << kSdlToHmiQueue << ", error " + << errno); return; } hmi_to_sdl_mqueue_ = mq_open(kHmiToSdlQueue, O_CREAT | O_RDWR, S_IRWXU, &mq_attributes); if (-1 == hmi_to_sdl_mqueue_) { - LOGGER_ERROR(logger_, - "Could not open message queue " << kHmiToSdlQueue << ", error " - << errno); + SDL_ERROR("Could not open message queue " << kHmiToSdlQueue << ", error " + << errno); return; } receiver_thread_delegate_ = @@ -118,20 +116,20 @@ MqueueAdapter::~MqueueAdapter() { } void MqueueAdapter::SendMessageToHMI(const MessageSharedPointer message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (-1 == sdl_to_hmi_mqueue_) { - LOGGER_ERROR(logger_, "Message queue is not opened"); + SDL_ERROR("Message queue is not opened"); return; } const std::string& json = message->json_message(); if (json.size() > kMqueueMessageSize) { - LOGGER_ERROR(logger_, "Message size " << json.size() << " is too big"); + SDL_ERROR("Message size " << json.size() << " is too big"); return; } const int rc = mq_send(sdl_to_hmi_mqueue_, json.c_str(), json.size(), 0); if (0 != rc) { - LOGGER_ERROR(logger_, "Could not send message, error " << errno); + SDL_ERROR("Could not send message, error " << errno); return; } } diff --git a/src/components/utils/include/utils/appenders_loader.h b/src/components/include/utils/appenders_loader.h index 65556e6862..65556e6862 100644 --- a/src/components/utils/include/utils/appenders_loader.h +++ b/src/components/include/utils/appenders_loader.h diff --git a/src/components/include/utils/logger.h b/src/components/include/utils/logger.h index 2e9167c352..358187c503 100644 --- a/src/components/include/utils/logger.h +++ b/src/components/include/utils/logger.h @@ -40,6 +40,7 @@ #if defined(LOG4CXX_LOGGER) #include <log4cxx/logger.h> +#include "appenders_loader.h" #endif #include "utils/pimpl.h" @@ -107,103 +108,103 @@ class Logger { static Pimpl impl_; }; -} // namespace logger - -#undef INIT_LOGGER +class LoggerAutoPtr { + public: + LoggerAutoPtr(const bool logs_enabled) { #if defined(LOG4CXX_LOGGER) -#define INIT_LOGGER(logs_enabled) \ - if (logs_enabled) { \ - DCHECK(utils::appenders_loader.Loaded()); \ - } \ - logger::Logger::InitLogger(logs_enabled, "log4cxx.properties"); + if (logs_enabled && utils::appenders_loader.Loaded()) { + logger::Logger::InitLogger(logs_enabled, "log4cxx.properties"); + } #else -#define INIT_LOGGER(logs_enabled) \ - logger::Logger::InitLogger( \ - logs_enabled, logger::LogLevel::LL_TRACE, "SmartDeviceLink.log"); + logger::Logger::InitLogger( + logs_enabled, logger::LogLevel::LL_TRACE, "SmartDeviceLink.log"); #endif + } + ~LoggerAutoPtr() { + logger::Logger::DeinitLogger(); + } +}; + +} // namespace logger -#undef DEINIT_LOGGER -#define DEINIT_LOGGER() logger::Logger::DeinitLogger() +#undef SDL_EMPTY_WHILE +#define SDL_EMPTY_WHILE(body) \ + do { \ + body \ + } while (false); -#undef FLUSH_LOGGER -#define FLUSH_LOGGER() logger::Logger::FlushLogger() +#undef SDL_FLUSH_LOGGER +#define SDL_FLUSH_LOGGER() SDL_EMPTY_WHILE(logger::Logger::FlushLogger();) -#undef SET_LOGGER -#define SET_LOGGER(logger) logger::Logger::SetLogger(logger) +#undef SDL_SET_LOGGER +#define SET_SDL_LOGGER(logger) \ + SDL_EMPTY_WHILE(logger::Logger::SetLogger(logger);) -#undef GET_LOGGER -#define GET_LOGGER() logger::Logger::GetLogger() +#undef SDL_GET_LOGGER +#define SDL_GET_LOGGER() logger::Logger::GetLogger() -#undef CREATE_LOGGERPTR_LOCAL +#undef SDL_CREATE_LOGGER #if defined(LOG4CXX_LOGGER) -#define CREATE_LOGGERPTR_LOCAL(logger_var, logger_name) \ - logger::LoggerType logger_var(log4cxx::Logger::getLogger(logger_name)); +#define SDL_CREATE_LOGGER(logger_name) \ + static logger::LoggerType logger_module_ptr( \ + log4cxx::Logger::getLogger(logger_name)); #else -#define CREATE_LOGGERPTR_LOCAL(logger_var, logger_name) \ - logger::LoggerType logger_var(logger_name); +#define SDL_CREATE_LOGGER(logger_name) \ + static logger::LoggerType logger_module_ptr(logger_name); #endif -#undef CREATE_LOGGERPTR_GLOBAL -#define CREATE_LOGGERPTR_GLOBAL(logger_var, logger_name) \ - namespace { \ - CREATE_LOGGERPTR_LOCAL(logger_var, logger_name); \ - } - -#undef LOG_WITH_LEVEL -#define LOG_WITH_LEVEL(logger_var, level, message, line) \ - do { \ - std::stringstream accumulator; \ - accumulator << message; \ - logger::Logger::PushLog( \ - logger_var, \ - level, \ - accumulator.str(), \ - logger::LogLocation(__FILE__, __FUNCTION__, line)); \ +#undef SDL_LOG_WITH_LEVEL +#define SDL_LOG_WITH_LEVEL(logger_var, level, message, line) \ + do { \ + std::stringstream accumulator; \ + accumulator << message; \ + logger::Logger::PushLog( \ + logger_var, \ + level, \ + accumulator.str(), \ + logger::LogLocation(__FILE__, __FUNCTION__, line)); \ } while (false) -#undef LOG_WITH_LEVEL_EXT -#define LOG_WITH_LEVEL_EXT(logger_var, level, message, location) \ +#undef SDL_LOG_WITH_LEVEL_EXT +#define SDL_LOG_WITH_LEVEL_EXT(logger_var, level, message, location) \ do { \ std::stringstream accumulator; \ accumulator << message; \ logger::Logger::PushLog(logger_var, level, accumulator.str(), location); \ } while (false) -#undef LOGGER_TRACE -#define LOGGER_TRACE(logger_var, message) \ - LOG_WITH_LEVEL(logger_var, logger::LogLevel::LL_TRACE, message, __LINE__) +#undef SDL_LOG_MESSAGE +#define SDL_LOG_MESSAGE(log_level, message) \ + SDL_LOG_WITH_LEVEL( \ + logger_module_ptr, logger::LogLevel::log_level, message, __LINE__) + +#undef SDL_TRACE +#define SDL_TRACE(message) SDL_LOG_MESSAGE(LL_TRACE, message) -#undef LOGGER_DEBUG -#define LOGGER_DEBUG(logger_var, message) \ - LOG_WITH_LEVEL(logger_var, logger::LogLevel::LL_DEBUG, message, __LINE__) +#undef SDL_DEBUG +#define SDL_DEBUG(message) SDL_LOG_MESSAGE(LL_DEBUG, message) -#undef LOGGER_INFO -#define LOGGER_INFO(logger_var, message) \ - LOG_WITH_LEVEL(logger_var, logger::LogLevel::LL_INFO, message, __LINE__) +#undef SDL_INFO +#define SDL_INFO(message) SDL_LOG_MESSAGE(LL_INFO, message) -#undef LOGGER_WARN -#define LOGGER_WARN(logger_var, message) \ - LOG_WITH_LEVEL(logger_var, logger::LogLevel::LL_WARN, message, __LINE__) +#undef SDL_WARN +#define SDL_WARN(message) SDL_LOG_MESSAGE(LL_WARN, message) -#undef LOGGER_ERROR -#define LOGGER_ERROR(logger_var, message) \ - LOG_WITH_LEVEL(logger_var, logger::LogLevel::LL_ERROR, message, __LINE__) +#undef SDL_ERROR +#define SDL_ERROR(message) SDL_LOG_MESSAGE(LL_ERROR, message) -#undef LOGGER_FATAL -#define LOGGER_FATAL(logger_var, message) \ - LOG_WITH_LEVEL(logger_var, logger::LogLevel::LL_FATAL, message, __LINE__) +#undef SDL_FATAL +#define SDL_FATAL(message) SDL_LOG_MESSAGE(LL_FATAL, message) -#undef LOGGER_WARN_WITH_ERRNO -#define LOGGER_WARN_WITH_ERRNO(logger_var, message) \ - LOGGER_WARN(logger_var, \ - message << ", error code " << errno << " (" << strerror(errno) \ - << ")") +#undef SDL_WARN_WITH_ERRNO +#define SDL_WARN_WITH_ERRNO(message) \ + SDL_WARN(message << ", error code " << errno << " (" << strerror(errno) \ + << ")") -#undef LOGGER_ERROR_WITH_ERRNO -#define LOGGER_ERROR_WITH_ERRNO(logger_var, message) \ - LOGGER_ERROR(logger_var, \ - message << ", error code " << errno << " (" << strerror(errno) \ - << ")") +#undef SDL_ERROR_WITH_ERRNO +#define SDL_ERROR_WITH_ERRNO(message) \ + SDL_ERROR(message << ", error code " << errno << " (" << strerror(errno) \ + << ")") namespace logger { @@ -211,11 +212,11 @@ class AutoTrace { public: AutoTrace(const LoggerType& logger, const LogLocation& location) : logger_(logger), location_(location) { - LOG_WITH_LEVEL_EXT(logger_, LogLevel::LL_TRACE, "Enter", location_); + SDL_LOG_WITH_LEVEL_EXT(logger_, LogLevel::LL_TRACE, "Enter", location_); } ~AutoTrace() { - LOG_WITH_LEVEL_EXT(logger_, LogLevel::LL_TRACE, "Exit", location_); + SDL_LOG_WITH_LEVEL_EXT(logger_, LogLevel::LL_TRACE, "Exit", location_); } private: @@ -225,69 +226,60 @@ class AutoTrace { } // namespace logger -#undef LOGGER_AUTO_TRACE -#define LOGGER_AUTO_TRACE(logger_var) \ - logger::AutoTrace auto_trace( \ - logger_var, logger::LogLocation(__FILE__, __FUNCTION__, __LINE__)); +#undef SDL_AUTO_TRACE +#define SDL_AUTO_TRACE() \ + logger::AutoTrace auto_trace( \ + logger_module_ptr, \ + logger::LogLocation(__FILE__, __FUNCTION__, __LINE__)); #else // ENABLE_LOG is OFF -#undef INIT_LOGGER -#define INIT_LOGGER(ini_file_name) - -#undef DEINIT_LOGGER -#define DEINIT_LOGGER() - -#undef FLUSH_LOGGER -#define FLUSH_LOGGER() - -#undef SET_LOGGER -#define SET_LOGGER(logger) +#undef SDL_FLUSH_LOGGER +#define SDL_FLUSH_LOGGER() -#undef GET_LOGGER -#define GET_LOGGER() +#undef SDL_SET_LOGGER +#define SDL_SET_LOGGER(logger) -#undef CREATE_LOGGERPTR_LOCAL -#define CREATE_LOGGERPTR_LOCAL(logger_var, logger_name) +#undef SDL_GET_LOGGER +#define SDL_GET_LOGGER() -#undef CREATE_LOGGERPTR_GLOBAL -#define CREATE_LOGGERPTR_GLOBAL(logger_var, logger_name) +#undef SDL_CREATE_LOGGER +#define SDL_CREATE_LOGGER(logger_name) -#undef LOG_WITH_LEVEL -#define LOG_WITH_LEVEL(logger_var, level, message, line) +#undef SDL_LOG_WITH_LEVEL +#define SDL_LOG_WITH_LEVEL(level, message, line) -#undef LOG_WITH_LEVEL_EXT -#define LOG_WITH_LEVEL_EXT(logger_var, level, message, file, function, line) +#undef SDL_LOG_WITH_LEVEL_EXT +#define SDL_LOG_WITH_LEVEL_EXT(level, message, file, function, line) -#undef LOGGER_TRACE -#define LOGGER_TRACE(logger_var, message) +#undef SDL_TRACE +#define SDL_TRACE(message) -#define LOGGER_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, auto_trace) -#define LOGGER_AUTO_TRACE(loggerPtr) +#define SDL_AUTO_TRACE() -#undef LOGGER_DEBUG -#define LOGGER_DEBUG(logger_var, message) +#undef SDL_DEBUG +#define SDL_DEBUG(message) -#undef LOGGER_INFO -#define LOGGER_INFO(logger_var, message) +#undef SDL_INFO +#define SDL_INFO(message) -#undef LOGGER_WARN -#define LOGGER_WARN(logger_var, message) +#undef SDL_WARN +#define SDL_WARN(message) -#undef LOGGER_ERROR -#define LOGGER_ERROR(logger_var, message) +#undef SDL_ERROR +#define SDL_ERROR(message) -#undef LOGGER_FATAL -#define LOGGER_FATAL(logger_var, message) +#undef SDL_FATAL +#define SDL_FATAL(message) -#undef LOGGER_WARN_WITH_ERRNO -#define LOGGER_WARN_WITH_ERRNO(logger_var, message) +#undef SDL_WARN_WITH_ERRNO +#define SDL_WARN_WITH_ERRNO(message) -#undef LOGGER_ERROR_WITH_ERRNO -#define LOGGER_ERROR_WITH_ERRNO(logger_var, message) +#undef SDL_ERROR_WITH_ERRNO +#define SDL_ERROR_WITH_ERRNO(message) -#undef LOGGER_AUTO_TRACE -#define LOGGER_AUTO_TRACE(logger_var) +#undef SDL_AUTO_TRACE +#define SDL_AUTO_TRACE() #endif // ENABLE_LOG #endif // SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_H_ diff --git a/src/components/include/utils/macro.h b/src/components/include/utils/macro.h index ea1b3af4bc..a12a925144 100644 --- a/src/components/include/utils/macro.h +++ b/src/components/include/utils/macro.h @@ -66,9 +66,8 @@ #ifdef DEBUG #define SDL_ASSERT(condition) \ - FLUSH_LOGGER(); \ + SDL_FLUSH_LOGGER(); \ do { \ - DEINIT_LOGGER(); \ assert(condition); \ } while (false) #else // RELEASE @@ -80,43 +79,40 @@ __FUNCTION__) #endif -#define DCHECK(condition) \ - if (!(condition)) { \ - CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \ - LOGGER_FATAL(logger_, \ - "DCHECK failed with \"" << #condition << "\" [" \ - << __FUNCTION__ << "][" << __FILE__ \ - << ':' << __LINE__ << ']'); \ - SDL_ASSERT((condition)); \ +#define DCHECK(condition) \ + if (!(condition)) { \ + SDL_CREATE_LOGGER("Utils"); \ + SDL_FATAL("DCHECK failed with \"" << #condition << "\" [" << __FUNCTION__ \ + << "][" << __FILE__ << ':' << __LINE__ \ + << ']'); \ + SDL_ASSERT((condition)); \ } /* * Will cauch assert on debug version, * Will return return_value in release build */ -#define DCHECK_OR_RETURN(condition, return_value) \ - if (!(condition)) { \ - CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \ - LOGGER_FATAL(logger_, \ - "DCHECK failed with \"" << #condition << "\" [" \ - << __FUNCTION__ << "][" << __FILE__ \ - << ':' << __LINE__ << ']'); \ - SDL_ASSERT((condition)); \ - return (return_value); \ +#define DCHECK_OR_RETURN(condition, return_value) \ + if (!(condition)) { \ + SDL_CREATE_LOGGER("Utils"); \ + SDL_FATAL("DCHECK failed with \"" << #condition << "\" [" << __FUNCTION__ \ + << "][" << __FILE__ << ':' << __LINE__ \ + << ']'); \ + SDL_ASSERT((condition)); \ + return (return_value); \ } /* * Will cauch assert on debug version, * Will return return_value in release build */ -#define DCHECK_OR_RETURN_VOID(condition) \ - if (!(condition)) { \ - CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \ - LOGGER_FATAL(logger_, \ - "DCHECK failed with \"" << #condition << "\" [" \ - << __FUNCTION__ << "][" << __FILE__ \ - << ':' << __LINE__ << ']'); \ - SDL_ASSERT((condition)); \ - return; \ +#define DCHECK_OR_RETURN_VOID(condition) \ + if (!(condition)) { \ + SDL_CREATE_LOGGER("Utils"); \ + SDL_FATAL("DCHECK failed with \"" << #condition << "\" [" << __FUNCTION__ \ + << "][" << __FILE__ << ':' << __LINE__ \ + << ']'); \ + SDL_ASSERT((condition)); \ + return; \ } #define NOTREACHED() DCHECK(!"Unreachable code") diff --git a/src/components/include/utils/threads/message_loop_thread.h b/src/components/include/utils/threads/message_loop_thread.h index 5fbe08cda2..7a51e6a871 100644 --- a/src/components/include/utils/threads/message_loop_thread.h +++ b/src/components/include/utils/threads/message_loop_thread.h @@ -139,8 +139,8 @@ MessageLoopThread<Q>::MessageLoopThread(const std::string& name, , thread_(threads::CreateThread(name.c_str(), thread_delegate_)) { const bool started = thread_->start(thread_opts); if (!started) { - CREATE_LOGGERPTR_LOCAL(logger_, "Utils") - LOGGER_ERROR(logger_, "Failed to start thread " << name); + SDL_CREATE_LOGGER("Utils") + SDL_ERROR("Failed to start thread " << name); } } @@ -177,8 +177,8 @@ MessageLoopThread<Q>::LoopThreadDelegate::LoopThreadDelegate( template <class Q> void MessageLoopThread<Q>::LoopThreadDelegate::threadMain() { - CREATE_LOGGERPTR_LOCAL(logger_, "Utils") - LOGGER_AUTO_TRACE(logger_); + SDL_CREATE_LOGGER("Utils") + SDL_AUTO_TRACE(); while (!message_queue_.IsShuttingDown()) { DrainQue(); message_queue_.wait(); @@ -189,8 +189,8 @@ void MessageLoopThread<Q>::LoopThreadDelegate::threadMain() { template <class Q> void MessageLoopThread<Q>::LoopThreadDelegate::exitThreadMain() { - CREATE_LOGGERPTR_LOCAL(logger_, "Utils") - LOGGER_AUTO_TRACE(logger_); + SDL_CREATE_LOGGER("Utils") + SDL_AUTO_TRACE(); message_queue_.Shutdown(); } diff --git a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc index 0d985d1c21..2f586c0c91 100644 --- a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc +++ b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc @@ -55,7 +55,7 @@ using sync_primitives::AutoLock; const int32_t AudioStreamSenderThread::kAudioPassThruTimeout = 1; const uint32_t kMqueueMessageSize = 4095; -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOGGER("MediaManager") AudioStreamSenderThread::AudioStreamSenderThread( const std::string& fileName, @@ -67,13 +67,13 @@ AudioStreamSenderThread::AudioStreamSenderThread( , shouldBeStoped_lock_() , shouldBeStoped_cv_() , application_manager_(app_mngr) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } AudioStreamSenderThread::~AudioStreamSenderThread() {} void AudioStreamSenderThread::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); offset_ = 0; @@ -85,30 +85,30 @@ void AudioStreamSenderThread::threadMain() { } void AudioStreamSenderThread::sendAudioChunkToMobile() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::vector<uint8_t> binaryData; std::vector<uint8_t>::iterator from; std::vector<uint8_t>::iterator to; if (!file_system::ReadBinaryFile(fileName_, binaryData)) { - LOGGER_ERROR(logger_, "Unable to read file." << fileName_); + SDL_ERROR("Unable to read file." << fileName_); return; } if (binaryData.empty()) { - LOGGER_ERROR(logger_, "Binary data is empty."); + SDL_ERROR("Binary data is empty."); return; } - LOGGER_INFO(logger_, "offset = " << offset_); + SDL_INFO("offset = " << offset_); from = binaryData.begin() + offset_; to = binaryData.end(); if (from < binaryData.end() /*from != binaryData.end()*/) { - LOGGER_INFO(logger_, "from != binaryData.end()"); + SDL_INFO("from != binaryData.end()"); offset_ = offset_ + to - from; std::vector<uint8_t> data(from, to); @@ -135,7 +135,7 @@ void AudioStreamSenderThread::setShouldBeStopped(bool should_stop) { } void AudioStreamSenderThread::exitThreadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); setShouldBeStopped(true); } diff --git a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc index b1d73d35ca..65dae15632 100644 --- a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc +++ b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc @@ -38,7 +38,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOGGER("MediaManager") FromMicRecorderAdapter::FromMicRecorderAdapter() : recorder_thread_(NULL) @@ -47,7 +47,7 @@ FromMicRecorderAdapter::FromMicRecorderAdapter() , duration_(kDefaultDuration) {} FromMicRecorderAdapter::~FromMicRecorderAdapter() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (recorder_thread_) { recorder_thread_->join(); delete recorder_thread_->delegate(); @@ -56,10 +56,9 @@ FromMicRecorderAdapter::~FromMicRecorderAdapter() { } void FromMicRecorderAdapter::StartActivity(int32_t application_key) { - LOGGER_DEBUG(logger_, "Start with app " << application_key); + SDL_DEBUG("Start with app " << application_key); if (application_key == current_application_) { - LOGGER_WARN(logger_, - "Running recording from mic for " << current_application_); + SDL_WARN("Running recording from mic for " << current_application_); return; } @@ -77,11 +76,9 @@ void FromMicRecorderAdapter::StartActivity(int32_t application_key) { } void FromMicRecorderAdapter::StopActivity(int32_t application_key) { - LOGGER_INFO(logger_, - "FromMicRecorderAdapter::StopActivity " << application_key); + SDL_INFO("FromMicRecorderAdapter::StopActivity " << application_key); if (application_key != current_application_) { - LOGGER_WARN(logger_, - "Running activity on other app key " << current_application_); + SDL_WARN("Running activity on other app key " << current_application_); return; } diff --git a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc index f18176f7fd..f0113e59e5 100644 --- a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc +++ b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc @@ -37,7 +37,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOGGER("MediaManager") FromMicRecorderListener::FromMicRecorderListener( const std::string& file_name, @@ -45,7 +45,7 @@ FromMicRecorderListener::FromMicRecorderListener( : reader_(NULL), file_name_(file_name), application_manager_(app_mngr) {} FromMicRecorderListener::~FromMicRecorderListener() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (reader_) { reader_->join(); delete reader_->delegate(); @@ -60,8 +60,7 @@ void FromMicRecorderListener::OnErrorReceived(int32_t application_key, const DataForListener& data) {} void FromMicRecorderListener::OnActivityStarted(int32_t application_key) { - LOGGER_INFO(logger_, - "FromMicRecorderListener::OnActivityStarted " << application_key); + SDL_INFO("FromMicRecorderListener::OnActivityStarted " << application_key); if (application_key == current_application_) { return; } @@ -77,12 +76,10 @@ void FromMicRecorderListener::OnActivityStarted(int32_t application_key) { } void FromMicRecorderListener::OnActivityEnded(int32_t application_key) { - LOGGER_INFO(logger_, - "FromMicRecorderListener::OnActivityEnded " << application_key); + SDL_INFO("FromMicRecorderListener::OnActivityEnded " << application_key); if (application_key != current_application_) { - LOGGER_WARN(logger_, - "Not performing activity on " << application_key << " but on " - << current_application_); + SDL_WARN("Not performing activity on " << application_key << " but on " + << current_application_); return; } if (reader_) { diff --git a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc index 9380126471..6d3d45c41c 100644 --- a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc +++ b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc @@ -43,13 +43,13 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOGGER("MediaManager") gboolean HandleBusMessage(GstBus* bus, GstMessage* message, gpointer data) { GMainLoop* loop = static_cast<GMainLoop*>(data); switch (GST_MESSAGE_TYPE(message)) { case GST_MESSAGE_EOS: { - LOGGER_INFO(logger_, "End of stream"); + SDL_INFO("End of stream"); g_main_loop_quit(loop); break; @@ -61,7 +61,7 @@ gboolean HandleBusMessage(GstBus* bus, GstMessage* message, gpointer data) { gst_message_parse_error(message, &error, &debug); g_free(debug); - LOGGER_ERROR(logger_, error->message); + SDL_ERROR(error->message); g_error_free(error); g_main_loop_quit(loop); @@ -160,7 +160,7 @@ void media_manager::FromMicToFileRecorderThread::Impl::stopGstLoop() { } void media_manager::FromMicToFileRecorderThread::Impl::startGstLoop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); GstElement* alsasrc, *wavenc, *filesink; GstBus* bus; @@ -210,9 +210,9 @@ void media_manager::FromMicToFileRecorderThread::Impl::startGstLoop() { g_error("Must supply destination (-d FILE)\n"); } - LOGGER_TRACE(logger_, "Reading from device: " << device); - LOGGER_TRACE(logger_, "Saving pipeline output to: " << outfile); - LOGGER_TRACE(logger_, "Duration set to: " << duration); + SDL_TRACE("Reading from device: " << device); + SDL_TRACE("Saving pipeline output to: " << outfile); + SDL_TRACE("Duration set to: " << duration); // Initialize gstreamer and setup the main loop information gst_init(&argc_, &argv_); @@ -246,7 +246,7 @@ void media_manager::FromMicToFileRecorderThread::Impl::startGstLoop() { gst_element_set_state(pipeline_, GST_STATE_PLAYING); - LOGGER_TRACE(logger_, "Initializing pipeline ..."); + SDL_TRACE("Initializing pipeline ..."); while (GST_STATE(pipeline_) != GST_STATE_PLAYING) { bool shouldBeStoped; { @@ -267,7 +267,7 @@ void media_manager::FromMicToFileRecorderThread::Impl::startGstLoop() { return; } } - LOGGER_TRACE(logger_, "Pipeline started ...\n"); + SDL_TRACE("Pipeline started ...\n"); loop = g_main_loop_new(NULL, FALSE); @@ -275,7 +275,7 @@ void media_manager::FromMicToFileRecorderThread::Impl::startGstLoop() { gst_element_set_state(pipeline_, GST_STATE_NULL); - LOGGER_TRACE(logger_, "Deleting pipeline\n"); + SDL_TRACE("Deleting pipeline\n"); gst_object_unref(GST_OBJECT(pipeline_)); g_main_loop_unref(loop); g_option_context_free(context); @@ -296,7 +296,7 @@ media_manager::FromMicToFileRecorderThread::FromMicToFileRecorderThread( const std::string& output_file, int32_t duration) : threads::ThreadDelegate() , impl_(new Impl("-o", "-t", output_file, duration)) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sleep_thread_ = FromMicToFileRecorderThreadPtr(new timer::Timer( "AudioFromMicSuspend", new timer::TimerTaskImpl<FromMicToFileRecorderThread>( @@ -305,7 +305,7 @@ media_manager::FromMicToFileRecorderThread::FromMicToFileRecorderThread( } media_manager::FromMicToFileRecorderThread::~FromMicToFileRecorderThread() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (sleep_thread_) { sleep_thread_->Stop(); } @@ -314,12 +314,12 @@ media_manager::FromMicToFileRecorderThread::~FromMicToFileRecorderThread() { } void media_manager::FromMicToFileRecorderThread::setRecordDuration( int32_t duration) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); impl_->setDuration(duration); } void media_manager::FromMicToFileRecorderThread::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); impl_->setShouldBeStoped(false); impl_->startGstLoop(); @@ -332,21 +332,21 @@ void media_manager::FromMicToFileRecorderThread::threadMain() { void media_manager::FromMicToFileRecorderThread:: onFromMicToFileRecorderThreadSuspned() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); impl_->stopGstLoop(); - LOGGER_TRACE(logger_, "Set should be stopped flag\n"); + SDL_TRACE("Set should be stopped flag\n"); impl_->setShouldBeStoped(true); } void media_manager::FromMicToFileRecorderThread::exitThreadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); impl_->stopGstLoop(); if (sleep_thread_) { - LOGGER_DEBUG(logger_, "Stop sleep thread\n"); + SDL_DEBUG("Stop sleep thread\n"); sleep_thread_->Stop(); } - LOGGER_TRACE(logger_, "Set should be stopped flag\n"); + SDL_TRACE("Set should be stopped flag\n"); impl_->setShouldBeStoped(true); } diff --git a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread_qt.cc b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread_qt.cc index 6642df068f..3b93f14567 100644 --- a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread_qt.cc +++ b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread_qt.cc @@ -41,7 +41,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "FromMicToFileRecorderThread") +SDL_CREATE_LOGGER("FromMicToFileRecorderThread") //////////////////////////////////////////////////////////////////////////////// /// media_manager::FromMicToFileRecorderThread::Impl @@ -89,13 +89,13 @@ media_manager::FromMicToFileRecorderThread::Impl::Impl( SIGNAL(durationChanged(qint64)), this, SLOT(updateProgress(qint64))); - LOGGER_INFO(logger_, "Add input device:" << device_.toStdString()); + SDL_INFO("Add input device:" << device_.toStdString()); device_ = audioRecorder_->audioInputs().first(); audioRecorder_->setAudioInput(device_); codec_ = audioRecorder_->supportedAudioCodecs().first(); - LOGGER_INFO(logger_, "Set audio codec:" << codec_.toStdString()); + SDL_INFO("Set audio codec:" << codec_.toStdString()); settings_.setCodec(codec_); settings_.setSampleRate(audioRecorder_->supportedAudioSampleRates().first()); settings_.setBitRate(128000); @@ -154,8 +154,7 @@ void media_manager::FromMicToFileRecorderThread::Impl::stopRecord() { } void media_manager::FromMicToFileRecorderThread::Impl::displayErrorMessage() { - LOGGER_ERROR( - logger_, + SDL_ERROR( "QAudioRecorder eroor: " << audioRecorder_->errorString().toStdString()); } @@ -168,7 +167,7 @@ media_manager::FromMicToFileRecorderThread::FromMicToFileRecorderThread( : threads::ThreadDelegate() , impl_(new Impl(output_file)) , output_file_name_(output_file) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); setRecordDuration(duration); sleep_thread_ = FromMicToFileRecorderThreadPtr(new timer::Timer( "AudioFromMicSuspend", @@ -178,7 +177,7 @@ media_manager::FromMicToFileRecorderThread::FromMicToFileRecorderThread( } media_manager::FromMicToFileRecorderThread::~FromMicToFileRecorderThread() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); delete impl_; impl_ = NULL; if (sleep_thread_) { @@ -188,24 +187,24 @@ media_manager::FromMicToFileRecorderThread::~FromMicToFileRecorderThread() { void media_manager::FromMicToFileRecorderThread::setRecordDuration( int32_t duration) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); impl_->setDuration(duration); } void media_manager::FromMicToFileRecorderThread::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); impl_->setShouldBeStoped(false); if (output_file_name_.empty()) { - LOGGER_ERROR(logger_, "Must supply destination"); + SDL_ERROR("Must supply destination"); } - LOGGER_TRACE(logger_, "Reading from device: " << impl_->getDeviceName()); - LOGGER_TRACE(logger_, "Saving pipeline output to: " << output_file_name_); - LOGGER_TRACE(logger_, "Duration set to: " << impl_->getDuration()); + SDL_TRACE("Reading from device: " << impl_->getDeviceName()); + SDL_TRACE("Saving pipeline output to: " << output_file_name_); + SDL_TRACE("Duration set to: " << impl_->getDuration()); - LOGGER_TRACE(logger_, "Audio capture started ...\n"); + SDL_TRACE("Audio capture started ...\n"); if (impl_->getDuration() > 0) { sleep_thread_->Start(impl_->getDuration(), timer::kSingleShot); @@ -215,20 +214,20 @@ void media_manager::FromMicToFileRecorderThread::threadMain() { void media_manager::FromMicToFileRecorderThread:: onFromMicToFileRecorderThreadSuspned() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); impl_->stopRecord(); - LOGGER_TRACE(logger_, "Set should be stopped flag\n"); + SDL_TRACE("Set should be stopped flag\n"); impl_->setShouldBeStoped(true); } void media_manager::FromMicToFileRecorderThread::exitThreadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (sleep_thread_) { - LOGGER_DEBUG(logger_, "Stop sleep thread\n"); + SDL_DEBUG("Stop sleep thread\n"); sleep_thread_->Stop(); } - LOGGER_TRACE(logger_, "Set should be stopped flag\n"); + SDL_TRACE("Set should be stopped flag\n"); impl_->setShouldBeStoped(true); impl_->stopRecord(); } diff --git a/src/components/media_manager/src/file_streamer_adapter.cc b/src/components/media_manager/src/file_streamer_adapter.cc index 9aef4d6535..bd6649d1f4 100644 --- a/src/components/media_manager/src/file_streamer_adapter.cc +++ b/src/components/media_manager/src/file_streamer_adapter.cc @@ -36,7 +36,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "FileStreamerAdapter") +SDL_CREATE_LOGGER("FileStreamerAdapter") FileStreamerAdapter::FileStreamerAdapter(const std::string& file_name, const std::string& app_storage_folder) @@ -56,24 +56,24 @@ FileStreamerAdapter::FileStreamer::FileStreamer( FileStreamerAdapter::FileStreamer::~FileStreamer() {} bool FileStreamerAdapter::FileStreamer::Connect() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!file_system::CreateDirectoryRecursively(app_storage_folder_)) { - LOGGER_ERROR(logger_, "Cannot create app folder"); + SDL_ERROR("Cannot create app folder"); return false; } file_stream_ = file_system::Open(file_name_); if (!file_stream_) { - LOGGER_ERROR(logger_, "Cannot open file stream " << file_name_); + SDL_ERROR("Cannot open file stream " << file_name_); return false; } - LOGGER_INFO(logger_, "File " << file_name_ << " was successfuly opened"); + SDL_INFO("File " << file_name_ << " was successfuly opened"); return true; } void FileStreamerAdapter::FileStreamer::Disconnect() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (file_stream_) { file_system::Close(file_stream_); delete file_stream_; @@ -84,18 +84,18 @@ void FileStreamerAdapter::FileStreamer::Disconnect() { bool FileStreamerAdapter::FileStreamer::Send( protocol_handler::RawMessagePtr msg) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!file_stream_) { - LOGGER_ERROR(logger_, "File stream not found " << file_name_); + SDL_ERROR("File stream not found " << file_name_); return false; } if (!file_system::Write(file_stream_, msg->data(), msg->data_size())) { - LOGGER_ERROR(logger_, "Failed writing data to file " << file_name_); + SDL_ERROR("Failed writing data to file " << file_name_); return false; } - LOGGER_INFO(logger_, "Streamer::sent " << msg->data_size()); + SDL_INFO("Streamer::sent " << msg->data_size()); return true; } diff --git a/src/components/media_manager/src/media_adapter_impl.cc b/src/components/media_manager/src/media_adapter_impl.cc index 8fe70cebd3..ff102b9f5c 100644 --- a/src/components/media_manager/src/media_adapter_impl.cc +++ b/src/components/media_manager/src/media_adapter_impl.cc @@ -35,7 +35,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOGGER("MediaManager") MediaAdapterImpl::MediaAdapterImpl() : current_application_(0) {} @@ -44,12 +44,12 @@ MediaAdapterImpl::~MediaAdapterImpl() { } void MediaAdapterImpl::AddListener(const MediaListenerPtr& listener) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); media_listeners_.insert(listener); } void MediaAdapterImpl::RemoveListener(const MediaListenerPtr& listener) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); media_listeners_.erase(listener); } diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc index 46618ea79f..c57caf8e1e 100644 --- a/src/components/media_manager/src/media_manager_impl.cc +++ b/src/components/media_manager/src/media_manager_impl.cc @@ -54,7 +54,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOGGER("MediaManager") MediaManagerImpl::MediaManagerImpl( application_manager::ApplicationManager& application_manager, @@ -101,7 +101,7 @@ void MediaManagerImpl::set_mock_streamer_listener( void MediaManagerImpl::Init() { using namespace protocol_handler; - LOGGER_INFO(logger_, "MediaManagerImpl::Init()"); + SDL_INFO("MediaManagerImpl::Init()"); if ("socket" == settings().video_server_type()) { streamer_[ServiceType::kMobileNav] = new SocketVideoStreamerAdapter( @@ -142,8 +142,7 @@ void MediaManagerImpl::Init() { void MediaManagerImpl::StartMicrophoneRecording(int32_t application_key, const std::string& output_file, int32_t duration) { - LOGGER_INFO(logger_, - "MediaManagerImpl::StartMicrophoneRecording to " << output_file); + SDL_INFO("MediaManagerImpl::StartMicrophoneRecording to " << output_file); application_manager::ApplicationSharedPtr app = application_manager_.application(application_key); std::string file_path = settings().app_storage_folder(); @@ -162,11 +161,11 @@ void MediaManagerImpl::StartMicrophoneRecording(int32_t application_key, } #else if (file_system::FileExists(file_path)) { - LOGGER_INFO(logger_, "File " << output_file << " exists, removing"); + SDL_INFO("File " << output_file << " exists, removing"); if (file_system::DeleteFile(file_path)) { - LOGGER_INFO(logger_, "File " << output_file << " removed"); + SDL_INFO("File " << output_file << " removed"); } else { - LOGGER_WARN(logger_, "Could not remove file " << output_file); + SDL_WARN("Could not remove file " << output_file); } } const std::string record_file_source = settings().app_resource_folder() + @@ -175,21 +174,19 @@ void MediaManagerImpl::StartMicrophoneRecording(int32_t application_key, std::vector<uint8_t> buf; if (file_system::ReadBinaryFile(record_file_source, buf)) { if (file_system::Write(file_path, buf)) { - LOGGER_INFO(logger_, - "File " << record_file_source << " copied to " - << output_file); + SDL_INFO("File " << record_file_source << " copied to " << output_file); } else { - LOGGER_WARN(logger_, "Could not write to file " << output_file); + SDL_WARN("Could not write to file " << output_file); } } else { - LOGGER_WARN(logger_, "Could not read file " << record_file_source); + SDL_WARN("Could not read file " << record_file_source); } #endif from_mic_listener_->OnActivityStarted(application_key); } void MediaManagerImpl::StopMicrophoneRecording(int32_t application_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); #if defined(EXTENDED_MEDIA_MODE) if (from_mic_recorder_) { from_mic_recorder_->StopActivity(application_key); @@ -207,7 +204,7 @@ void MediaManagerImpl::StopMicrophoneRecording(int32_t application_key) { void MediaManagerImpl::StartStreaming( int32_t application_key, protocol_handler::ServiceType service_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (streamer_[service_type]) { streamer_[service_type]->StartActivity(application_key); @@ -216,7 +213,7 @@ void MediaManagerImpl::StartStreaming( void MediaManagerImpl::StopStreaming( int32_t application_key, protocol_handler::ServiceType service_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (streamer_[service_type]) { streamer_[service_type]->StopActivity(application_key); @@ -228,21 +225,20 @@ void MediaManagerImpl::OnMessageReceived( using namespace protocol_handler; using namespace application_manager; using namespace helpers; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const uint32_t streaming_app_id = message->connection_key(); const ServiceType service_type = message->service_type(); if (Compare<ServiceType, NEQ, ALL>( service_type, ServiceType::kMobileNav, ServiceType::kAudio)) { - LOGGER_DEBUG(logger_, "Unsupported service type in MediaManager"); + SDL_DEBUG("Unsupported service type in MediaManager"); return; } if (!application_manager_.CanAppStream(streaming_app_id, service_type)) { application_manager_.ForbidStreaming(streaming_app_id); - LOGGER_ERROR(logger_, - "The application trying to stream when it should not."); + SDL_ERROR("The application trying to stream when it should not."); return; } diff --git a/src/components/media_manager/src/pipe_streamer_adapter.cc b/src/components/media_manager/src/pipe_streamer_adapter.cc index 1c071d7653..72d8455ee6 100644 --- a/src/components/media_manager/src/pipe_streamer_adapter.cc +++ b/src/components/media_manager/src/pipe_streamer_adapter.cc @@ -36,7 +36,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "PipeStreamerAdapter") +SDL_CREATE_LOGGER("PipeStreamerAdapter") PipeStreamerAdapter::PipeStreamerAdapter(const std::string& named_pipe_path, const std::string& app_storage_folder) @@ -56,44 +56,44 @@ PipeStreamerAdapter::PipeStreamer::PipeStreamer( PipeStreamerAdapter::PipeStreamer::~PipeStreamer() {} bool PipeStreamerAdapter::PipeStreamer::Connect() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!file_system::CreateDirectoryRecursively(app_storage_folder_)) { - LOGGER_ERROR(logger_, "Cannot create app folder"); + SDL_ERROR("Cannot create app folder"); return false; } if (!pipe_.Open()) { - LOGGER_ERROR(logger_, "Cannot open pipe"); + SDL_ERROR("Cannot open pipe"); return false; } - LOGGER_INFO(logger_, "Streamer connected to pipe"); + SDL_INFO("Streamer connected to pipe"); return true; } void PipeStreamerAdapter::PipeStreamer::Disconnect() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); pipe_.Close(); - LOGGER_INFO(logger_, "Streamer disconnected from pipe"); + SDL_INFO("Streamer disconnected from pipe"); } bool PipeStreamerAdapter::PipeStreamer::Send( protocol_handler::RawMessagePtr msg) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); size_t sent = 0; if (!pipe_.Write(msg->data(), msg->data_size(), sent)) { - LOGGER_ERROR(logger_, "Cannot write to pipe"); + SDL_ERROR("Cannot write to pipe"); return false; } if (sent != msg->data_size()) { - LOGGER_WARN(logger_, "Couldn't write all the data to pipe"); + SDL_WARN("Couldn't write all the data to pipe"); } - LOGGER_INFO(logger_, "Streamer sent to pipe " << sent << " bytes"); + SDL_INFO("Streamer sent to pipe " << sent << " bytes"); return true; } diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc index 7de5e2ce8f..a7ca7d18a0 100644 --- a/src/components/media_manager/src/socket_streamer_adapter.cc +++ b/src/components/media_manager/src/socket_streamer_adapter.cc @@ -35,7 +35,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger, "SocketStreamerAdapter") +SDL_CREATE_LOGGER("SocketStreamerAdapter") SocketStreamerAdapter::SocketStreamerAdapter(const std::string& ip, int32_t port, @@ -60,39 +60,39 @@ SocketStreamerAdapter::SocketStreamer::SocketStreamer( SocketStreamerAdapter::SocketStreamer::~SocketStreamer() {} bool SocketStreamerAdapter::SocketStreamer::Connect() { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(); const int backlog = 5; if (!server_socket_.Listen(utils::HostAddress(ip_), port_, backlog)) { - LOGGER_ERROR(logger, "Unable to listen"); + SDL_ERROR("Unable to listen"); return false; } client_socket_ = server_socket_.Accept(); if (!client_socket_.IsValid()) { - LOGGER_ERROR(logger, "Unable to accept"); + SDL_ERROR("Unable to accept"); return false; } is_first_frame_ = true; - LOGGER_INFO(logger, "Client connected"); + SDL_INFO("Client connected"); return true; } void SocketStreamerAdapter::SocketStreamer::Disconnect() { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(); client_socket_.Close(); server_socket_.Close(); } bool SocketStreamerAdapter::SocketStreamer::Send( protocol_handler::RawMessagePtr msg) { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(); std::size_t written = 0u; if (is_first_frame_) { bool sent = client_socket_.Send(header_.c_str(), header_.size(), written); if (!sent || written != header_.size()) { - LOGGER_ERROR(logger, "Unable to send data to socket"); + SDL_ERROR("Unable to send data to socket"); return false; } is_first_frame_ = false; @@ -100,15 +100,15 @@ bool SocketStreamerAdapter::SocketStreamer::Send( bool sent = client_socket_.Send(msg->data(), msg->data_size(), written); if (!sent) { - LOGGER_ERROR(logger, "Unable to send data to socket"); + SDL_ERROR("Unable to send data to socket"); return false; } if (written != msg->data_size()) { - LOGGER_WARN(logger, "Couldn't send all the data to socket"); + SDL_WARN("Couldn't send all the data to socket"); } - LOGGER_INFO(logger, "Streamer::sent " << msg->data_size()); + SDL_INFO("Streamer::sent " << msg->data_size()); return true; } diff --git a/src/components/media_manager/src/streamer_adapter.cc b/src/components/media_manager/src/streamer_adapter.cc index ddff0dbcf2..000586cff6 100644 --- a/src/components/media_manager/src/streamer_adapter.cc +++ b/src/components/media_manager/src/streamer_adapter.cc @@ -35,7 +35,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger, "StreamerAdapter") +SDL_CREATE_LOGGER("StreamerAdapter") StreamerAdapter::StreamerAdapter(Streamer* const streamer) : current_application_(0), messages_(), streamer_(streamer), thread_(NULL) { @@ -50,11 +50,10 @@ StreamerAdapter::~StreamerAdapter() { } void StreamerAdapter::StartActivity(int32_t application_key) { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(); if (is_app_performing_activity(application_key)) { - LOGGER_WARN(logger, - "Activity for application: " << application_key - << " has been already started"); + SDL_WARN("Activity for application: " << application_key + << " has been already started"); return; } messages_.Reset(); @@ -72,11 +71,10 @@ void StreamerAdapter::StartActivity(int32_t application_key) { } void StreamerAdapter::StopActivity(int32_t application_key) { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(); if (!is_app_performing_activity(application_key)) { - LOGGER_WARN(logger, - "Activity for application: " << application_key - << " has not been started"); + SDL_WARN("Activity for application: " << application_key + << " has not been started"); return; } @@ -93,11 +91,10 @@ void StreamerAdapter::StopActivity(int32_t application_key) { void StreamerAdapter::SendData(int32_t application_key, const ::protocol_handler::RawMessagePtr msg) { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(); if (!is_app_performing_activity(application_key)) { - LOGGER_ERROR(logger, - "Activity for application: " << application_key - << " has not been started"); + SDL_ERROR("Activity for application: " << application_key + << " has not been started"); return; } messages_.push(msg); @@ -116,13 +113,13 @@ StreamerAdapter::Streamer::Streamer(StreamerAdapter* const adapter) StreamerAdapter::Streamer::~Streamer() {} void StreamerAdapter::Streamer::threadMain() { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(); if (!adapter_) { - LOGGER_ERROR(logger, "Null pointer to adapter"); + SDL_ERROR("Null pointer to adapter"); return; } if (!Connect()) { - LOGGER_ERROR(logger, "Unable to connect"); + SDL_ERROR("Unable to connect"); return; } stop_flag_ = false; @@ -131,25 +128,24 @@ void StreamerAdapter::Streamer::threadMain() { while (!adapter_->messages_.empty()) { protocol_handler::RawMessagePtr msg; if (!adapter_->messages_.pop(msg)) { - LOGGER_ERROR(logger, "Empty message queue"); + SDL_ERROR("Empty message queue"); continue; } if (!msg) { - LOGGER_ERROR(logger, "Null pointer message"); + SDL_ERROR("Null pointer message"); continue; } if (!Send(msg)) { - LOGGER_ERROR(logger, "Unable to send. Disconnecting"); + SDL_ERROR("Unable to send. Disconnecting"); Disconnect(); return; } static int32_t messages_for_session = 0; ++messages_for_session; - LOGGER_DEBUG(logger, - "Handling map streaming message. This is " - << messages_for_session << " message for " - << adapter_->current_application_); + SDL_DEBUG("Handling map streaming message. This is " + << messages_for_session << " message for " + << adapter_->current_application_); std::set<MediaListenerPtr>::iterator it = adapter_->media_listeners_.begin(); for (; adapter_->media_listeners_.end() != it; ++it) { @@ -162,7 +158,7 @@ void StreamerAdapter::Streamer::threadMain() { } void StreamerAdapter::Streamer::exitThreadMain() { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(); stop_flag_ = true; if (adapter_) { adapter_->messages_.Shutdown(); diff --git a/src/components/media_manager/src/streamer_listener.cc b/src/components/media_manager/src/streamer_listener.cc index 73ea608e82..579d05ea1f 100644 --- a/src/components/media_manager/src/streamer_listener.cc +++ b/src/components/media_manager/src/streamer_listener.cc @@ -36,7 +36,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOGGER("MediaManager") StreamerListener::StreamerListener(MediaManager& media_manager) : current_application_(0), media_manager_(media_manager) {} @@ -52,23 +52,22 @@ void StreamerListener::OnDataReceived(int32_t application_key, void StreamerListener::OnErrorReceived(int32_t application_key, const DataForListener& data) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } void StreamerListener::OnActivityStarted(int32_t application_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (current_application_ == application_key) { - LOGGER_WARN(logger_, "Already performing activity for " << application_key); + SDL_WARN("Already performing activity for " << application_key); return; } current_application_ = application_key; } void StreamerListener::OnActivityEnded(int32_t application_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (current_application_ != application_key) { - LOGGER_WARN(logger_, - "Already not performing activity for " << application_key); + SDL_WARN("Already not performing activity for " << application_key); return; } current_application_ = 0; diff --git a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc index 1d4495c3dd..193af14a37 100644 --- a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc +++ b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc @@ -37,7 +37,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger, "VideoStreamToFileAdapter") +SDL_CREATE_LOGGER(logger, "VideoStreamToFileAdapter") VideoStreamToFileAdapter::VideoStreamToFileAdapter(const std::string& file_name) : file_name_(file_name) @@ -47,7 +47,7 @@ VideoStreamToFileAdapter::VideoStreamToFileAdapter(const std::string& file_name) } VideoStreamToFileAdapter::~VideoStreamToFileAdapter() { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(logger); if ((0 != current_application_) && (is_ready_)) { StopActivity(current_application_); } @@ -58,20 +58,20 @@ VideoStreamToFileAdapter::~VideoStreamToFileAdapter() { void VideoStreamToFileAdapter::Init() { if (thread_->is_running()) { - LOGGER_DEBUG(logger, "Start sending thread"); + SDL_DEBUG(logger, "Start sending thread"); const size_t kStackSize = 16384; thread_->start(threads::ThreadOptions(kStackSize)); } else { - LOGGER_WARN(logger, "thread is already running"); + SDL_WARN(logger, "thread is already running"); } } void VideoStreamToFileAdapter::SendData( int32_t application_key, const ::protocol_handler::RawMessagePtr message) { - LOGGER_INFO(logger, "VideoStreamToFileAdapter::SendData " << application_key); + SDL_INFO(logger, "VideoStreamToFileAdapter::SendData " << application_key); if (application_key != current_application_) { - LOGGER_WARN(logger, "Wrong application " << application_key); + SDL_WARN(logger, "Wrong application " << application_key); return; } @@ -81,11 +81,11 @@ void VideoStreamToFileAdapter::SendData( } void VideoStreamToFileAdapter::StartActivity(int32_t application_key) { - LOGGER_INFO(logger, - "VideoStreamToFileAdapter::StartActivity " << application_key); + SDL_INFO(logger, + "VideoStreamToFileAdapter::StartActivity " << application_key); if (application_key == current_application_) { - LOGGER_WARN(logger, - "Already running video stream to file for " << application_key); + SDL_WARN(logger, + "Already running video stream to file for " << application_key); return; } @@ -100,11 +100,11 @@ void VideoStreamToFileAdapter::StartActivity(int32_t application_key) { } void VideoStreamToFileAdapter::StopActivity(int32_t application_key) { - LOGGER_INFO(logger, - "VideoStreamToFileAdapter::StopActivity " << application_key); + SDL_INFO(logger, + "VideoStreamToFileAdapter::StopActivity " << application_key); if (application_key != current_application_) { - LOGGER_WARN(logger, - "Performing activity for another key " << current_application_); + SDL_WARN(logger, + "Performing activity for another key " << current_application_); return; } @@ -132,7 +132,7 @@ VideoStreamToFileAdapter::Streamer::~Streamer() { } void VideoStreamToFileAdapter::Streamer::threadMain() { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(logger); open(); @@ -140,7 +140,7 @@ void VideoStreamToFileAdapter::Streamer::threadMain() { while (!server_->messages_.empty()) { ::protocol_handler::RawMessagePtr msg = server_->messages_.pop(); if (!msg) { - LOGGER_ERROR(logger, "Null pointer message"); + SDL_ERROR(logger, "Null pointer message"); continue; } @@ -156,7 +156,7 @@ void VideoStreamToFileAdapter::Streamer::threadMain() { messsages_for_session); } } else { - LOGGER_WARN(logger, "Can't open File stream! " << server_->file_name_); + SDL_WARN(logger, "Can't open File stream! " << server_->file_name_); } } server_->messages_.wait(); @@ -166,22 +166,22 @@ void VideoStreamToFileAdapter::Streamer::threadMain() { } void VideoStreamToFileAdapter::Streamer::exitThreadMain() { - LOGGER_AUTO_TRACE(logger); + SDL_AUTO_TRACE(logger); stop_flag_ = true; server_->messages_.Shutdown(); } void VideoStreamToFileAdapter::Streamer::open() { - LOGGER_INFO(logger, "Streamer::open()" << server_->file_name_.c_str()); + SDL_INFO(logger, "Streamer::open()" << server_->file_name_.c_str()); DCHECK(file_system::CreateDirectoryRecursively( profile::Profile::instance()->app_storage_folder())); file_stream_ = file_system::Open(server_->file_name_); if (!file_stream_) { - LOGGER_WARN(logger, "Can't open file stream! " << server_->file_name_); + SDL_WARN(logger, "Can't open file stream! " << server_->file_name_); } else { - LOGGER_INFO(logger, "file_stream_ opened :" << file_stream_); + SDL_INFO(logger, "file_stream_ opened :" << file_stream_); } } diff --git a/src/components/policy/src/cache_manager.cc b/src/components/policy/src/cache_manager.cc index de246f7fce..3d3c15eacd 100644 --- a/src/components/policy/src/cache_manager.cc +++ b/src/components/policy/src/cache_manager.cc @@ -55,22 +55,22 @@ namespace policy_table = rpc::policy_table_interface_base; namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") - -#define CACHE_MANAGER_CHECK(return_value) \ - { \ - if (!pt_) { \ - LOGGER_WARN(logger_, "The cache manager is not initialized"); \ - return return_value; \ - } \ +SDL_CREATE_LOGGER("Policy") + +#define CACHE_MANAGER_CHECK(return_value) \ + { \ + if (!pt_) { \ + SDL_WARN("The cache manager is not initialized"); \ + return return_value; \ + } \ } -#define CACHE_MANAGER_CHECK_VOID() \ - { \ - if (!pt_) { \ - LOGGER_WARN(logger_, "The cache manager is not initialized"); \ - return; \ - } \ +#define CACHE_MANAGER_CHECK_VOID() \ + { \ + if (!pt_) { \ + SDL_WARN("The cache manager is not initialized"); \ + return; \ + } \ } struct LanguageFinder { @@ -92,14 +92,14 @@ CacheManager::CacheManager(const std::string& app_storage_folder, attempts_to_open_policy_db, open_attempt_timeout_ms)) , update_required(false) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); backuper_ = new BackgroundBackuper(this); backup_thread_ = threads::CreateThread("Backup thread", backuper_); backup_thread_->start(); } CacheManager::~CacheManager() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(backuper_locker_); backup_thread_->join(); delete backup_thread_->delegate(); @@ -148,17 +148,17 @@ bool CacheManager::GetUserPermissionsForDevice( const std::string& device_id, StringArray& consented_groups, StringArray& disallowed_groups) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); return true; } void CacheManager::GetAllAppGroups(const std::string& app_id, FunctionalGroupIDs& all_group_ids) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); if (kDeviceId == app_id) { - LOGGER_INFO(logger_, "Devices doesn't have groups"); + SDL_INFO("Devices doesn't have groups"); return; } @@ -180,7 +180,7 @@ void CacheManager::GetAllAppGroups(const std::string& app_id, void CacheManager::GetPreConsentedGroups( const std::string& app_id, FunctionalGroupIDs& preconsented_groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); } @@ -188,7 +188,7 @@ void CacheManager::GetConsentedGroups(const std::string& device_id, const std::string& app_id, FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); } @@ -196,7 +196,7 @@ void CacheManager::GetUnconsentedGroups( const std::string& device_id, const std::string& policy_app_id, FunctionalGroupIDs& unconsented_groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); } @@ -206,7 +206,7 @@ void CacheManager::RemoveAppConsentForGroup(const std::string& app_id, } bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); pt_->policy_table.functional_groupings = @@ -227,7 +227,7 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) { update_pt.policy_table.app_policies_section.apps.find(kDefaultId); if (update_pt.policy_table.app_policies_section.apps.end() == iter_default) { - LOGGER_ERROR(logger_, "The default section was not found in PTU"); + SDL_ERROR("The default section was not found in PTU"); continue; } pt_->policy_table.app_policies_section.apps[iter->first] = @@ -253,7 +253,7 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) { void CacheManager::GetHMIAppTypeAfterUpdate( std::map<std::string, StringArray>& app_hmi_types) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); policy_table::ApplicationPolicies::const_iterator policy_iter_begin = pt_->policy_table.app_policies_section.apps.begin(); @@ -295,7 +295,7 @@ std::string CacheManager::currentDateTime() { bool CacheManager::GetPermissionsForApp(const std::string& device_id, const std::string& app_id, FunctionalIdType& group_types) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); GetAllAppGroups(app_id, group_types[kTypeGeneral]); GetAllAppGroups(kDefaultId, group_types[kTypeDefault]); GetAllAppGroups(kPreDataConsentId, group_types[kTypePreDataConsented]); @@ -305,14 +305,14 @@ bool CacheManager::GetPermissionsForApp(const std::string& device_id, bool CacheManager::GetDeviceGroupsFromPolicies( policy_table::Strings& groups, policy_table::Strings& preconsented_groups) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); return true; } bool CacheManager::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); @@ -328,7 +328,7 @@ bool CacheManager::SetDeviceData(const std::string& device_id, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); @@ -340,7 +340,7 @@ bool CacheManager::SetUserPermissionsForDevice( const std::string& device_id, const StringArray& consented_groups, const StringArray& disallowed_groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); Backup(); @@ -349,7 +349,7 @@ bool CacheManager::SetUserPermissionsForDevice( bool CacheManager::ReactOnUserDevConsentForApp(const std::string& app_id, bool is_device_allowed) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); bool result = true; Backup(); @@ -374,7 +374,7 @@ void CacheManager::GetGroupNameByHashID(const int32_t group_id, bool CacheManager::SetUserPermissionsForApp( const PermissionConsent& permissions) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); Backup(); @@ -405,13 +405,12 @@ void CacheManager::CheckPermissions(const PTString& app_id, const PTString& hmi_level, const PTString& rpc, CheckPermissionResult& result) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); if (pt_->policy_table.app_policies_section.apps.end() == pt_->policy_table.app_policies_section.apps.find(app_id)) { - LOGGER_ERROR(logger_, - "Application id " << app_id << " was not found in policy DB."); + SDL_ERROR("Application id " << app_id << " was not found in policy DB."); return; } @@ -470,13 +469,13 @@ int CacheManager::IgnitionCyclesBeforeExchange() { static_cast<int>( pt_->policy_table.module_config.exchange_after_x_ignition_cycles), 0); - LOGGER_DEBUG(logger_, "IgnitionCyclesBeforeExchange limit:" << limit); + SDL_DEBUG("IgnitionCyclesBeforeExchange limit:" << limit); uint8_t current = 0; const int last_exch = static_cast<int>( *pt_->policy_table.module_meta->ignition_cycles_since_last_exchange); current = std::max(last_exch, 0); - LOGGER_DEBUG(logger_, "IgnitionCyclesBeforeExchange current:" << current); + SDL_DEBUG("IgnitionCyclesBeforeExchange current:" << current); return std::max(limit - current, 0); } @@ -487,16 +486,16 @@ int CacheManager::KilometersBeforeExchange(int current) { std::max(static_cast<int>( pt_->policy_table.module_config.exchange_after_x_kilometers), 0); - LOGGER_DEBUG(logger_, "KilometersBeforeExchange limit:" << limit); + SDL_DEBUG("KilometersBeforeExchange limit:" << limit); int last = 0; const int odo_val = static_cast<int>( *pt_->policy_table.module_meta->pt_exchanged_at_odometer_x); last = std::max(odo_val, 0); - LOGGER_DEBUG(logger_, "KilometersBeforeExchange last:" << last); + SDL_DEBUG("KilometersBeforeExchange last:" << last); const int actual = std::max((current - last), 0); - LOGGER_DEBUG(logger_, "KilometersBeforeExchange actual:" << actual); + SDL_DEBUG("KilometersBeforeExchange actual:" << actual); return std::max(limit - actual, 0); } @@ -506,18 +505,15 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate( switch (counter) { case KILOMETERS: *pt_->policy_table.module_meta->pt_exchanged_at_odometer_x = value; - LOGGER_DEBUG(logger_, - "SetCountersPassedForSuccessfulUpdate km:" << value); + SDL_DEBUG("SetCountersPassedForSuccessfulUpdate km:" << value); break; case DAYS_AFTER_EPOCH: *pt_->policy_table.module_meta->pt_exchanged_x_days_after_epoch = value; - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "SetCountersPassedForSuccessfulUpdate days after epoch:" << value); break; default: - LOGGER_DEBUG(logger_, - "Unknown counter was requested to set: " << counter); + SDL_DEBUG("Unknown counter was requested to set: " << counter); return false; } @@ -526,19 +522,18 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate( } int CacheManager::DaysBeforeExchange(int current) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK(0); const uint8_t limit = pt_->policy_table.module_config.exchange_after_x_days; - LOGGER_DEBUG(logger_, - "Exchange after: " << static_cast<int>(limit) << " days"); + SDL_DEBUG("Exchange after: " << static_cast<int>(limit) << " days"); const uint16_t days_after_epoch = (*pt_->policy_table.module_meta->pt_exchanged_x_days_after_epoch); - LOGGER_DEBUG(logger_, "Epoch since last update: " << days_after_epoch); + SDL_DEBUG("Epoch since last update: " << days_after_epoch); const uint16_t actual = std::max(static_cast<uint16_t>(current - days_after_epoch), uint16_t(0)); - LOGGER_DEBUG(logger_, "The days since last update: " << actual); + SDL_DEBUG("The days since last update: " << actual); return std::max(limit - actual, 0); } @@ -549,7 +544,7 @@ void CacheManager::IncrementIgnitionCycles() { *pt_->policy_table.module_meta->ignition_cycles_since_last_exchange); (*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange) = ign_val + 1; - LOGGER_DEBUG(logger_, "IncrementIgnitionCycles ignitions:" << ign_val); + SDL_DEBUG("IncrementIgnitionCycles ignitions:" << ign_val); Backup(); } @@ -587,17 +582,15 @@ const policy::VehicleInfo CacheManager::GetVehicleInfo() const { vehicle_info.vehicle_make = *module_config.vehicle_make; vehicle_info.vehicle_model = *module_config.vehicle_model; vehicle_info.vehicle_year = *module_config.vehicle_year; - LOGGER_DEBUG( - logger_, - "Vehicle info (make, model, year):" << vehicle_info.vehicle_make << "," - << vehicle_info.vehicle_model << "," - << vehicle_info.vehicle_year); + SDL_DEBUG("Vehicle info (make, model, year):" + << vehicle_info.vehicle_make << "," << vehicle_info.vehicle_model + << "," << vehicle_info.vehicle_year); return vehicle_info; } std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( const std::vector<std::string>& msg_codes, const std::string& language) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::vector<UserFriendlyMessage> result; CACHE_MANAGER_CHECK(result); @@ -616,10 +609,8 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( msg_languages.languages.begin(), msg_languages.languages.end(), finder); if (msg_languages.languages.end() == it_language) { - LOGGER_WARN(logger_, - "Language " - << language - << " haven't been found for message code: " << *it); + SDL_WARN("Language " << language + << " haven't been found for message code: " << *it); LanguageFinder fallback_language_finder("en-us"); @@ -629,8 +620,7 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( fallback_language_finder); if (msg_languages.languages.end() == it_fallback_language) { - LOGGER_ERROR(logger_, - "No fallback language found for message code: " << *it); + SDL_ERROR("No fallback language found for message code: " << *it); continue; } @@ -648,14 +638,14 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( void CacheManager::GetServiceUrls(const std::string& service_type, EndpointUrls& end_points) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); std::string search_value; if (!IsNumberService(service_type, search_value)) { search_value = service_type; } - LOGGER_DEBUG(logger_, "Search service value is: " << search_value); + SDL_DEBUG("Search service value is: " << search_value); policy_table::ServiceEndpoints::const_iterator iter = pt_->policy_table.module_config.endpoints.find(search_value); @@ -724,7 +714,7 @@ bool CacheManager::GetPriority(const std::string& policy_app_id, void CacheManager::CheckSnapshotInitialization() { CACHE_MANAGER_CHECK_VOID(); if (!snapshot_) { - LOGGER_ERROR(logger_, "Snapshot pointer is not initialized"); + SDL_ERROR("Snapshot pointer is not initialized"); return; } @@ -741,8 +731,7 @@ void CacheManager::CheckSnapshotInitialization() { snapshot_->policy_table.consumer_friendly_messages->messages = rpc::Optional<policy_table::Messages>(); } else { - LOGGER_WARN(logger_, - "policy_table.consumer_friendly_messages is not initialized"); + SDL_WARN("policy_table.consumer_friendly_messages is not initialized"); } /* policy_table.usage_and_error_counts are required for PTS and @@ -817,13 +806,12 @@ void CacheManager::CheckSnapshotInitialization() { } } } else { - LOGGER_WARN(logger_, - "usage_and_error_counts or app_level is not initialized"); + SDL_WARN("usage_and_error_counts or app_level is not initialized"); } } void CacheManager::PersistData() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (backup_.valid()) { if (pt_.valid()) { cache_lock_.Acquire(); @@ -878,7 +866,7 @@ void CacheManager::PersistData() { } void CacheManager::ResetCalculatedPermissions() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_.clear(); } @@ -886,9 +874,8 @@ void CacheManager::ResetCalculatedPermissions() { void CacheManager::AddCalculatedPermissions(const std::string& device_id, const std::string& policy_app_id, const Permissions& permissions) { - LOGGER_DEBUG(logger_, - "AddCalculatedPermissions for device: " - << device_id << " and app: " << policy_app_id); + SDL_DEBUG("AddCalculatedPermissions for device: " << device_id << " and app: " + << policy_app_id); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_[device_id][policy_app_id] = permissions; } @@ -896,9 +883,8 @@ void CacheManager::AddCalculatedPermissions(const std::string& device_id, bool CacheManager::IsPermissionsCalculated(const std::string& device_id, const std::string& policy_app_id, Permissions& permission) { - LOGGER_DEBUG(logger_, - "IsPermissionsCalculated for device: " - << device_id << " and app: " << policy_app_id); + SDL_DEBUG("IsPermissionsCalculated for device: " << device_id << " and app: " + << policy_app_id); sync_primitives::AutoLock lock(calculated_permissions_lock_); CalculatedPermissions::const_iterator it = calculated_permissions_.find(device_id); @@ -973,7 +959,7 @@ utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() { bool CacheManager::GetInitialAppData(const std::string& app_id, StringArray& nicknames, StringArray& app_hmi_types) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); policy_table::ApplicationPolicies::const_iterator policy_iter = pt_->policy_table.app_policies_section.apps.find(app_id); @@ -995,7 +981,7 @@ bool CacheManager::GetInitialAppData(const std::string& app_id, bool CacheManager::GetFunctionalGroupings( policy_table::FunctionalGroupings& groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); const policy_table::FunctionalGroupings& f_groupings = pt_->policy_table.functional_groupings; @@ -1006,9 +992,9 @@ bool CacheManager::GetFunctionalGroupings( int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id, const std::string& device_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); - LOGGER_DEBUG(logger_, "Application id: " << policy_app_id); + SDL_DEBUG("Application id: " << policy_app_id); int result = 0; return result; } @@ -1039,7 +1025,7 @@ bool CacheManager::SetSystemLanguage(const std::string& language) { } bool CacheManager::GetFunctionalGroupNames(FunctionalGroupNames& names) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); rpc::policy_table_interface_base::FunctionalGroupings::iterator iter = pt_->policy_table.functional_groupings.begin(); @@ -1110,7 +1096,7 @@ void CacheManager::Increment(const std::string& app_id, .count_of_tls_errors; break; default: - LOGGER_WARN(logger_, "Type app counter is unknown"); + SDL_WARN("Type app counter is unknown"); return; } Backup(); @@ -1177,9 +1163,8 @@ bool CacheManager::SetPredataPolicy(const std::string& app_id) { pt_->policy_table.app_policies_section.apps.find(kPreDataConsentId); if (pt_->policy_table.app_policies_section.apps.end() == iter) { - LOGGER_ERROR(logger_, - "Could not set " << kPreDataConsentId - << " permissions for app " << app_id); + SDL_ERROR("Could not set " << kPreDataConsentId << " permissions for app " + << app_id); return false; } @@ -1220,20 +1205,18 @@ bool CacheManager::SetUnpairedDevice(const std::string& device_id, const bool result = pt_->policy_table.device_data->end() != pt_->policy_table.device_data->find(device_id); if (!result) { - LOGGER_DEBUG(logger_, - "Couldn't set unpaired flag for device id " - << device_id << " , since it wasn't found."); + SDL_DEBUG("Couldn't set unpaired flag for device id " + << device_id << " , since it wasn't found."); return false; } sync_primitives::AutoLock lock(unpaired_lock_); if (unpaired) { is_unpaired_.insert(device_id); - LOGGER_DEBUG(logger_, "Unpaired flag was set for device id " << device_id); + SDL_DEBUG("Unpaired flag was set for device id " << device_id); } else { is_unpaired_.erase(device_id); - LOGGER_DEBUG(logger_, - "Unpaired flag was removed for device id " << device_id); + SDL_DEBUG("Unpaired flag was removed for device id " << device_id); } return result; } @@ -1256,20 +1239,20 @@ bool CacheManager::IsApplicationRepresented(const std::string& app_id) const { bool CacheManager::Init(const std::string& file_name, const PolicySettings* settings) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); settings_ = settings; InitResult init_result = backup_->Init(settings); bool result = true; switch (init_result) { case InitResult::EXISTS: { - LOGGER_INFO(logger_, "Policy Table exists, was loaded correctly."); + SDL_INFO("Policy Table exists, was loaded correctly."); result = LoadFromBackup(); if (result) { if (!backup_->IsDBVersionActual()) { - LOGGER_INFO(logger_, "DB version is NOT actual"); + SDL_INFO("DB version is NOT actual"); if (!backup_->RefreshDB()) { - LOGGER_ERROR(logger_, "RefreshDB() failed"); + SDL_ERROR("RefreshDB() failed"); return false; } backup_->UpdateDBVersion(); @@ -1279,14 +1262,13 @@ bool CacheManager::Init(const std::string& file_name, } } break; case InitResult::SUCCESS: { - LOGGER_INFO(logger_, "Policy Table was inited successfully"); + SDL_INFO("Policy Table was inited successfully"); result = LoadFromFile(file_name, *pt_); utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); - LOGGER_DEBUG(logger_, - "Check if snapshot is valid: " << std::boolalpha << result); + SDL_DEBUG("Check if snapshot is valid: " << std::boolalpha << result); if (!result) { rpc::ValidationReport report("policy_table"); snapshot->ReportErrors(&report); @@ -1298,7 +1280,7 @@ bool CacheManager::Init(const std::string& file_name, } break; default: { result = false; - LOGGER_ERROR(logger_, "Failed to init policy table."); + SDL_ERROR("Failed to init policy table."); } break; } @@ -1320,34 +1302,33 @@ bool CacheManager::LoadFromBackup() { bool CacheManager::LoadFromFile(const std::string& file_name, policy_table::Table& table) { using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); BinaryMessage json_string; if (!file_system::ReadBinaryFile(file_name, json_string)) { - LOGGER_FATAL(logger_, "Failed to read pt file."); + SDL_FATAL("Failed to read pt file."); return false; } std::string json(json_string.begin(), json_string.end()); JsonValue::ParseResult parse_result = JsonValue::Parse(json); if (!parse_result.second) { - LOGGER_FATAL(logger_, "Preloaded PT is corrupted."); + SDL_FATAL("Preloaded PT is corrupted."); return false; } const JsonValue& value = parse_result.first; - LOGGER_TRACE(logger_, "Start create PT"); + SDL_TRACE("Start create PT"); sync_primitives::AutoLock locker(cache_lock_); table = policy_table::Table(value); - LOGGER_DEBUG(logger_, "PT out:"); - LOGGER_DEBUG(logger_, table.ToJsonValue().ToJson()); + SDL_DEBUG("PT out:"); + SDL_DEBUG(table.ToJsonValue().ToJson()); if (!table.is_valid()) { rpc::ValidationReport report("policy_table"); table.ReportErrors(&report); - LOGGER_FATAL(logger_, - "Parsed table is not valid " << rpc::PrettyFormat(report)); + SDL_FATAL("Parsed table is not valid " << rpc::PrettyFormat(report)); return false; } return true; @@ -1387,13 +1368,12 @@ int32_t CacheManager::GenerateHash(const std::string& str_to_hash) { void CacheManager::GetAppRequestTypes( const std::string& policy_app_id, std::vector<std::string>& request_types) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); policy_table::ApplicationPolicies::iterator policy_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { - LOGGER_DEBUG(logger_, - "Can't find request types for app_id " << policy_app_id); + SDL_DEBUG("Can't find request types for app_id " << policy_app_id); return; } policy_table::RequestTypes::iterator it_request_type = @@ -1414,10 +1394,10 @@ std::string CacheManager::GetCertificate() const { } void CacheManager::MergePreloadPT(const std::string& file_name) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); policy_table::Table table; if (!LoadFromFile(file_name, table)) { - LOGGER_DEBUG(logger_, "Unable to load preloaded PT."); + SDL_DEBUG("Unable to load preloaded PT."); return; } @@ -1437,7 +1417,7 @@ void CacheManager::MergePreloadPT(const std::string& file_name) { void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); policy_table::ModuleConfig copy(pt.module_config); pt.module_config = new_pt.module_config; @@ -1448,19 +1428,19 @@ void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt, void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); policy_table::FunctionalGroupings::const_iterator it = new_pt.functional_groupings.begin(); for (; it != new_pt.functional_groupings.end(); ++it) { - LOGGER_DEBUG(logger_, "Merge functional group: " << it->first); + SDL_DEBUG("Merge functional group: " << it->first); pt.functional_groupings[it->first] = it->second; } } void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); pt.app_policies_section.device = const_cast<policy_table::PolicyTable&>( new_pt).app_policies_section.device; @@ -1475,7 +1455,7 @@ void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (new_pt.consumer_friendly_messages.is_initialized()) { if (!pt.consumer_friendly_messages.is_initialized()) { pt.consumer_friendly_messages = new_pt.consumer_friendly_messages; @@ -1486,9 +1466,9 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, pt.consumer_friendly_messages->version = new_pt.consumer_friendly_messages->version; for (; it != new_pt.consumer_friendly_messages->messages->end(); ++it) { - LOGGER_DEBUG(logger_, "Merge CFM: " << it->first); + SDL_DEBUG("Merge CFM: " << it->first); if (!(pt.consumer_friendly_messages->messages.is_initialized())) { - LOGGER_DEBUG(logger_, "CFM not initialized."); + SDL_DEBUG("CFM not initialized."); } (*pt.consumer_friendly_messages->messages)[it->first] = it->second; } @@ -1507,26 +1487,26 @@ CacheManager::BackgroundBackuper::BackgroundBackuper( : cache_manager_(cache_manager) , stop_flag_(false) , new_data_available_(false) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } CacheManager::BackgroundBackuper::~BackgroundBackuper() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } void CacheManager::BackgroundBackuper::InternalBackup() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(cache_manager_); while (new_data_available_) { new_data_available_ = false; - LOGGER_DEBUG(logger_, "DoBackup"); + SDL_DEBUG("DoBackup"); cache_manager_->PersistData(); } } void CacheManager::BackgroundBackuper::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(need_backup_lock_); while (!stop_flag_) { need_backup_lock_.Release(); @@ -1535,20 +1515,20 @@ void CacheManager::BackgroundBackuper::threadMain() { if (new_data_available_ || stop_flag_) { continue; } - LOGGER_DEBUG(logger_, "Wait for a next backup"); + SDL_DEBUG("Wait for a next backup"); backup_notifier_.Wait(need_backup_lock_); } } void CacheManager::BackgroundBackuper::exitThreadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(need_backup_lock_); stop_flag_ = true; backup_notifier_.NotifyOne(); } void CacheManager::BackgroundBackuper::DoBackup() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(need_backup_lock_); new_data_available_ = true; backup_notifier_.NotifyOne(); diff --git a/src/components/policy/src/policy_helper.cc b/src/components/policy/src/policy_helper.cc index 67d99c85ae..000f1e170d 100644 --- a/src/components/policy/src/policy_helper.cc +++ b/src/components/policy/src/policy_helper.cc @@ -47,7 +47,7 @@ namespace policy { namespace custom_str = utils::custom_string; namespace { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOGGER("Policy") bool Compare(const StringsValueType& first, const StringsValueType& second) { const std::string& first_str = first; @@ -232,7 +232,7 @@ std::vector<FunctionalGroupPermission> policy::CheckAppPolicy::GetRevokedGroups( FunctionalGroupNames groups_attributes; if (!pm_->cache_->GetFunctionalGroupNames(groups_attributes)) { - LOGGER_WARN(logger_, "Can't get functional group names"); + SDL_WARN("Can't get functional group names"); return std::vector<FunctionalGroupPermission>(); } @@ -275,8 +275,7 @@ void CheckAppPolicy::SendPermissionsToApp( const std::string device_id = pm_->GetCurrentDeviceId(app_id); if (device_id.empty()) { - LOGGER_WARN(logger_, - "Couldn't find device info for application id: " << app_id); + SDL_WARN("Couldn't find device info for application id: " << app_id); return; } std::vector<FunctionalGroupPermission> group_permissons; @@ -288,7 +287,7 @@ void CheckAppPolicy::SendPermissionsToApp( group_permissons, notification_data); - LOGGER_INFO(logger_, "Send notification for application_id: " << app_id); + SDL_INFO("Send notification for application_id: " << app_id); // Default_hmi is Ford-specific and should not be used with basic policy const std::string default_hmi; pm_->listener()->OnPermissionsUpdated(app_id, notification_data, default_hmi); @@ -296,7 +295,7 @@ void CheckAppPolicy::SendPermissionsToApp( bool CheckAppPolicy::IsAppRevoked( const AppPoliciesValueType& app_policy) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // Application params are not initialized = application revoked // i.e. "123":null return app_policy.second.is_null(); @@ -326,8 +325,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { const std::string app_id = app_policy.first; if (!IsKnownAppication(app_id)) { - LOGGER_WARN(logger_, - "Application:" << app_id << " is not present in snapshot."); + SDL_WARN("Application:" << app_id << " is not present in snapshot."); return true; } @@ -349,14 +347,11 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { NotifySystem(app_policy); } if (RESULT_NO_CHANGES == result) { - LOGGER_INFO(logger_, - "Permissions for application:" << app_id << " wasn't changed."); + SDL_INFO("Permissions for application:" << app_id << " wasn't changed."); return true; } - LOGGER_INFO(logger_, - "Permissions for application:" << app_id - << " have been changed."); + SDL_INFO("Permissions for application:" << app_id << " have been changed."); if (!IsPredefinedApp(app_policy) && RESULT_CONSENT_NOT_REQIURED != result) { SetPendingPermissions(app_policy, result); @@ -699,7 +694,7 @@ void FillFunctionalGroupPermissions( FunctionalGroupNames& names, GroupConsent state, std::vector<FunctionalGroupPermission>& permissions) { - LOGGER_INFO(logger_, "FillFunctionalGroupPermissions"); + SDL_INFO("FillFunctionalGroupPermissions"); FunctionalGroupIDs::const_iterator it = ids.begin(); FunctionalGroupIDs::const_iterator it_end = ids.end(); for (; it != it_end; ++it) { @@ -719,7 +714,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) { FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, const FunctionalGroupIDs& what) { - LOGGER_INFO(logger_, "Exclude same groups"); + SDL_INFO("Exclude same groups"); FunctionalGroupIDs from_copy(from); FunctionalGroupIDs what_copy(what); @@ -741,7 +736,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOGGER_INFO(logger_, "Merge groups"); + SDL_INFO("Merge groups"); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); @@ -763,7 +758,7 @@ FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOGGER_INFO(logger_, "Find same groups"); + SDL_INFO("Find same groups"); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); @@ -794,9 +789,9 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) { (*it).second = (*it_default).second; it->second.set_to_string(kDefaultId); } else { - LOGGER_ERROR(logger_, - "There is no default application policy was " - "found in PTU."); + SDL_ERROR( + "There is no default application policy was " + "found in PTU."); return false; } } diff --git a/src/components/policy/src/policy_manager_impl.cc b/src/components/policy/src/policy_manager_impl.cc index e6fdae7f20..765dcb82f8 100644 --- a/src/components/policy/src/policy_manager_impl.cc +++ b/src/components/policy/src/policy_manager_impl.cc @@ -57,7 +57,7 @@ policy::PolicyManager* CreateManager(const std::string& app_storage_folder, logger::Logger::Pimpl& logger #endif ) { - SET_LOGGER(logger); + SET_SDL_LOGGER(logger); return new policy::PolicyManagerImpl( app_storage_folder, attempts_to_open_policy_db, open_attempt_timeout_ms); } @@ -68,7 +68,7 @@ const uint32_t kDefaultRetryTimeoutInSec = 60u; namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOGGER("Policy") PolicyManagerImpl::PolicyManagerImpl(const std::string& app_storage_folder, uint16_t attempts_to_open_policy_db, @@ -131,14 +131,13 @@ utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray( #endif void PolicyManagerImpl::CheckTriggers() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const bool exceed_ignition_cycles = ExceededIgnitionCycles(); const bool exceed_days = ExceededDays(); - LOGGER_DEBUG(logger_, - "\nDays exceeded: " << std::boolalpha << exceed_days - << "\nIgnition cycles exceeded: " - << std::boolalpha << exceed_ignition_cycles); + SDL_DEBUG("\nDays exceeded: " << std::boolalpha << exceed_days + << "\nIgnition cycles exceeded: " + << std::boolalpha << exceed_ignition_cycles); if (exceed_ignition_cycles || exceed_days) { update_status_manager_.ScheduleUpdate(); @@ -147,7 +146,7 @@ void PolicyManagerImpl::CheckTriggers() { bool PolicyManagerImpl::LoadPT(const std::string& file, const BinaryMessage& pt_content) { - LOGGER_INFO(logger_, "LoadPT of size " << pt_content.size()); + SDL_INFO("LoadPT of size " << pt_content.size()); #ifdef USE_HMI_PTU_DECRYPTION // Assuemes Policy Table was parsed, formatted, and/or decrypted by @@ -160,7 +159,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, utils::SharedPtr<policy_table::Table> pt_update = ParseArray(pt_content); #endif if (!pt_update) { - LOGGER_WARN(logger_, "Parsed table pointer is 0."); + SDL_WARN("Parsed table pointer is 0."); update_status_manager_.OnWrongUpdateReceived(); return false; } @@ -177,7 +176,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, // Update finished, no need retry if (timer_retry_sequence_.is_running()) { - LOGGER_INFO(logger_, "Stop retry sequence"); + SDL_INFO("Stop retry sequence"); timer_retry_sequence_.Stop(); } @@ -188,7 +187,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, utils::SharedPtr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { - LOGGER_ERROR(logger_, "Failed to create snapshot of policy table"); + SDL_ERROR("Failed to create snapshot of policy table"); return false; } @@ -201,7 +200,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, // Replace current data with updated if (!cache_->ApplyUpdate(*pt_update)) { - LOGGER_WARN(logger_, "Unsuccessful save of updated policy table."); + SDL_WARN("Unsuccessful save of updated policy table."); return false; } @@ -213,10 +212,10 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, std::map<std::string, StringArray> app_hmi_types; cache_->GetHMIAppTypeAfterUpdate(app_hmi_types); if (!app_hmi_types.empty()) { - LOGGER_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType"); + SDL_INFO("app_hmi_types is full calling OnUpdateHMIAppType"); listener_->OnUpdateHMIAppType(app_hmi_types); } else { - LOGGER_INFO(logger_, "app_hmi_types empty" << pt_content.size()); + SDL_INFO("app_hmi_types empty" << pt_content.size()); } } @@ -234,7 +233,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, void PolicyManagerImpl::CheckPermissionsChanges( const utils::SharedPtr<policy_table::Table> pt_update, const utils::SharedPtr<policy_table::Table> snapshot) { - LOGGER_INFO(logger_, "Checking incoming permissions."); + SDL_INFO("Checking incoming permissions."); // Replace predefined policies with its actual setting, e.g. "123":"default" // to actual values of default section @@ -250,23 +249,23 @@ void PolicyManagerImpl::PrepareNotificationData( const policy_table::Strings& group_names, const std::vector<FunctionalGroupPermission>& group_permission, Permissions& notification_data) { - LOGGER_INFO(logger_, "Preparing data for notification."); + SDL_INFO("Preparing data for notification."); ProcessFunctionalGroup processor(groups, group_permission, notification_data); std::for_each(group_names.begin(), group_names.end(), processor); } void PolicyManagerImpl::GetServiceUrls(const std::string& service_type, EndpointUrls& end_points) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); cache_->GetServiceUrls(service_type, end_points); } bool PolicyManagerImpl::RequestPTUpdate() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::SharedPtr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { - LOGGER_ERROR(logger_, "Failed to create snapshot of policy table"); + SDL_ERROR("Failed to create snapshot of policy table"); return false; } @@ -275,7 +274,7 @@ bool PolicyManagerImpl::RequestPTUpdate() { const std::string message_string = policy_table_snapshot->ToJsonValue().ToJson(false); - LOGGER_DEBUG(logger_, "Snapshot contents is : " << message_string); + SDL_DEBUG("Snapshot contents is : " << message_string); BinaryMessage update(message_string.begin(), message_string.end()); @@ -293,23 +292,23 @@ std::string PolicyManagerImpl::GetLockScreenIconUrl() const { } void PolicyManagerImpl::StartPTExchange() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const bool update_required = update_status_manager_.IsUpdateRequired(); if (update_status_manager_.IsAppsSearchInProgress() && update_required) { update_status_manager_.ScheduleUpdate(); - LOGGER_INFO(logger_, - "Starting exchange skipped, since applications " - "search is in progress."); + SDL_INFO( + "Starting exchange skipped, since applications " + "search is in progress."); return; } if (update_status_manager_.IsUpdatePending() && update_required) { update_status_manager_.ScheduleUpdate(); - LOGGER_INFO(logger_, - "Starting exchange skipped, since another exchange " - "is in progress."); + SDL_INFO( + "Starting exchange skipped, since another exchange " + "is in progress."); return; } @@ -329,12 +328,12 @@ void PolicyManagerImpl::StartPTExchange() { } void PolicyManagerImpl::OnAppsSearchStarted() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); update_status_manager_.OnAppsSearchStarted(); } void PolicyManagerImpl::OnAppsSearchCompleted() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); update_status_manager_.OnAppsSearchCompleted(); if (update_status_manager_.IsUpdateRequired()) { StartPTExchange(); @@ -363,9 +362,8 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id, const PTString& rpc, const RPCParams& rpc_params, CheckPermissionResult& result) { - LOGGER_INFO(logger_, - "CheckPermissions for " << app_id << " and rpc " << rpc << " for " - << hmi_level << " level."); + SDL_INFO("CheckPermissions for " << app_id << " and rpc " << rpc << " for " + << hmi_level << " level."); cache_->CheckPermissions(app_id, hmi_level, rpc, result); } @@ -378,12 +376,13 @@ bool PolicyManagerImpl::ResetUserConsent() { void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( const std::string& application_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const std::string device_id = GetCurrentDeviceId(application_id); if (device_id.empty()) { - LOGGER_WARN(logger_, - "Couldn't find device info for application id " - "'" << application_id << "'"); + SDL_WARN( + "Couldn't find device info for application id " + "'" + << application_id << "'"); return; } @@ -408,8 +407,7 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( app_group_permissions, notification_data); - LOGGER_INFO(logger_, - "Send notification for application_id:" << application_id); + SDL_INFO("Send notification for application_id:" << application_id); std::string default_hmi; default_hmi = "NONE"; @@ -419,28 +417,28 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( } bool PolicyManagerImpl::CleanupUnpairedDevices() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // For SDL-specific it doesn't matter return true; } DeviceConsent PolicyManagerImpl::GetUserConsentForDevice( const std::string& device_id) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return kDeviceAllowed; } void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id, bool is_allowed) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Device :" << device_id); + SDL_AUTO_TRACE(); + SDL_DEBUG("Device :" << device_id); DeviceConsent current_consent = GetUserConsentForDevice(device_id); bool is_current_device_allowed = DeviceConsent::kDeviceAllowed == current_consent ? true : false; if (DeviceConsent::kDeviceHasNoConsent != current_consent && is_current_device_allowed == is_allowed) { const std::string consent = is_allowed ? "allowed" : "disallowed"; - LOGGER_INFO(logger_, "Device is already " << consent << "."); + SDL_INFO("Device is already " << consent << "."); return; } } @@ -453,7 +451,7 @@ bool PolicyManagerImpl::ReactOnUserDevConsentForApp(const std::string app_id, bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, StringArray* nicknames, StringArray* app_hmi_types) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const bool result = nicknames && app_hmi_types; if (result) { cache_->GetInitialAppData(application_id, *nicknames, *app_hmi_types); @@ -463,14 +461,14 @@ bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, void PolicyManagerImpl::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOGGER_INFO(logger_, "SetDeviceInfo"); - LOGGER_DEBUG(logger_, "Device :" << device_id); + SDL_INFO("SetDeviceInfo"); + SDL_DEBUG("Device :" << device_id); } void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id, const DeviceInfo& device_info) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Device :" << device_id); + SDL_AUTO_TRACE(); + SDL_DEBUG("Device :" << device_id); } PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent( @@ -510,20 +508,17 @@ PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent( void PolicyManagerImpl::CheckPendingPermissionsChanges( const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& current_permissions) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(app_permissions_diff_lock_); std::map<std::string, AppPermissions>::iterator it_pending = app_permissions_diff_.find(policy_app_id); if (app_permissions_diff_.end() == it_pending) { - LOGGER_WARN( - logger_, + SDL_WARN( "No pending permissions had been found for appID: " << policy_app_id); return; } - LOGGER_DEBUG( - logger_, - "Pending permissions had been found for appID: " << policy_app_id); + SDL_DEBUG("Pending permissions had been found for appID: " << policy_app_id); // Change appPermissionsConsentNeeded depending on unconsented groups // presence @@ -534,16 +529,14 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges( for (; it_groups != it_end_groups; ++it_groups) { if (policy::kGroupUndefined == it_groups->state) { - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "Unconsented groups still present for appID: " << policy_app_id); it_pending->second.appPermissionsConsentNeeded = true; return; } } - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "Unconsented groups not present anymore for appID: " << policy_app_id); it_pending->second.appPermissionsConsentNeeded = false; return; @@ -551,12 +544,12 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges( void PolicyManagerImpl::SetUserConsentForApp( const PermissionConsent& permissions) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } bool PolicyManagerImpl::GetDefaultHmi(const std::string& policy_app_id, std::string* default_hmi) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const std::string device_id = GetCurrentDeviceId(policy_app_id); DeviceConsent device_consent = GetUserConsentForDevice(device_id); const std::string app_id = policy::kDeviceAllowed != device_consent @@ -567,9 +560,9 @@ bool PolicyManagerImpl::GetDefaultHmi(const std::string& policy_app_id, bool PolicyManagerImpl::GetPriority(const std::string& policy_app_id, std::string* priority) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!priority) { - LOGGER_WARN(logger_, "Input priority parameter is null."); + SDL_WARN("Input priority parameter is null."); return false; } @@ -585,12 +578,11 @@ void PolicyManagerImpl::GetUserConsentForApp( const std::string& device_id, const std::string& policy_app_id, std::vector<FunctionalGroupPermission>& permissions) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); FunctionalIdType group_types; if (!cache_->GetPermissionsForApp(device_id, policy_app_id, group_types)) { - LOGGER_WARN(logger_, - "Can't get user permissions for app " << policy_app_id); + SDL_WARN("Can't get user permissions for app " << policy_app_id); return; } @@ -598,7 +590,7 @@ void PolicyManagerImpl::GetUserConsentForApp( // automatically allowed and it could not be changed by user FunctionalGroupNames group_names; if (!cache_->GetFunctionalGroupNames(group_names)) { - LOGGER_WARN(logger_, "Can't get functional group names"); + SDL_WARN("Can't get functional group names"); return; } @@ -633,7 +625,7 @@ void PolicyManagerImpl::GetPermissionsForApp( const std::string& device_id, const std::string& policy_app_id, std::vector<FunctionalGroupPermission>& permissions) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::string app_id_to_check = policy_app_id; bool allowed_by_default = false; @@ -648,8 +640,7 @@ void PolicyManagerImpl::GetPermissionsForApp( FunctionalIdType group_types; if (!cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types)) { - LOGGER_WARN(logger_, - "Can't get user permissions for app " << policy_app_id); + SDL_WARN("Can't get user permissions for app " << policy_app_id); return; } @@ -657,14 +648,14 @@ void PolicyManagerImpl::GetPermissionsForApp( // automatically allowed and it could not be changed by user FunctionalGroupNames group_names; if (!cache_->GetFunctionalGroupNames(group_names)) { - LOGGER_WARN(logger_, "Can't get functional group names"); + SDL_WARN("Can't get functional group names"); return; } // The "default" and "pre_DataConsent" are auto-allowed groups // So, check if application in the one of these mode. if (allowed_by_default) { - LOGGER_INFO(logger_, "Get auto allowed groups"); + SDL_INFO("Get auto allowed groups"); GroupType type = (kDefaultId == app_id_to_check ? kTypeDefault : kTypePreDataConsented); @@ -687,7 +678,7 @@ void PolicyManagerImpl::GetPermissionsForApp( std::string& PolicyManagerImpl::GetCurrentDeviceId( const std::string& policy_app_id) const { - LOGGER_INFO(logger_, "GetDeviceInfo"); + SDL_INFO("GetDeviceInfo"); last_device_id_ = listener()->OnCurrentDeviceIdUpdateRequired(policy_app_id); return last_device_id_; } @@ -697,7 +688,7 @@ void PolicyManagerImpl::SetSystemLanguage(const std::string& language) {} void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } void PolicyManagerImpl::OnSystemReady() { @@ -710,7 +701,7 @@ void PolicyManagerImpl::OnSystemReady() { uint32_t PolicyManagerImpl::GetNotificationsNumber( const std::string& priority) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return cache_->GetNotificationsNumber(priority); } @@ -723,10 +714,10 @@ bool PolicyManagerImpl::IsPTValid( policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { - LOGGER_ERROR(logger_, "Policy table is not valid."); + SDL_ERROR("Policy table is not valid."); rpc::ValidationReport report("policy_table"); policy_table->ReportErrors(&report); - LOGGER_DEBUG(logger_, "Errors: " << rpc::PrettyFormat(report)); + SDL_DEBUG("Errors: " << rpc::PrettyFormat(report)); return false; } return true; @@ -738,7 +729,7 @@ const PolicySettings& PolicyManagerImpl::get_settings() const { } bool PolicyManagerImpl::ExceededDays() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); TimevalStruct current_time = date_time::DateTime::getCurrentTime(); const int kSecondsInDay = 60 * 60 * 24; @@ -748,9 +739,9 @@ bool PolicyManagerImpl::ExceededDays() { } void PolicyManagerImpl::KmsChanged(int kilometers) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (0 == cache_->KilometersBeforeExchange(kilometers)) { - LOGGER_INFO(logger_, "Enough kilometers passed to send for PT update."); + SDL_INFO("Enough kilometers passed to send for PT update."); update_status_manager_.ScheduleUpdate(); StartPTExchange(); } @@ -772,7 +763,7 @@ std::string PolicyManagerImpl::GetPolicyTableStatus() const { uint32_t PolicyManagerImpl::NextRetryTimeout() { sync_primitives::AutoLock auto_lock(retry_sequence_lock_); - LOGGER_DEBUG(logger_, "Index: " << retry_sequence_index_); + SDL_DEBUG("Index: " << retry_sequence_index_); uint32_t next = 0u; if (retry_sequence_seconds_.empty() || retry_sequence_index_ >= retry_sequence_seconds_.size()) { @@ -819,40 +810,39 @@ void PolicyManagerImpl::OnExceededTimeout() { void PolicyManagerImpl::OnUpdateStarted() { int update_timeout = TimeoutExchange(); - LOGGER_DEBUG(logger_, - "Update timeout will be set to (sec): " << update_timeout); + SDL_DEBUG("Update timeout will be set to (sec): " << update_timeout); update_status_manager_.OnUpdateSentOut(update_timeout); cache_->SaveUpdateRequired(true); } void PolicyManagerImpl::PTUpdatedAt(Counters counter, int value) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); cache_->SetCountersPassedForSuccessfulUpdate(counter, value); cache_->ResetIgnitionCycles(); } void PolicyManagerImpl::Increment(usage_statistics::GlobalCounterId type) { - LOGGER_INFO(logger_, "Increment without app id"); + SDL_INFO("Increment without app id"); cache_->Increment(type); } void PolicyManagerImpl::Increment(const std::string& app_id, usage_statistics::AppCounterId type) { - LOGGER_DEBUG(logger_, "Increment " << app_id << " AppCounter: " << type); + SDL_DEBUG("Increment " << app_id << " AppCounter: " << type); cache_->Increment(app_id, type); } void PolicyManagerImpl::Set(const std::string& app_id, usage_statistics::AppInfoId type, const std::string& value) { - LOGGER_INFO(logger_, "Set " << app_id); + SDL_INFO("Set " << app_id); cache_->Set(app_id, type, value); } void PolicyManagerImpl::Add(const std::string& app_id, usage_statistics::AppStopwatchId type, int32_t timespan_seconds) { - LOGGER_INFO(logger_, "Add " << app_id); + SDL_INFO("Add " << app_id); cache_->Add(app_id, type, timespan_seconds); } @@ -861,7 +851,7 @@ bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const { } bool PolicyManagerImpl::IsConsentNeeded(const std::string& app_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return false; } @@ -898,12 +888,12 @@ bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) const { void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) {} std::string PolicyManagerImpl::RetrieveCertificate() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return cache_->GetCertificate(); } void PolicyManagerImpl::AddApplication(const std::string& application_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const std::string device_id = GetCurrentDeviceId(application_id); DeviceConsent device_consent = GetUserConsentForDevice(device_id); sync_primitives::AutoLock lock(apps_registration_lock_); @@ -922,13 +912,13 @@ void PolicyManagerImpl::RemoveAppConsentForGroup( } bool PolicyManagerImpl::IsPredataPolicy(const std::string& policy_app_id) { - LOGGER_INFO(logger_, "IsPredataApp"); + SDL_INFO("IsPredataApp"); return cache_->IsPredataPolicy(policy_app_id); } void PolicyManagerImpl::AddNewApplication(const std::string& application_id, DeviceConsent device_consent) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); cache_->SetDefaultPolicy(application_id); } @@ -958,19 +948,17 @@ bool PolicyManagerImpl::ResetPT(const std::string& file_name) { } bool PolicyManagerImpl::CheckAppStorageFolder() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const std::string app_storage_folder = get_settings().app_storage_folder(); - LOGGER_DEBUG(logger_, "AppStorageFolder " << app_storage_folder); + SDL_DEBUG("AppStorageFolder " << app_storage_folder); if (!file_system::DirectoryExists(app_storage_folder)) { - LOGGER_WARN(logger_, - "Storage directory doesn't exist " << app_storage_folder); + SDL_WARN("Storage directory doesn't exist " << app_storage_folder); return false; } if (!(file_system::IsWritingAllowed(app_storage_folder) && file_system::IsReadingAllowed(app_storage_folder))) { - LOGGER_WARN(logger_, - "Storage directory doesn't have read/write permissions " - << app_storage_folder); + SDL_WARN("Storage directory doesn't have read/write permissions " + << app_storage_folder); return false; } return true; @@ -978,10 +966,10 @@ bool PolicyManagerImpl::CheckAppStorageFolder() const { bool PolicyManagerImpl::InitPT(const std::string& file_name, const PolicySettings* settings) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); settings_ = settings; if (!CheckAppStorageFolder()) { - LOGGER_ERROR(logger_, "Can not read/write into AppStorageFolder"); + SDL_ERROR("Can not read/write into AppStorageFolder"); return false; } const bool ret = cache_->Init(file_name, settings); @@ -1006,7 +994,7 @@ void PolicyManagerImpl::set_cache_manager( } void PolicyManagerImpl::RetrySequence() { - LOGGER_INFO(logger_, "Start new retry sequence"); + SDL_INFO("Start new retry sequence"); RequestPTUpdate(); uint32_t timeout = NextRetryTimeout(); diff --git a/src/components/policy/src/policy_table.cc b/src/components/policy/src/policy_table.cc index a590d937ca..207effceff 100644 --- a/src/components/policy/src/policy_table.cc +++ b/src/components/policy/src/policy_table.cc @@ -38,7 +38,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOGGER("Policy") PolicyTable::PolicyTable(const std::string& app_storage_folder, uint16_t attempts_to_open_policy_db, @@ -51,7 +51,7 @@ PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { - LOGGER_INFO(logger_, "Destroying policy table."); + SDL_INFO("Destroying policy table."); } } // namespace policy diff --git a/src/components/policy/src/policy_table/validation.cc b/src/components/policy/src/policy_table/validation.cc index 04ed1cb1d0..31929b1bd5 100644 --- a/src/components/policy/src/policy_table/validation.cc +++ b/src/components/policy/src/policy_table/validation.cc @@ -12,7 +12,7 @@ bool IsTypeInvalid( namespace rpc { namespace policy_table_interface_base { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOGGER("Policy") void RemoveInvalidTypes(RequestTypes& types) { types.erase(std::remove_if(types.begin(), types.end(), &IsTypeInvalid), @@ -30,13 +30,13 @@ bool ApplicationPoliciesSection::Validate() const { // Default and PreData policies are mandatory if (apps.end() == it_default_policy || apps.end() == it_pre_data_policy) { - LOGGER_ERROR(logger_, "Default or preData policy is not present."); + SDL_ERROR("Default or preData policy is not present."); return false; } // Device policy is mandatory if (!device.is_initialized()) { - LOGGER_ERROR(logger_, "Device policy is not present."); + SDL_ERROR("Device policy is not present."); return false; } @@ -46,16 +46,13 @@ bool ApplicationPoliciesSection::Validate() const { } if (!it_default_policy->second.RequestType.is_valid()) { - LOGGER_WARN(logger_, - "Default policy RequestTypes are not valid. Will be cleaned."); + SDL_WARN("Default policy RequestTypes are not valid. Will be cleaned."); RemoveInvalidTypes(*it_default_policy->second.RequestType); // If preloaded does not have valid default types - validation fails // Otherwise default will be empty, i.e. all types allowed if (PT_PRELOADED == pt_type) { if (it_default_policy->second.RequestType->empty()) { - LOGGER_ERROR( - logger_, - "Default policy RequestTypes empty after clean-up. Exiting."); + SDL_ERROR("Default policy RequestTypes empty after clean-up. Exiting."); return false; } } @@ -72,40 +69,36 @@ bool ApplicationPoliciesSection::Validate() const { if (PT_PRELOADED == pt_type) { if (!is_request_type_valid) { - LOGGER_WARN(logger_, - "App policy RequestTypes are not valid. Will be cleaned."); + SDL_WARN("App policy RequestTypes are not valid. Will be cleaned."); RemoveInvalidTypes(*app_params.RequestType); if (app_params.RequestType->empty()) { - LOGGER_ERROR( - logger_, - "App policy RequestTypes empty after clean-up. Exiting."); + SDL_ERROR("App policy RequestTypes empty after clean-up. Exiting."); return false; } } } else { if (is_request_type_ommited) { - LOGGER_WARN(logger_, - "App policy RequestTypes ommited." - " Will be replaced with default."); + SDL_WARN( + "App policy RequestTypes ommited." + " Will be replaced with default."); app_params.RequestType = apps[kDefaultApp].RequestType; ++iter; continue; } if (!is_request_type_valid) { - LOGGER_WARN(logger_, - "App policy RequestTypes are invalid. Will be cleaned."); + SDL_WARN("App policy RequestTypes are invalid. Will be cleaned."); RemoveInvalidTypes(*app_params.RequestType); if (app_params.RequestType->empty()) { - LOGGER_WARN(logger_, - "App policy RequestTypes empty after clean-up." - " Will be replaced with default."); + SDL_WARN( + "App policy RequestTypes empty after clean-up." + " Will be replaced with default."); app_params.RequestType = apps[kDefaultApp].RequestType; ++iter; continue; } } if (is_request_type_empty) { - LOGGER_WARN(logger_, "App policy RequestTypes empty."); + SDL_WARN("App policy RequestTypes empty."); } } ++iter; diff --git a/src/components/policy/src/sql_pt_ext_representation.cc b/src/components/policy/src/sql_pt_ext_representation.cc index 5de625312e..fb763fd6ee 100644 --- a/src/components/policy/src/sql_pt_ext_representation.cc +++ b/src/components/policy/src/sql_pt_ext_representation.cc @@ -41,7 +41,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOGGER("Policy") bool SQLPTExtRepresentation::CanAppKeepContext(const std::string& app_id) { utils::dbms::SQLQuery query(db()); @@ -72,7 +72,7 @@ bool SQLPTExtRepresentation::ResetUserConsent() { bool SQLPTExtRepresentation::ResetDeviceConsents() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kResetDeviceConsents)) { - LOGGER_WARN(logger_, "Incorrect delete statement from device_consents."); + SDL_WARN("Incorrect delete statement from device_consents."); return false; } return query.Exec(); @@ -86,10 +86,10 @@ bool SQLPTExtRepresentation::GetUserPermissionsForDevice( const std::string& device_id, StringArray* consented_groups, StringArray* disallowed_groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) { - LOGGER_WARN(logger_, "Incorrect select from device consented groups"); + SDL_WARN("Incorrect select from device consented groups"); return false; } query.Bind(0, device_id); @@ -114,9 +114,9 @@ bool SQLPTExtRepresentation::GetPermissionsForApp( const std::string& device_id, const std::string& policy_app_id, FunctionalIdType* group_types) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!group_types) { - LOGGER_WARN(logger_, "Input parameter for group types is null."); + SDL_WARN("Input parameter for group types is null."); return false; } // Get all app groups for specified device and application @@ -167,7 +167,7 @@ bool SQLPTExtRepresentation::GetPermissionsForApp( bool SQLPTExtRepresentation::GetDeviceGroupsFromPolicies( policy_table::Strings* groups, policy_table::Strings* preconsented_groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (groups) { GatherAppGroup(kDeviceId, groups); } @@ -185,17 +185,17 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery count_query(db()); if (!count_query.Prepare(sql_pt_ext::kCountDevice)) { - LOGGER_WARN(logger_, "Incorrect statement for count of device."); + SDL_WARN("Incorrect statement for count of device."); return false; } count_query.Bind(0, device_id); if (!count_query.Exec()) { - LOGGER_WARN(logger_, "Incorrect count of device."); + SDL_WARN("Incorrect count of device."); return false; } @@ -205,7 +205,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, if (update) { utils::dbms::SQLQuery update_query(db()); if (!update_query.Prepare(sql_pt_ext::kUpdateDevice)) { - LOGGER_WARN(logger_, "Incorrect statement for udpate device."); + SDL_WARN("Incorrect statement for udpate device."); return false; } @@ -219,7 +219,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, update_query.Bind(7, connection_type); if (!update_query.Exec() || !update_query.Reset()) { - LOGGER_WARN(logger_, "Incorrect update for device."); + SDL_WARN("Incorrect update for device."); return false; } @@ -229,7 +229,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, // Insert new data utils::dbms::SQLQuery insert_query(db()); if (!insert_query.Prepare(sql_pt_ext::kInsertDevice)) { - LOGGER_WARN(logger_, "Incorrect insert statement for device."); + SDL_WARN("Incorrect insert statement for device."); return false; } @@ -243,7 +243,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, insert_query.Bind(7, connection_type); if (!insert_query.Exec() || !insert_query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert to device."); + SDL_WARN("Incorrect insert to device."); return false; } @@ -256,17 +256,17 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( const std::string& device_id, const StringArray& consented_groups, const StringArray& disallowed_groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery count_query(db()); if (!count_query.Prepare(sql_pt_ext::kCountDeviceConsentGroup)) { - LOGGER_WARN(logger_, "Incorrect count of device consented groups"); + SDL_WARN("Incorrect count of device consented groups"); return false; } count_query.Bind(0, device_id); if (!count_query.Exec()) { - LOGGER_WARN(logger_, "Failed count of device consented groups"); + SDL_WARN("Failed count of device consented groups"); return false; } @@ -277,9 +277,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( // Update old values if (update) { if (!query.Prepare(sql_pt_ext::kUpdateDeviceConsentedGroup)) { - LOGGER_WARN( - logger_, - "Incorrect statement for updating consented groups on device"); + SDL_WARN("Incorrect statement for updating consented groups on device"); return false; } @@ -294,8 +292,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( query.Bind(3, *it_consented_groups); // TODO(AOleynik): Get this info from external data if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, - "Failed update of device allowed consented groups."); + SDL_WARN("Failed update of device allowed consented groups."); return false; } } @@ -311,8 +308,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( query.Bind(2, device_id); query.Bind(3, *it_disallowed_groups); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, - "Failed update of device disallowed consented groups."); + SDL_WARN("Failed update of device disallowed consented groups."); return false; } } @@ -322,8 +318,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( // Insert new values if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) { - LOGGER_WARN(logger_, - "Incorrect statement of inserting to device consented groups"); + SDL_WARN("Incorrect statement of inserting to device consented groups"); return false; } @@ -337,7 +332,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( // TODO(AOleynik): Get this info from external data query.Bind(3, std::string("GUI")); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Failed insert to device allowed consented groups."); + SDL_WARN("Failed insert to device allowed consented groups."); return false; } } @@ -352,8 +347,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( query.Bind(2, false); query.Bind(3); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, - "Failed insert to device disallowed consented groups."); + SDL_WARN("Failed insert to device disallowed consented groups."); return false; } } @@ -371,15 +365,13 @@ bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp( if (IsPredataPolicy(app_id)) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kHasAppPreloadedGroups)) { - LOGGER_WARN(logger_, - "Incorrect statement for has app preloaded groups"); + SDL_WARN("Incorrect statement for has app preloaded groups"); return false; } query.Bind(0, app_id); query.Bind(1, kPreDataConsentId); if (!query.Exec()) { - LOGGER_WARN(logger_, - "Incorrect select for app has predataconsted groups"); + SDL_WARN("Incorrect select for app has predataconsted groups"); return false; } if (query.GetInteger(0) > 0) { @@ -403,7 +395,7 @@ bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp( bool SQLPTExtRepresentation::SetUserPermissionsForApp( const PermissionConsent& permissions) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO(AOleynik): Handle situation, when no application was specified, i.e. // general permissions were set std::vector<FunctionalGroupPermission>::const_iterator it = @@ -415,7 +407,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( for (; it != it_end; ++it) { utils::dbms::SQLQuery counter(db()); if (!counter.Prepare(sql_pt_ext::kCountAppConsents)) { - LOGGER_WARN(logger_, "Incorrect statement for consent group count."); + SDL_WARN("Incorrect statement for consent group count."); return false; } @@ -423,7 +415,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( counter.Bind(1, permissions.policy_app_id); counter.Bind(2, static_cast<int>((*it).group_id)); if (!counter.Exec()) { - LOGGER_WARN(logger_, "Incorrent count on consent groups."); + SDL_WARN("Incorrent count on consent groups."); return false; } @@ -432,7 +424,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( // Update already present consent record if (update_required) { if (!query.Prepare(sql_pt_ext::kUpdateGroupPermissions)) { - LOGGER_WARN(logger_, "Incorrect statement for update consent groups."); + SDL_WARN("Incorrect statement for update consent groups."); return false; } @@ -447,9 +439,9 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( query.Bind(4, permissions.device_id); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, - "Incorrect update on user defined permissions " - "for app groups."); + SDL_WARN( + "Incorrect update on user defined permissions " + "for app groups."); return false; } continue; @@ -457,8 +449,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( // Insert new consent record if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) { - LOGGER_WARN(logger_, - "Incorrect statement for update app group permissions."); + SDL_WARN("Incorrect statement for update app group permissions."); return false; } @@ -473,9 +464,9 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( query.Bind(4, permissions.consent_source); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, - "Incorrect insert to user defined permissions " - "for app groups."); + SDL_WARN( + "Incorrect insert to user defined permissions " + "for app groups."); return false; } continue; @@ -488,7 +479,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( utils::dbms::SQLQuery query(db()); std::vector<UserFriendlyMessage> result; if (!query.Prepare(sql_pt_ext::kSelectFriendlyMsg)) { - LOGGER_WARN(logger_, "Incorrect statement for select friendly messages."); + SDL_WARN("Incorrect statement for select friendly messages."); return result; } @@ -506,7 +497,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( query.Bind(1, msg_language); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect select from friendly messages."); + SDL_WARN("Incorrect select from friendly messages."); return result; } @@ -522,9 +513,9 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( result.push_back(msg); if (!query.Reset()) { - LOGGER_WARN(logger_, - "Failed reset statement for selecting friendly " - "messages."); + SDL_WARN( + "Failed reset statement for selecting friendly " + "messages."); return result; } } @@ -535,7 +526,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages( policy_table::ConsumerFriendlyMessages* messages) const { if (NULL == messages) { - LOGGER_ERROR(logger_, "NULL pointer has been passed to fill"); + SDL_ERROR("NULL pointer has been passed to fill"); return false; } @@ -571,7 +562,7 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages( msg.text_body; } } else { - LOGGER_WARN(logger_, "Incorrect statement for select friendly messages."); + SDL_WARN("Incorrect statement for select friendly messages."); } return result; } @@ -579,10 +570,10 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages( bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateMetaParams)) { - LOGGER_WARN(logger_, "Incorrect statement for insert to module meta."); + SDL_WARN("Incorrect statement for insert to module meta."); return false; } @@ -591,22 +582,22 @@ bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version, query.Bind(2, language); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert to module meta."); + SDL_WARN("Incorrect insert to module meta."); return false; } return true; } bool SQLPTExtRepresentation::IsMetaInfoPresent() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectMetaParams)) { - LOGGER_WARN(logger_, "Incorrect statement for selecting meta info."); + SDL_WARN("Incorrect statement for selecting meta info."); return false; } if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect select from module meta."); + SDL_WARN("Incorrect select from module meta."); return false; } @@ -614,17 +605,17 @@ bool SQLPTExtRepresentation::IsMetaInfoPresent() { } bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateMetaLanguage)) { - LOGGER_WARN(logger_, "Incorrect statement for update meta language."); + SDL_WARN("Incorrect statement for update meta language."); return false; } query.Bind(0, language); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect update for meta language."); + SDL_WARN("Incorrect update for meta language."); return false; } @@ -633,26 +624,26 @@ bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) { bool SQLPTExtRepresentation::SaveApplicationPoliciesSection( const policy_table::ApplicationPoliciesSection& policies) { - LOGGER_INFO(logger_, "SaveApplicationPolicies ext"); + SDL_INFO("SaveApplicationPolicies ext"); utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) { - LOGGER_WARN(logger_, "Incorrect delete from app_group."); + SDL_WARN("Incorrect delete from app_group."); return false; } utils::dbms::SQLQuery query_delete_preconsented(db()); if (!query_delete_preconsented.Exec(sql_pt_ext::kDeletePreconsentedGroups)) { - LOGGER_WARN(logger_, "Incorrect delete from preconsented_group."); + SDL_WARN("Incorrect delete from preconsented_group."); return false; } if (!query_delete.Exec(sql_pt::kDeleteApplication)) { - LOGGER_WARN(logger_, "Incorrect delete from application."); + SDL_WARN("Incorrect delete from application."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestType)) { - LOGGER_WARN(logger_, "Incorrect delete from request type."); + SDL_WARN("Incorrect delete from request type."); return false; } @@ -720,7 +711,7 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy( utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) { - LOGGER_WARN(logger_, "Incorrect insert statement into application."); + SDL_WARN("Incorrect insert statement into application."); return false; } @@ -739,7 +730,7 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy( : app_query.Bind(8, std::string()); if (!app_query.Exec() || !app_query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into application."); + SDL_WARN("Incorrect insert into application."); return false; } @@ -766,8 +757,7 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy( const policy_table::DevicePolicy& device) { dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) { - LOGGER_WARN(logger_, - "Incorrect insert statement into application (device)."); + SDL_WARN("Incorrect insert statement into application (device)."); return false; } app_query.Bind(0, kDeviceId); @@ -783,7 +773,7 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy( app_query.Bind(8, std::string()); if (!app_query.Exec() || !app_query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into application."); + SDL_WARN("Incorrect insert into application."); return false; } @@ -799,10 +789,10 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy( bool SQLPTExtRepresentation::GatherApplicationPoliciesSection( policy_table::ApplicationPoliciesSection* policies) const { - LOGGER_INFO(logger_, "Gather applications policies"); + SDL_INFO("Gather applications policies"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectAppPolicies)) { - LOGGER_WARN(logger_, "Incorrect select from app_policies"); + SDL_WARN("Incorrect select from app_policies"); return false; } @@ -872,7 +862,7 @@ void SQLPTExtRepresentation::GatherPreconsentedGroup( const std::string& app_id, policy_table::Strings* groups) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroups)) { - LOGGER_WARN(logger_, "Incorrect select from preconsented group"); + SDL_WARN("Incorrect select from preconsented group"); return; } @@ -884,10 +874,10 @@ void SQLPTExtRepresentation::GatherPreconsentedGroup( bool SQLPTExtRepresentation::GatherUsageAndErrorCounts( policy_table::UsageAndErrorCounts* counts) const { - LOGGER_INFO(logger_, "Gather Usage and Error Counts."); + SDL_INFO("Gather Usage and Error Counts."); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectUsageAndErrorCount) || !query.Exec()) { - LOGGER_INFO(logger_, "Failed select from user_and_error_count"); + SDL_INFO("Failed select from user_and_error_count"); return false; } @@ -902,9 +892,8 @@ bool SQLPTExtRepresentation::GatherAppLevels( policy_table::AppLevels* apps) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectAppLevels)) { - LOGGER_INFO(logger_, - "Failed select from app_level. SQLError = " - << query.LastError().text()); + SDL_INFO("Failed select from app_level. SQLError = " + << query.LastError().text()); return false; } while (query.Next()) { @@ -933,10 +922,10 @@ bool SQLPTExtRepresentation::GatherAppLevels( void SQLPTExtRepresentation::GatherDeviceData( policy_table::DeviceData* data) const { - LOGGER_INFO(logger_, "Gather device data."); + SDL_INFO("Gather device data."); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectDeviceData)) { - LOGGER_WARN(logger_, "Incorrect select statement for device data."); + SDL_WARN("Incorrect select statement for device data."); return; } data->mark_initialized(); @@ -958,12 +947,11 @@ void SQLPTExtRepresentation::GatherDeviceData( void SQLPTExtRepresentation::GatherConsentGroup( const std::string& device_id, policy_table::UserConsentRecords* records) const { - LOGGER_INFO(logger_, "Gather consent records."); + SDL_INFO("Gather consent records."); utils::dbms::SQLQuery query(db()); // Fill data for device if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) { - LOGGER_WARN(logger_, - "Incorrect select statement for device consented groups."); + SDL_WARN("Incorrect select statement for device consented groups."); return; } @@ -989,8 +977,7 @@ void SQLPTExtRepresentation::GatherConsentGroup( // Fill data for applications if (!query.Prepare(sql_pt_ext::kSelectConsentGroup)) { - LOGGER_WARN(logger_, - "Incorrect select statement for app consented groups."); + SDL_WARN("Incorrect select statement for app consented groups."); return; } @@ -1014,31 +1001,31 @@ void SQLPTExtRepresentation::GatherConsentGroup( bool SQLPTExtRepresentation::SaveDeviceData( const policy_table::DeviceData& devices) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery drop_device_query(db()); const std::string drop_device = "DELETE FROM `device`"; if (!drop_device_query.Exec(drop_device)) { - LOGGER_WARN(logger_, "Could not clear device table."); + SDL_WARN("Could not clear device table."); return false; } utils::dbms::SQLQuery drop_device_consents_query(db()); const std::string drop_device_consents = "DELETE FROM `device_consent_group`"; if (!drop_device_consents_query.Exec(drop_device_consents)) { - LOGGER_WARN(logger_, "Could not clear device consents."); + SDL_WARN("Could not clear device consents."); return false; } utils::dbms::SQLQuery drop_user_consents_query(db()); const std::string drop_user_consents = "DELETE FROM `consent_group`"; if (!drop_user_consents_query.Exec(drop_user_consents)) { - LOGGER_WARN(logger_, "Could not clear user consents."); + SDL_WARN("Could not clear user consents."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kInsertDeviceData)) { - LOGGER_WARN(logger_, "Incorrect insert statement for device data."); + SDL_WARN("Incorrect insert statement for device data."); return false; } @@ -1055,7 +1042,7 @@ bool SQLPTExtRepresentation::SaveDeviceData( query.Bind(7, *(it->second.connection_type)); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into device data."); + SDL_WARN("Incorrect insert into device data."); return false; } @@ -1071,7 +1058,7 @@ bool SQLPTExtRepresentation::SaveDeviceData( bool SQLPTExtRepresentation::SaveConsentGroup( const std::string& device_id, const policy_table::UserConsentRecords& records) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); policy_table::UserConsentRecords::const_iterator it = records.begin(); @@ -1085,8 +1072,7 @@ bool SQLPTExtRepresentation::SaveConsentGroup( for (; it_groups != it_groups_end; ++it_groups) { if (kDeviceId == it->first) { if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) { - LOGGER_WARN(logger_, - "Incorrect insert statement for device consent group."); + SDL_WARN("Incorrect insert statement for device consent group."); return false; } query.Bind(0, device_id); @@ -1096,15 +1082,13 @@ bool SQLPTExtRepresentation::SaveConsentGroup( 3, std::string(policy_table::EnumToJsonString(*(it->second.input)))); query.Bind(4, std::string(*(it->second.time_stamp))); - LOGGER_INFO(logger_, - "Device:" - << "time stamp " - << std::string(*(it->second.time_stamp)) << " group " - << it_groups->first << " consent " - << it_groups->second); + SDL_INFO("Device:" + << "time stamp " << std::string(*(it->second.time_stamp)) + << " group " << it_groups->first << " consent " + << it_groups->second); } else { if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) { - LOGGER_WARN(logger_, "Incorrect insert statement for consent group."); + SDL_WARN("Incorrect insert statement for consent group."); return false; } query.Bind(0, device_id); @@ -1115,16 +1099,14 @@ bool SQLPTExtRepresentation::SaveConsentGroup( 4, std::string(policy_table::EnumToJsonString(*(it->second.input)))); query.Bind(5, std::string(*(it->second.time_stamp))); - LOGGER_INFO(logger_, - "Device:" - << "time stamp " - << std::string(*(it->second.time_stamp)) << " group " - << it_groups->first << " consent " - << it_groups->second); + SDL_INFO("Device:" + << "time stamp " << std::string(*(it->second.time_stamp)) + << " group " << it_groups->first << " consent " + << it_groups->second); } if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into consent group."); + SDL_WARN("Incorrect insert into consent group."); return false; } } @@ -1135,10 +1117,10 @@ bool SQLPTExtRepresentation::SaveConsentGroup( bool SQLPTExtRepresentation::SavePreconsentedGroup( const std::string& app_id, const policy_table::Strings& groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kInsertPreconsentedGroups)) { - LOGGER_WARN(logger_, "Incorrect insert statement for preconsented groups"); + SDL_WARN("Incorrect insert statement for preconsented groups"); return false; } @@ -1147,7 +1129,7 @@ bool SQLPTExtRepresentation::SavePreconsentedGroup( query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into preconsented groups."); + SDL_WARN("Incorrect insert into preconsented groups."); return false; } } @@ -1157,7 +1139,7 @@ bool SQLPTExtRepresentation::SavePreconsentedGroup( void SQLPTExtRepresentation::GatherModuleMeta( policy_table::ModuleMeta* meta) const { - LOGGER_INFO(logger_, "Gather Module Meta Info"); + SDL_INFO("Gather Module Meta Info"); utils::dbms::SQLQuery query(db()); if (query.Prepare(sql_pt_ext::kSelectModuleMeta) && query.Next()) { *meta->ccpu_version = query.GetString(0); @@ -1175,19 +1157,19 @@ void SQLPTExtRepresentation::Increment(const std::string& type) const { std::string update_counter = "UPDATE `usage_and_error_count` SET `" + type + "` = `" + type + "` + 1"; if (!query.Exec(update_counter)) { - LOGGER_INFO(logger_, "Failed updating global counter"); + SDL_INFO("Failed updating global counter"); } } bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kCountAppLevel)) { - LOGGER_INFO(logger_, "Incorrect statement of count app_level"); + SDL_INFO("Incorrect statement of count app_level"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_INFO(logger_, "Failed count app_level"); + SDL_INFO("Failed count app_level"); return false; } return query.GetInteger(0) > 0; @@ -1195,10 +1177,10 @@ bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const { bool SQLPTExtRepresentation::GetAllAppGroups(const std::string& policy_app_id, FunctionalGroupIDs& all_groups) { - LOGGER_INFO(logger_, "GetAllAppGroups for '" << policy_app_id << "'"); + SDL_INFO("GetAllAppGroups for '" << policy_app_id << "'"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectAppGroupsId)) { - LOGGER_WARN(logger_, "Incorrect statement for select app groups id."); + SDL_WARN("Incorrect statement for select app groups id."); return false; } @@ -1216,10 +1198,10 @@ bool SQLPTExtRepresentation::GetConsentedGroups( const std::string& device_id, FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectConsentedGroupsId)) { - LOGGER_WARN(logger_, "Incorrect statement for select consent groups id."); + SDL_WARN("Incorrect statement for select consent groups id."); return false; } @@ -1239,11 +1221,10 @@ bool SQLPTExtRepresentation::GetConsentedGroups( bool SQLPTExtRepresentation::GetPreconsentedGroups( const std::string& policy_app_id, FunctionalGroupIDs& preconsented_groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroupsId)) { - LOGGER_WARN(logger_, - "Incorrect statement for select preconsented groups id."); + SDL_WARN("Incorrect statement for select preconsented groups id."); return false; } @@ -1258,11 +1239,10 @@ bool SQLPTExtRepresentation::GetPreconsentedGroups( bool SQLPTExtRepresentation::GetFunctionalGroupNames( FunctionalGroupNames& names) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectFunctionalGroupNames)) { - LOGGER_WARN(logger_, - "Incorrect statement for select functional groups names."); + SDL_WARN("Incorrect statement for select functional groups names."); return false; } @@ -1312,12 +1292,12 @@ void SQLPTExtRepresentation::Increment(const std::string& app_id, "VALUES (?, 1)"; } if (!query.Prepare(sql_counter)) { - LOGGER_INFO(logger_, "Incorrect statement of update app counter"); + SDL_INFO("Incorrect statement of update app counter"); return; } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_INFO(logger_, "Failed updating app counter"); + SDL_INFO("Failed updating app counter"); } } @@ -1338,13 +1318,13 @@ void SQLPTExtRepresentation::Set(const std::string& app_id, "VALUES (?, ?)"; } if (!query.Prepare(sql_info)) { - LOGGER_INFO(logger_, "Incorrect statement of update app info"); + SDL_INFO("Incorrect statement of update app info"); return; } query.Bind(0, value); query.Bind(1, app_id); if (!query.Exec()) { - LOGGER_INFO(logger_, "Failed updating app info"); + SDL_INFO("Failed updating app info"); } } @@ -1364,29 +1344,29 @@ void SQLPTExtRepresentation::Add(const std::string& app_id, "VALUES (?, ?)"; } if (!query.Prepare(sql_stopwatch)) { - LOGGER_INFO(logger_, "Incorrect statement of update app stopwatch"); + SDL_INFO("Incorrect statement of update app stopwatch"); return; } query.Bind(0, seconds); query.Bind(1, app_id); if (!query.Exec()) { - LOGGER_INFO(logger_, "Failed updating app stopwatch"); + SDL_INFO("Failed updating app stopwatch"); } } bool SQLPTExtRepresentation::GetDefaultHMI(const std::string& policy_app_id, std::string* default_hmi) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectDefaultHmi)) { - LOGGER_INFO(logger_, "Incorrect statement for default hmi."); + SDL_INFO("Incorrect statement for default hmi."); return false; } query.Bind(0, policy_app_id); if (!query.Exec()) { - LOGGER_INFO(logger_, "Error during default hmi getting."); + SDL_INFO("Error during default hmi getting."); return false; } @@ -1404,10 +1384,10 @@ bool SQLPTExtRepresentation::CountUnconsentedGroups( const std::string& policy_app_id, const std::string& device_id, int* result) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kCountUnconsentedGroups)) { - LOGGER_WARN(logger_, "Incorrect select for unconsented groups."); + SDL_WARN("Incorrect select for unconsented groups."); return false; } @@ -1417,7 +1397,7 @@ bool SQLPTExtRepresentation::CountUnconsentedGroups( query.Bind(3, kPreDataConsentId); if (!query.Exec()) { - LOGGER_INFO(logger_, "Error during executing unconsented groups."); + SDL_INFO("Error during executing unconsented groups."); return false; } *result = query.GetInteger(0); @@ -1428,7 +1408,7 @@ bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string& message, const std::string& language) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kHasMsgLanguageCode)) { - LOGGER_WARN(logger_, "Incorrect statement for message language check."); + SDL_WARN("Incorrect statement for message language check."); return false; } @@ -1436,7 +1416,7 @@ bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string& message, query.Bind(1, language); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed to check message language code."); + SDL_WARN("Failed to check message language code."); return false; } @@ -1449,7 +1429,7 @@ bool SQLPTExtRepresentation::SaveMessageString( const policy_table::MessageString& strings) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertMessageString)) { - LOGGER_WARN(logger_, "Incorrect insert statement for message."); + SDL_WARN("Incorrect insert statement for message."); return false; } @@ -1462,7 +1442,7 @@ bool SQLPTExtRepresentation::SaveMessageString( query.Bind(6, *strings.textBody); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into message."); + SDL_WARN("Incorrect insert into message."); return false; } @@ -1479,7 +1459,7 @@ bool SQLPTExtRepresentation::SaveModuleMeta( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSaveModuleMeta)) { - LOGGER_WARN(logger_, "Incorrect insert statement for module_meta."); + SDL_WARN("Incorrect insert statement for module_meta."); return false; } const int64_t odometer = *(meta.pt_exchanged_at_odometer_x); @@ -1493,7 +1473,7 @@ bool SQLPTExtRepresentation::SaveModuleMeta( query.Bind(6, *(meta.vin)); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect update for module_meta."); + SDL_WARN("Incorrect update for module_meta."); return false; } @@ -1504,11 +1484,11 @@ bool SQLPTExtRepresentation::SaveAppCounters( const rpc::policy_table_interface_base::AppLevels& app_levels) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteAppLevel)) { - LOGGER_WARN(logger_, "Incorrect delete from app level."); + SDL_WARN("Incorrect delete from app level."); return false; } if (!query.Prepare(sql_pt::kInsertAppLevel)) { - LOGGER_WARN(logger_, "Incorrect insert statement for app level."); + SDL_WARN("Incorrect insert statement for app level."); return false; } @@ -1532,7 +1512,7 @@ bool SQLPTExtRepresentation::SaveAppCounters( query.Bind(15, it->second.count_of_tls_errors); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into app level."); + SDL_WARN("Incorrect insert into app level."); return false; } } @@ -1543,7 +1523,7 @@ bool SQLPTExtRepresentation::SaveGlobalCounters( const rpc::policy_table_interface_base::UsageAndErrorCounts& counts) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateGlobalCounters)) { - LOGGER_WARN(logger_, "Incorrect insert statement for global counters."); + SDL_WARN("Incorrect insert statement for global counters."); return false; } @@ -1552,7 +1532,7 @@ bool SQLPTExtRepresentation::SaveGlobalCounters( query.Bind(2, *counts.count_of_sync_reboots); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect insert into global counters."); + SDL_WARN("Incorrect insert into global counters."); return false; } @@ -1561,22 +1541,22 @@ bool SQLPTExtRepresentation::SaveGlobalCounters( bool SQLPTExtRepresentation::CleanupUnpairedDevices( const DeviceIds& device_ids) const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::dbms::SQLQuery delete_device_query(db()); if (!delete_device_query.Prepare(sql_pt::kDeleteDevice)) { - LOGGER_WARN(logger_, "Incorrect statement for device delete."); + SDL_WARN("Incorrect statement for device delete."); return true; } utils::dbms::SQLQuery delete_device_consent_query(db()); if (!delete_device_consent_query.Prepare(sql_pt_ext::kDeleteDeviceConsent)) { - LOGGER_WARN(logger_, "Incorrect statement for delete device consent."); + SDL_WARN("Incorrect statement for delete device consent."); return false; } utils::dbms::SQLQuery delete_app_consent_query(db()); if (!delete_app_consent_query.Prepare(sql_pt_ext::kDeleteAppConsent)) { - LOGGER_WARN(logger_, "Incorrect statement for delete app consent."); + SDL_WARN("Incorrect statement for delete app consent."); return false; } @@ -1585,20 +1565,20 @@ bool SQLPTExtRepresentation::CleanupUnpairedDevices( for (; it != it_end; ++it) { delete_device_query.Bind(0, (*it)); if (!delete_device_query.Exec() || !delete_device_query.Reset()) { - LOGGER_WARN(logger_, "Failed to delete from device"); + SDL_WARN("Failed to delete from device"); return false; } delete_device_consent_query.Bind(0, (*it)); if (!delete_device_consent_query.Exec() || !delete_device_consent_query.Reset()) { - LOGGER_WARN(logger_, "Failed to delete from device consent."); + SDL_WARN("Failed to delete from device consent."); return false; } delete_app_consent_query.Bind(0, (*it)); if (!delete_app_consent_query.Exec() || !delete_app_consent_query.Reset()) { - LOGGER_WARN(logger_, "Failed to delete from app consent."); + SDL_WARN("Failed to delete from app consent."); return false; } } @@ -1608,22 +1588,22 @@ bool SQLPTExtRepresentation::CleanupUnpairedDevices( bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOGGER_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_ERROR(logger_, "Failed deleting from app_group."); + SDL_ERROR("Failed deleting from app_group."); return false; } if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) { - LOGGER_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_ERROR(logger_, "Failed deleting from app_group."); + SDL_ERROR("Failed deleting from app_group."); return false; } @@ -1646,26 +1626,25 @@ bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) { } bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) { - LOGGER_INFO(logger_, - "SQLPTExtRepresentation::SetPredataPolicy for " << app_id); + SDL_INFO("SQLPTExtRepresentation::SetPredataPolicy for " << app_id); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOGGER_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_ERROR(logger_, "Failed deleting from app_group."); + SDL_ERROR("Failed deleting from app_group."); return false; } if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) { - LOGGER_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_ERROR(logger_, "Failed deleting from app_group."); + SDL_ERROR("Failed deleting from app_group."); return false; } @@ -1689,13 +1668,13 @@ bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) { bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectApplicationIsPreData)) { - LOGGER_WARN(logger_, "Incorrect select application is pre_dataConsented"); + SDL_WARN("Incorrect select application is pre_dataConsented"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed select application is pre_dataConsented"); + SDL_WARN("Failed select application is pre_dataConsented"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -1703,17 +1682,17 @@ bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const { bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id, bool is_pre_data) { - LOGGER_TRACE(logger_, "Set flag is_predata of application"); + SDL_TRACE("Set flag is_predata of application"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateIsPredata)) { - LOGGER_WARN(logger_, "Incorect statement for updating is_predata"); + SDL_WARN("Incorect statement for updating is_predata"); return false; } query.Bind(0, is_pre_data); query.Bind(1, app_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed update is_predata"); + SDL_WARN("Failed update is_predata"); return false; } return true; @@ -1721,27 +1700,27 @@ bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id, bool SQLPTExtRepresentation::SetUnpairedDevice(const std::string& device_id, bool unpaired) const { - LOGGER_TRACE(logger_, "Set unpaired device: " << device_id); + SDL_TRACE("Set unpaired device: " << device_id); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateUnpairedDevice)) { - LOGGER_WARN(logger_, "Incorect statement for updating unpaired device"); + SDL_WARN("Incorect statement for updating unpaired device"); return false; } query.Bind(0, unpaired); query.Bind(1, device_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed update unpaired device"); + SDL_WARN("Failed update unpaired device"); return false; } return true; } bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const { - LOGGER_TRACE(logger_, "Get list of unpaired devices"); + SDL_TRACE("Get list of unpaired devices"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectUnpairedDevices)) { - LOGGER_WARN(logger_, "Incorect statement for selecting unpaired devices"); + SDL_WARN("Incorect statement for selecting unpaired devices"); return false; } @@ -1754,7 +1733,7 @@ bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const { bool SQLPTExtRepresentation::SetVINValue(const std::string& value) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateModuleMetaVinParam)) { - LOGGER_WARN(logger_, "Incorect statement for updating module_meta params"); + SDL_WARN("Incorect statement for updating module_meta params"); return false; } @@ -1762,7 +1741,7 @@ bool SQLPTExtRepresentation::SetVINValue(const std::string& value) { const bool result = query.Exec(); if (!result) { - LOGGER_WARN(logger_, "Failed update module_meta"); + SDL_WARN("Failed update module_meta"); } return result; } @@ -1772,14 +1751,14 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup( const std::string& functional_group_name) const { utils::dbms::SQLQuery query_group_id(db()); if (!query_group_id.Prepare(sql_pt_ext::kSelectGroupId)) { - LOGGER_WARN(logger_, "Incorect statement for select group name."); + SDL_WARN("Incorect statement for select group name."); return false; } query_group_id.Bind(0, functional_group_name); if (!query_group_id.Exec()) { - LOGGER_WARN(logger_, "Failed to select group id."); + SDL_WARN("Failed to select group id."); return false; } @@ -1787,7 +1766,7 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kDeleteAppGroupConsent)) { - LOGGER_WARN(logger_, "Incorect statement for remove app consent."); + SDL_WARN("Incorect statement for remove app consent."); return false; } @@ -1795,7 +1774,7 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup( query.Bind(1, id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed to remove app consent."); + SDL_WARN("Failed to remove app consent."); return false; } diff --git a/src/components/policy/src/sql_pt_representation.cc b/src/components/policy/src/sql_pt_representation.cc index 046b858131..1cbcd6ccf5 100644 --- a/src/components/policy/src/sql_pt_representation.cc +++ b/src/components/policy/src/sql_pt_representation.cc @@ -53,7 +53,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOGGER("Policy") namespace { template <typename T, typename K> @@ -93,9 +93,8 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id, Query query(db()); if (!query.Prepare(sql_pt::kSelectRpc)) { - LOGGER_WARN(logger_, - "Incorrect select statement from rpcs" - << query.LastError().text()); + SDL_WARN("Incorrect select statement from rpcs" + << query.LastError().text()); return; } query.Bind(0, app_id); @@ -104,10 +103,9 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id, bool ret = query.Next(); result.hmi_level_permitted = ret ? kRpcAllowed : kRpcDisallowed; - LOGGER_INFO(logger_, - "Level is " << (result.hmi_level_permitted == kRpcAllowed - ? "permitted" - : "not permitted")); + SDL_INFO("Level is " << (result.hmi_level_permitted == kRpcAllowed + ? "permitted" + : "not permitted")); std::string parameter; while (ret) { if (!query.IsNull(0)) { @@ -126,7 +124,7 @@ bool SQLPTRepresentation::IsPTPreloaded() { int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { Query query(db()); if (!query.Prepare(sql_pt::kSelectIgnitionCycles) || !query.Exec()) { - LOGGER_WARN(logger_, "Can not select ignition cycles"); + SDL_WARN("Can not select ignition cycles"); return 0; } int limit = query.GetInteger(0); @@ -142,7 +140,7 @@ int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { int SQLPTRepresentation::KilometersBeforeExchange(int current) { Query query(db()); if (!query.Prepare(sql_pt::kSelectKilometers) || !query.Exec()) { - LOGGER_WARN(logger_, "Can not select kilometers"); + SDL_WARN("Can not select kilometers"); return 0; } int limit = query.GetInteger(0); @@ -158,17 +156,16 @@ int SQLPTRepresentation::KilometersBeforeExchange(int current) { bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( int kilometers, int days_after_epoch) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Query query(db()); if (!query.Prepare(sql_pt::kUpdateCountersSuccessfulUpdate)) { - LOGGER_WARN(logger_, - "Wrong update query for counters on successful update."); + SDL_WARN("Wrong update query for counters on successful update."); return false; } query.Bind(0, kilometers); query.Bind(1, days_after_epoch); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed to update counters on successful update."); + SDL_WARN("Failed to update counters on successful update."); return false; } return true; @@ -177,7 +174,7 @@ bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( int SQLPTRepresentation::DaysBeforeExchange(int current) { Query query(db()); if (!query.Prepare(sql_pt::kSelectDays) || !query.Exec()) { - LOGGER_WARN(logger_, "Can not select days"); + SDL_WARN("Can not select days"); return 0; } int limit = query.GetInteger(0); @@ -198,7 +195,7 @@ int SQLPTRepresentation::DaysBeforeExchange(int current) { int SQLPTRepresentation::TimeoutResponse() { Query query(db()); if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) { - LOGGER_INFO(logger_, "Can not select timeout response for retry sequence"); + SDL_INFO("Can not select timeout response for retry sequence"); const int kDefault = 30; return kDefault; } @@ -208,8 +205,7 @@ int SQLPTRepresentation::TimeoutResponse() { bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) { Query query(db()); if (!query.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { - LOGGER_INFO(logger_, - "Incorrect select statement from seconds between retries"); + SDL_INFO("Incorrect select statement from seconds between retries"); return false; } while (query.Next()) { @@ -232,8 +228,7 @@ std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg( } EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { - LOGGER_INFO(logger_, - "SQLPTRepresentation::GetUpdateUrls for " << service_type); + SDL_INFO("SQLPTRepresentation::GetUpdateUrls for " << service_type); Query query(db()); EndpointUrls ret; if (query.Prepare(sql_pt::kSelectEndpoint)) { @@ -248,7 +243,7 @@ EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { ret.push_back(data); } } else { - LOGGER_WARN(logger_, "Invalid select endpoints statement."); + SDL_WARN("Invalid select endpoints statement."); } return ret; } @@ -261,7 +256,7 @@ std::string SQLPTRepresentation::GetLockScreenIconUrl() const { query.Bind(1, std::string("default")); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect select from notifications by priority."); + SDL_WARN("Incorrect select from notifications by priority."); return ret; } @@ -270,24 +265,24 @@ std::string SQLPTRepresentation::GetLockScreenIconUrl() const { } } else { - LOGGER_WARN(logger_, "Invalid select endpoints statement."); + SDL_WARN("Invalid select endpoints statement."); } return ret; } int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Query query(db()); if (!query.Prepare(sql_pt::kSelectNotificationsPerPriority)) { - LOGGER_WARN(logger_, - "Incorrect select statement for priority " - "notification number."); + SDL_WARN( + "Incorrect select statement for priority " + "notification number."); return 0; } query.Bind(0, priority); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect select from notifications by priority."); + SDL_WARN("Incorrect select from notifications by priority."); return 0; } @@ -300,21 +295,21 @@ int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, std::string* priority) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (NULL == priority) { - LOGGER_WARN(logger_, "Input priority parameter is null."); + SDL_WARN("Input priority parameter is null."); return false; } Query query(db()); if (!query.Prepare(sql_pt::kSelectPriority)) { - LOGGER_INFO(logger_, "Incorrect statement for priority."); + SDL_INFO("Incorrect statement for priority."); return false; } query.Bind(0, policy_app_id); if (!query.Exec()) { - LOGGER_INFO(logger_, "Error during select priority."); + SDL_INFO("Error during select priority."); return false; } @@ -330,77 +325,72 @@ bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, InitResult SQLPTRepresentation::Init(const PolicySettings *settings) { settings_ = settings; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); #ifdef BUILD_TESTS open_counter_ = 0; #endif // BUILD_TESTS if (!db_->Open()) { - LOGGER_ERROR(logger_, "Failed opening database."); - LOGGER_INFO(logger_, "Starting opening retries."); + SDL_ERROR("Failed opening database."); + SDL_INFO("Starting opening retries."); const uint16_t attempts = get_settings().attempts_to_open_policy_db(); - LOGGER_DEBUG(logger_, "Total attempts number is: " << attempts); + SDL_DEBUG("Total attempts number is: " << attempts); bool is_opened = false; const uint16_t open_attempt_timeout_ms = get_settings().open_attempt_timeout_ms(); - LOGGER_DEBUG(logger_, - "Open attempt timeout(ms) is: " << open_attempt_timeout_ms); + SDL_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms); for (int i = 0; i < attempts; ++i) { threads::sleep(open_attempt_timeout_ms * 1000); - LOGGER_INFO(logger_, "Attempt: " << i + 1); + SDL_INFO("Attempt: " << i + 1); #ifdef BUILD_TESTS ++open_counter_; #endif // BUILD_TESTS if (db_->Open()) { - LOGGER_INFO(logger_, "Database opened."); + SDL_INFO("Database opened."); is_opened = true; break; } } if (!is_opened) { - LOGGER_ERROR(logger_, - "Open retry sequence failed. Tried " - << attempts << " attempts with " - << open_attempt_timeout_ms - << " open timeout(ms) for each."); + SDL_ERROR("Open retry sequence failed. Tried " + << attempts << " attempts with " << open_attempt_timeout_ms + << " open timeout(ms) for each."); return InitResult::FAIL; } } #ifndef __QNX__ if (!db_->IsReadWrite()) { - LOGGER_ERROR(logger_, "There are no read/write permissions for database"); + SDL_ERROR("There are no read/write permissions for database"); return InitResult::FAIL; } #endif // __QNX__ Query check_pages(db()); if (!check_pages.Prepare(sql_pt::kCheckPgNumber) || !check_pages.Next()) { - LOGGER_WARN(logger_, "Incorrect pragma for page counting."); + SDL_WARN("Incorrect pragma for page counting."); } else { if (0 < check_pages.GetInteger(0)) { Query db_check(db()); if (!db_check.Prepare(sql_pt::kCheckDBIntegrity)) { - LOGGER_WARN(logger_, "Incorrect pragma for integrity check."); + SDL_WARN("Incorrect pragma for integrity check."); } else { while (db_check.Next()) { if (db_check.GetString(0).compare("ok") == 0) { Query check_first_run(db()); if (check_first_run.Prepare(sql_pt::kIsFirstRun) && check_first_run.Next()) { - LOGGER_INFO(logger_, - "Selecting is first run " - << check_first_run.GetBoolean(0)); + SDL_INFO("Selecting is first run " + << check_first_run.GetBoolean(0)); if (check_first_run.GetBoolean(0)) { Query set_not_first_run(db()); set_not_first_run.Exec(sql_pt::kSetNotFirstRun); return InitResult::SUCCESS; } } else { - LOGGER_WARN(logger_, "Incorrect select is first run"); + SDL_WARN("Incorrect select is first run"); } return InitResult::EXISTS; } else { - LOGGER_ERROR(logger_, - "Existing policy table representation is invlaid."); + SDL_ERROR("Existing policy table representation is invlaid."); // TODO(PV): add handle return InitResult::FAIL; } @@ -410,14 +400,12 @@ InitResult SQLPTRepresentation::Init(const PolicySettings *settings) { } Query query(db()); if (!query.Exec(sql_pt::kCreateSchema)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Failed creating schema of database: " << query.LastError().text()); return InitResult::FAIL; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Failed insert init data to database: " << query.LastError().text()); return InitResult::FAIL; } @@ -442,8 +430,7 @@ const VehicleInfo SQLPTRepresentation::GetVehicleInfo() const { bool SQLPTRepresentation::Drop() { Query query(db()); if (!query.Exec(sql_pt::kDropSchema)) { - LOGGER_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_WARN("Failed dropping database: " << query.LastError().text()); return false; } return true; @@ -456,13 +443,11 @@ void SQLPTRepresentation::WriteDb() { bool SQLPTRepresentation::Clear() { Query query(db()); if (!query.Exec(sql_pt::kDeleteData)) { - LOGGER_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_ERROR("Failed clearing database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -472,19 +457,16 @@ bool SQLPTRepresentation::Clear() { bool SQLPTRepresentation::RefreshDB() { Query query(db()); if (!query.Exec(sql_pt::kDropSchema)) { - LOGGER_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_WARN("Failed dropping database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kCreateSchema)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Failed creating schema of database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -493,7 +475,7 @@ bool SQLPTRepresentation::RefreshDB() { utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::SharedPtr<policy_table::Table> table = new policy_table::Table(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); @@ -508,7 +490,7 @@ utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() void SQLPTRepresentation::GatherModuleMeta( policy_table::ModuleMeta* meta) const { - LOGGER_INFO(logger_, "Gather Module Meta Info"); + SDL_INFO("Gather Module Meta Info"); utils::dbms::SQLQuery query(db()); if (query.Prepare(sql_pt::kSelectModuleMeta) && query.Next()) { *meta->pt_exchanged_at_odometer_x = query.GetInteger(0); @@ -519,10 +501,10 @@ void SQLPTRepresentation::GatherModuleMeta( void SQLPTRepresentation::GatherModuleConfig( policy_table::ModuleConfig* config) const { - LOGGER_INFO(logger_, "Gather Configuration Info"); + SDL_INFO("Gather Configuration Info"); Query query(db()); if (!query.Prepare(sql_pt::kSelectModuleConfig) || !query.Next()) { - LOGGER_WARN(logger_, "Incorrect select statement for module config"); + SDL_WARN("Incorrect select statement for module config"); } else { *config->preloaded_pt = query.GetBoolean(0); config->exchange_after_x_ignition_cycles = query.GetInteger(1); @@ -538,7 +520,7 @@ void SQLPTRepresentation::GatherModuleConfig( Query endpoints(db()); if (!endpoints.Prepare(sql_pt::kSelectEndpoints)) { - LOGGER_WARN(logger_, "Incorrect select statement for endpoints"); + SDL_WARN("Incorrect select statement for endpoints"); } else { while (endpoints.Next()) { config->endpoints[endpoints.GetString(1)][endpoints.GetString(2)] @@ -548,7 +530,7 @@ void SQLPTRepresentation::GatherModuleConfig( Query notifications(db()); if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) { - LOGGER_WARN(logger_, "Incorrect select statement for notifications"); + SDL_WARN("Incorrect select statement for notifications"); } else { while (notifications.Next()) { config->notifications_per_minute_by_priority[notifications.GetString(0)] = @@ -557,8 +539,7 @@ void SQLPTRepresentation::GatherModuleConfig( } Query seconds(db()); if (!seconds.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { - LOGGER_INFO(logger_, - "Incorrect select statement from seconds between retries"); + SDL_INFO("Incorrect select statement from seconds between retries"); } else { while (seconds.Next()) { config->seconds_between_retries.push_back(seconds.GetInteger(0)); @@ -568,7 +549,7 @@ void SQLPTRepresentation::GatherModuleConfig( bool SQLPTRepresentation::GatherUsageAndErrorCounts( policy_table::UsageAndErrorCounts* counts) const { - LOGGER_INFO(logger_, "Gather Usage and Error Counts."); + SDL_INFO("Gather Usage and Error Counts."); Query query(db()); if (query.Prepare(sql_pt::kSelectAppLevels)) { policy_table::AppLevel app_level_empty; @@ -582,7 +563,7 @@ bool SQLPTRepresentation::GatherUsageAndErrorCounts( void SQLPTRepresentation::GatherDeviceData( policy_table::DeviceData* data) const { - LOGGER_INFO(logger_, "Gather device data."); + SDL_INFO("Gather device data."); data->mark_initialized(); Query query(db()); @@ -597,15 +578,15 @@ void SQLPTRepresentation::GatherDeviceData( bool SQLPTRepresentation::GatherFunctionalGroupings( policy_table::FunctionalGroupings* groups) const { - LOGGER_INFO(logger_, "Gather Functional Groupings info"); + SDL_INFO("Gather Functional Groupings info"); Query func_group(db()); if (!func_group.Prepare(sql_pt::kSelectFunctionalGroups)) { - LOGGER_WARN(logger_, "Incorrect select from functional_groupings"); + SDL_WARN("Incorrect select from functional_groupings"); return false; } Query rpcs(db()); if (!rpcs.Prepare(sql_pt::kSelectAllRpcs)) { - LOGGER_WARN(logger_, "Incorrect select all from rpc"); + SDL_WARN("Incorrect select all from rpc"); return false; } while (func_group.Next()) { @@ -640,10 +621,10 @@ bool SQLPTRepresentation::GatherFunctionalGroupings( bool SQLPTRepresentation::GatherConsumerFriendlyMessages( policy_table::ConsumerFriendlyMessages* messages) const { - LOGGER_INFO(logger_, "Gather Consumer Friendly Messages"); + SDL_INFO("Gather Consumer Friendly Messages"); Query query(db()); if (!query.Prepare(sql_pt::kSelectUserMsgsVersion) || !query.Next()) { - LOGGER_WARN(logger_, "Incorrect select from consumer_friendly_messages"); + SDL_WARN("Incorrect select from consumer_friendly_messages"); return false; } messages->version = query.GetString(0); @@ -652,10 +633,10 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages( bool SQLPTRepresentation::GatherApplicationPoliciesSection( policy_table::ApplicationPoliciesSection* policies) const { - LOGGER_INFO(logger_, "Gather applications policies"); + SDL_INFO("Gather applications policies"); Query query(db()); if (!query.Prepare(sql_pt::kSelectAppPolicies)) { - LOGGER_WARN(logger_, "Incorrect select from app_policies"); + SDL_WARN("Incorrect select from app_policies"); return false; } @@ -709,7 +690,7 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection( } bool SQLPTRepresentation::Save(const policy_table::Table& table) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); db_->BeginTransaction(); if (!SaveFunctionalGroupings(table.policy_table.functional_groupings)) { db_->RollbackTransaction(); @@ -750,17 +731,17 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( const policy_table::FunctionalGroupings& groups) { Query query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteRpc)) { - LOGGER_WARN(logger_, "Incorrect delete from rpc."); + SDL_WARN("Incorrect delete from rpc."); return false; } Query query(db()); if (!query.Exec(sql_pt::kDeleteFunctionalGroup)) { - LOGGER_WARN(logger_, "Incorrect delete from seconds between retries."); + SDL_WARN("Incorrect delete from seconds between retries."); return false; } if (!query.Prepare(sql_pt::kInsertFunctionalGroup)) { - LOGGER_WARN(logger_, "Incorrect insert statement for functional groups"); + SDL_WARN("Incorrect insert statement for functional groups"); return false; } @@ -783,7 +764,7 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( : query.Bind(2); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into functional groups"); + SDL_WARN("Incorrect insert into functional groups"); return false; } @@ -800,7 +781,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, Query query_parameter(db()); if (!query.Prepare(sql_pt::kInsertRpc) || !query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) { - LOGGER_WARN(logger_, "Incorrect insert statement for rpc"); + SDL_WARN("Incorrect insert statement for rpc"); return false; } @@ -821,7 +802,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, 2, std::string(policy_table::EnumToJsonString(*ps_it))); query_parameter.Bind(3, group_id); if (!query_parameter.Exec() || !query_parameter.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into rpc with parameter"); + SDL_WARN("Incorrect insert into rpc with parameter"); return false; } } @@ -830,7 +811,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, query.Bind(1, std::string(policy_table::EnumToJsonString(*hmi_it))); query.Bind(2, group_id); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into rpc"); + SDL_WARN("Incorrect insert into rpc"); return false; } } @@ -844,16 +825,16 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection( const policy_table::ApplicationPoliciesSection& policies) { Query query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) { - LOGGER_WARN(logger_, "Incorrect delete from app_group."); + SDL_WARN("Incorrect delete from app_group."); return false; } if (!query_delete.Exec(sql_pt::kDeleteApplication)) { - LOGGER_WARN(logger_, "Incorrect delete from application."); + SDL_WARN("Incorrect delete from application."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestType)) { - LOGGER_WARN(logger_, "Incorrect delete from request type."); + SDL_WARN("Incorrect delete from request type."); return false; } @@ -897,8 +878,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( const policy_table::ApplicationPolicies::value_type& app) { Query app_query(db()); if (!app_query.Prepare(sql_pt::kInsertApplication)) { - LOGGER_WARN(logger_, - "Incorrect insert statement into application (device)."); + SDL_WARN("Incorrect insert statement into application (device)."); return false; } @@ -912,7 +892,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( ? app_query.Bind(5, *app.second.certificate) : app_query.Bind(5); if (!app_query.Exec() || !app_query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into application."); + SDL_WARN("Incorrect insert into application."); return false; } @@ -947,7 +927,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( const policy_table::DevicePolicy& device) { Query app_query(db()); if (!app_query.Prepare(sql_pt::kInsertApplication)) { - LOGGER_WARN(logger_, "Incorrect insert statement into application."); + SDL_WARN("Incorrect insert statement into application."); return false; } @@ -960,7 +940,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( app_query.Bind(5); if (!app_query.Exec() || !app_query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into application."); + SDL_WARN("Incorrect insert into application."); return false; } @@ -971,20 +951,18 @@ bool SQLPTRepresentation::SaveAppGroup( const std::string& app_id, const policy_table::Strings& app_groups) { Query query(db()); if (!query.Prepare(sql_pt::kInsertAppGroup)) { - LOGGER_WARN(logger_, "Incorrect insert statement for app group"); + SDL_WARN("Incorrect insert statement for app group"); return false; } - LOGGER_INFO(logger_, "SaveAppGroup"); + SDL_INFO("SaveAppGroup"); policy_table::Strings::const_iterator it; for (it = app_groups.begin(); it != app_groups.end(); ++it) { std::string ssss = *it; - LOGGER_INFO(logger_, "Group: " << ssss); + SDL_INFO("Group: " << ssss); query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, - "Incorrect insert into app group." - << query.LastError().text()); + SDL_WARN("Incorrect insert into app group." << query.LastError().text()); return false; } } @@ -996,7 +974,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id, const policy_table::Strings& nicknames) { Query query(db()); if (!query.Prepare(sql_pt::kInsertNickname)) { - LOGGER_WARN(logger_, "Incorrect insert statement for nickname"); + SDL_WARN("Incorrect insert statement for nickname"); return false; } @@ -1005,7 +983,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id, query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into nickname."); + SDL_WARN("Incorrect insert into nickname."); return false; } } @@ -1017,7 +995,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id, const policy_table::AppHMITypes& types) { Query query(db()); if (!query.Prepare(sql_pt::kInsertAppType)) { - LOGGER_WARN(logger_, "Incorrect insert statement for app type"); + SDL_WARN("Incorrect insert statement for app type"); return false; } @@ -1026,7 +1004,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id, query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into app type."); + SDL_WARN("Incorrect insert into app type."); return false; } } @@ -1038,7 +1016,7 @@ bool SQLPTRepresentation::SaveRequestType( const std::string& app_id, const policy_table::RequestTypes& types) { Query query(db()); if (!query.Prepare(sql_pt::kInsertRequestType)) { - LOGGER_WARN(logger_, "Incorrect insert statement for request types."); + SDL_WARN("Incorrect insert statement for request types."); return false; } @@ -1047,7 +1025,7 @@ bool SQLPTRepresentation::SaveRequestType( query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into request types."); + SDL_WARN("Incorrect insert into request types."); return false; } } @@ -1059,7 +1037,7 @@ bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSaveModuleMeta)) { - LOGGER_WARN(logger_, "Incorrect insert statement for module_meta."); + SDL_WARN("Incorrect insert statement for module_meta."); return false; } const int64_t odometer = *(meta.pt_exchanged_at_odometer_x); @@ -1069,7 +1047,7 @@ bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) { query.Bind(2, *(meta.ignition_cycles_since_last_exchange)); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect update for module_meta."); + SDL_WARN("Incorrect update for module_meta."); return false; } @@ -1080,7 +1058,7 @@ bool SQLPTRepresentation::SaveModuleConfig( const policy_table::ModuleConfig& config) { Query query(db()); if (!query.Prepare(sql_pt::kUpdateModuleConfig)) { - LOGGER_WARN(logger_, "Incorrect update statement for module config"); + SDL_WARN("Incorrect update statement for module config"); return false; } @@ -1105,7 +1083,7 @@ bool SQLPTRepresentation::SaveModuleConfig( : query.Bind(9); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect update module config"); + SDL_WARN("Incorrect update module config"); return false; } @@ -1129,12 +1107,12 @@ bool SQLPTRepresentation::SaveServiceEndpoints( const policy_table::ServiceEndpoints& endpoints) { Query query(db()); if (!query.Exec(sql_pt::kDeleteEndpoint)) { - LOGGER_WARN(logger_, "Incorrect delete from endpoint."); + SDL_WARN("Incorrect delete from endpoint."); return false; } if (!query.Prepare(sql_pt::kInsertEndpoint)) { - LOGGER_WARN(logger_, "Incorrect insert statement for endpoint"); + SDL_WARN("Incorrect insert statement for endpoint"); return false; } @@ -1150,7 +1128,7 @@ bool SQLPTRepresentation::SaveServiceEndpoints( query.Bind(1, *url_it); query.Bind(2, app_it->first); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into endpoint"); + SDL_WARN("Incorrect insert into endpoint"); return false; } } @@ -1162,7 +1140,7 @@ bool SQLPTRepresentation::SaveServiceEndpoints( bool SQLPTRepresentation::SaveConsumerFriendlyMessages( const policy_table::ConsumerFriendlyMessages& messages) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // According CRS-2419 If there is no “consumer_friendly_messages” key, // the current local consumer_friendly_messages section shall be maintained in @@ -1170,18 +1148,18 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( if (messages.messages.is_initialized()) { Query query(db()); if (!query.Exec(sql_pt::kDeleteMessageString)) { - LOGGER_WARN(logger_, "Incorrect delete from message."); + SDL_WARN("Incorrect delete from message."); return false; } if (query.Prepare(sql_pt::kUpdateVersion)) { query.Bind(0, messages.version); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect update into version."); + SDL_WARN("Incorrect update into version."); return false; } } else { - LOGGER_WARN(logger_, "Incorrect update statement for version."); + SDL_WARN("Incorrect update statement for version."); return false; } @@ -1204,7 +1182,7 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( } } } else { - LOGGER_INFO(logger_, "Messages list is empty"); + SDL_INFO("Messages list is empty"); } return true; @@ -1213,13 +1191,13 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( bool SQLPTRepresentation::SaveMessageType(const std::string& type) { Query query(db()); if (!query.Prepare(sql_pt::kInsertMessageType)) { - LOGGER_WARN(logger_, "Incorrect insert statement for message type."); + SDL_WARN("Incorrect insert statement for message type."); return false; } query.Bind(0, type); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect insert into message type."); + SDL_WARN("Incorrect insert into message type."); return false; } @@ -1229,13 +1207,13 @@ bool SQLPTRepresentation::SaveMessageType(const std::string& type) { bool SQLPTRepresentation::SaveLanguage(const std::string& code) { Query query(db()); if (!query.Prepare(sql_pt::kInsertLanguage)) { - LOGGER_WARN(logger_, "Incorrect insert statement for language."); + SDL_WARN("Incorrect insert statement for language."); return false; } query.Bind(0, code); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect insert into language."); + SDL_WARN("Incorrect insert into language."); return false; } @@ -1254,12 +1232,11 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries( const policy_table::SecondsBetweenRetries& seconds) { Query query(db()); if (!query.Exec(sql_pt::kDeleteSecondsBetweenRetries)) { - LOGGER_WARN(logger_, "Incorrect delete from seconds between retries."); + SDL_WARN("Incorrect delete from seconds between retries."); return false; } if (!query.Prepare(sql_pt::kInsertSecondsBetweenRetry)) { - LOGGER_WARN(logger_, - "Incorrect insert statement for seconds between retries."); + SDL_WARN("Incorrect insert statement for seconds between retries."); return false; } @@ -1267,7 +1244,7 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries( query.Bind(0, static_cast<int>(i)); query.Bind(1, seconds[i]); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into seconds between retries."); + SDL_WARN("Incorrect insert into seconds between retries."); return false; } } @@ -1279,8 +1256,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( const policy_table::NumberOfNotificationsPerMinute& notifications) { Query query(db()); if (!query.Prepare(sql_pt::kInsertNotificationsByPriority)) { - LOGGER_WARN(logger_, - "Incorrect insert statement for notifications by priority."); + SDL_WARN("Incorrect insert statement for notifications by priority."); return false; } @@ -1289,7 +1265,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( query.Bind(0, it->first); query.Bind(1, it->second); if (!query.Exec() || !query.Reset()) { - LOGGER_WARN(logger_, "Incorrect insert into notifications by priority."); + SDL_WARN("Incorrect insert into notifications by priority."); return false; } } @@ -1301,7 +1277,7 @@ bool SQLPTRepresentation::SaveDeviceData( const policy_table::DeviceData& devices) { Query query(db()); if (!query.Prepare(sql_pt::kInsertDeviceData)) { - LOGGER_WARN(logger_, "Incorrect insert statement for device data."); + SDL_WARN("Incorrect insert statement for device data."); return false; } @@ -1309,7 +1285,7 @@ bool SQLPTRepresentation::SaveDeviceData( for (it = devices.begin(); it != devices.end(); ++it) { query.Bind(0, it->first); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect insert into device data."); + SDL_WARN("Incorrect insert into device data."); return false; } } @@ -1322,11 +1298,11 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( const_cast<policy_table::UsageAndErrorCounts&>(counts).mark_initialized(); Query query(db()); if (!query.Exec(sql_pt::kDeleteAppLevel)) { - LOGGER_WARN(logger_, "Incorrect delete from app level."); + SDL_WARN("Incorrect delete from app level."); return false; } if (!query.Prepare(sql_pt::kInsertAppLevel)) { - LOGGER_WARN(logger_, "Incorrect insert statement for app level."); + SDL_WARN("Incorrect insert statement for app level."); return false; } @@ -1336,7 +1312,7 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( for (it = app_levels.begin(); it != app_levels.end(); ++it) { query.Bind(0, it->first); if (!query.Exec()) { - LOGGER_WARN(logger_, "Incorrect insert into app level."); + SDL_WARN("Incorrect insert into app level."); return false; } } @@ -1346,22 +1322,22 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( void SQLPTRepresentation::IncrementIgnitionCycles() { Query query(db()); if (!query.Exec(sql_pt::kIncrementIgnitionCycles)) { - LOGGER_WARN(logger_, "Failed incrementing ignition cycles"); + SDL_WARN("Failed incrementing ignition cycles"); } } void SQLPTRepresentation::ResetIgnitionCycles() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Query query(db()); if (!query.Exec(sql_pt::kResetIgnitionCycles)) { - LOGGER_WARN(logger_, "Failed to reset ignition cycles number."); + SDL_WARN("Failed to reset ignition cycles number."); } } bool SQLPTRepresentation::UpdateRequired() const { Query query(db()); if (!query.Prepare(sql_pt::kSelectFlagUpdateRequired) || !query.Exec()) { - LOGGER_WARN(logger_, "Failed select update required flag from module meta"); + SDL_WARN("Failed select update required flag from module meta"); return false; } return query.GetBoolean(0); @@ -1372,29 +1348,28 @@ void SQLPTRepresentation::SaveUpdateRequired(bool value) { // TODO(AOleynik): Quick fix, will be reworked if (!query.Prepare(/*sql_pt::kUpdateFlagUpdateRequired*/ "UPDATE `module_meta` SET `flag_update_required` = ?")) { - LOGGER_WARN(logger_, - "Incorrect update into module meta (update_required): " - << strerror(errno)); + SDL_WARN("Incorrect update into module meta (update_required): " + << strerror(errno)); return; } query.Bind(0, value); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed update module meta (update_required)"); + SDL_WARN("Failed update module meta (update_required)"); } } bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, StringArray* nicknames, StringArray* app_types) { - LOGGER_INFO(logger_, "Getting initial application data."); + SDL_INFO("Getting initial application data."); Query app_names(db()); if (!app_names.Prepare(sql_pt::kSelectNicknames)) { - LOGGER_WARN(logger_, "Incorrect select from app nicknames"); + SDL_WARN("Incorrect select from app nicknames"); return false; } Query app_hmi_types(db()); if (!app_hmi_types.Prepare(sql_pt::kSelectAppTypes)) { - LOGGER_WARN(logger_, "Incorrect select from app types"); + SDL_WARN("Incorrect select from app types"); return false; } app_names.Bind(0, app_id); @@ -1412,7 +1387,7 @@ bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, bool SQLPTRepresentation::GetFunctionalGroupings( policy_table::FunctionalGroupings& groups) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return GatherFunctionalGroupings(&groups); } @@ -1420,7 +1395,7 @@ bool SQLPTRepresentation::GatherAppType( const std::string& app_id, policy_table::AppHMITypes* app_types) const { Query query(db()); if (!query.Prepare(sql_pt::kSelectAppTypes)) { - LOGGER_WARN(logger_, "Incorrect select from app types"); + SDL_WARN("Incorrect select from app types"); return false; } @@ -1440,7 +1415,7 @@ bool SQLPTRepresentation::GatherRequestType( policy_table::RequestTypes* request_types) const { Query query(db()); if (!query.Prepare(sql_pt::kSelectRequestTypes)) { - LOGGER_WARN(logger_, "Incorrect select from request types."); + SDL_WARN("Incorrect select from request types."); return false; } @@ -1459,7 +1434,7 @@ bool SQLPTRepresentation::GatherNickName( const std::string& app_id, policy_table::Strings* nicknames) const { Query query(db()); if (!query.Prepare(sql_pt::kSelectNicknames)) { - LOGGER_WARN(logger_, "Incorrect select from app nicknames"); + SDL_WARN("Incorrect select from app nicknames"); return false; } @@ -1474,7 +1449,7 @@ bool SQLPTRepresentation::GatherAppGroup( const std::string& app_id, policy_table::Strings* app_groups) const { Query query(db()); if (!query.Prepare(sql_pt::kSelectAppGroups)) { - LOGGER_WARN(logger_, "Incorrect select from app groups"); + SDL_WARN("Incorrect select from app groups"); return false; } @@ -1491,7 +1466,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, bool is_predata) { Query query(db()); if (!query.Prepare(sql_pt::kUpdateApplicationCustomData)) { - LOGGER_WARN(logger_, "Incorrect update in application"); + SDL_WARN("Incorrect update in application"); return false; } @@ -1501,7 +1476,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, query.Bind(3, app_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed update in application"); + SDL_WARN("Failed update in application"); return false; } @@ -1513,13 +1488,13 @@ bool SQLPTRepresentation::IsApplicationRevoked( Query query(db()); if (!query.Prepare(sql_pt::kSelectApplicationRevoked)) { - LOGGER_WARN(logger_, "Incorrect select from is_revoked of application"); + SDL_WARN("Incorrect select from is_revoked of application"); } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed select is_revoked of application"); + SDL_WARN("Failed select is_revoked of application"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -1528,13 +1503,13 @@ bool SQLPTRepresentation::IsApplicationRepresented( const std::string& app_id) const { Query query(db()); if (!query.Prepare(sql_pt::kSelectApplicationRepresented)) { - LOGGER_WARN(logger_, "Incorrect select application by id"); + SDL_WARN("Incorrect select application by id"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed select application by id"); + SDL_WARN("Failed select application by id"); return false; } return query.GetInteger(0) != 0; @@ -1543,13 +1518,13 @@ bool SQLPTRepresentation::IsApplicationRepresented( bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const { Query query(db()); if (!query.Prepare(sql_pt::kSelectApplicationIsDefault)) { - LOGGER_WARN(logger_, "Incorrect select application by id"); + SDL_WARN("Incorrect select application by id"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed select application by id"); + SDL_WARN("Failed select application by id"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -1562,12 +1537,12 @@ bool SQLPTRepresentation::IsPredataPolicy(const std::string& app_id) const { bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { Query query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOGGER_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOGGER_ERROR(logger_, "Failed deleting from app_group."); + SDL_ERROR("Failed deleting from app_group."); return false; } @@ -1587,17 +1562,17 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { bool SQLPTRepresentation::SetIsDefault(const std::string& app_id, bool is_default) const { - LOGGER_TRACE(logger_, "Set flag is_default of application"); + SDL_TRACE("Set flag is_default of application"); Query query(db()); if (!query.Prepare(sql_pt::kUpdateIsDefault)) { - LOGGER_WARN(logger_, "Incorect statement for updating is_default"); + SDL_WARN("Incorect statement for updating is_default"); return false; } query.Bind(0, is_default); query.Bind(1, app_id); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed update is_default"); + SDL_WARN("Failed update is_default"); return false; } return true; @@ -1608,40 +1583,36 @@ void SQLPTRepresentation::RemoveDB() const { } bool SQLPTRepresentation::IsDBVersionActual() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Query query(db()); if (!query.Prepare(sql_pt::kSelectDBVersion) || !query.Exec()) { - LOGGER_ERROR(logger_, - "Failed to get DB version: " << query.LastError().text()); + SDL_ERROR("Failed to get DB version: " << query.LastError().text()); return false; } const int32_t saved_db_version = query.GetInteger(0); const int32_t current_db_version = GetDBVersion(); - LOGGER_DEBUG(logger_, - "Saved DB version is: " << saved_db_version - << ". Current DB vesion is: " - << current_db_version); + SDL_DEBUG("Saved DB version is: " << saved_db_version + << ". Current DB vesion is: " + << current_db_version); return current_db_version == saved_db_version; } bool SQLPTRepresentation::UpdateDBVersion() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Query query(db()); if (!query.Prepare(sql_pt::kUpdateDBVersion)) { - LOGGER_ERROR(logger_, - "Incorrect DB version query: " << query.LastError().text()); + SDL_ERROR("Incorrect DB version query: " << query.LastError().text()); return false; } const int32_t db_version = GetDBVersion(); - LOGGER_DEBUG(logger_, "DB version will be updated to: " << db_version); + SDL_DEBUG("DB version will be updated to: " << db_version); query.Bind(0, db_version); if (!query.Exec()) { - LOGGER_ERROR(logger_, - "DB version getting failed: " << query.LastError().text()); + SDL_ERROR("DB version getting failed: " << query.LastError().text()); return false; } @@ -1667,18 +1638,18 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, const std::string& destination) { Query source_app(db()); if (!source_app.Prepare(sql_pt::kSelectApplicationFull)) { - LOGGER_WARN(logger_, "Incorrect select statement from application."); + SDL_WARN("Incorrect select statement from application."); return false; } source_app.Bind(0, source); if (!source_app.Exec()) { - LOGGER_WARN(logger_, "Failed selecting from application."); + SDL_WARN("Failed selecting from application."); return false; } Query query(db()); if (!query.Prepare(sql_pt::kInsertApplicationFull)) { - LOGGER_WARN(logger_, "Incorrect insert statement into application."); + SDL_WARN("Incorrect insert statement into application."); return false; } query.Bind(0, destination); @@ -1699,7 +1670,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, source_app.IsNull(9) ? query.Bind(10) : query.Bind(10, source_app.GetString(9)); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed inserting into application."); + SDL_WARN("Failed inserting into application."); return false; } return true; @@ -1708,13 +1679,13 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, void SQLPTRepresentation::SetPreloaded(bool value) { Query query(db()); if (!query.Prepare(sql_pt::kUpdatePreloaded)) { - LOGGER_WARN(logger_, "Incorrect statement of updating preloaded."); + SDL_WARN("Incorrect statement of updating preloaded."); return; } query.Bind(0, value); if (!query.Exec()) { - LOGGER_WARN(logger_, "Failed updating preloaded."); + SDL_WARN("Failed updating preloaded."); return; } } diff --git a/src/components/policy/src/update_status_manager.cc b/src/components/policy/src/update_status_manager.cc index 383bad499f..6861f697a7 100644 --- a/src/components/policy/src/update_status_manager.cc +++ b/src/components/policy/src/update_status_manager.cc @@ -36,7 +36,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOGGER("Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) @@ -53,7 +53,7 @@ UpdateStatusManager::UpdateStatusManager() } UpdateStatusManager::~UpdateStatusManager() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(update_status_thread_delegate_); DCHECK(thread_); thread_->join(); @@ -66,7 +66,7 @@ void UpdateStatusManager::set_listener(PolicyListener* listener) { } void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(update_status_thread_delegate_); const unsigned milliseconds_in_second = 1000; update_status_thread_delegate_->updateTimeOut(update_timeout * @@ -77,7 +77,7 @@ void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) { } void UpdateStatusManager::OnUpdateTimeoutOccurs() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); set_update_required(true); set_exchange_in_progress(false); set_exchange_pending(false); @@ -86,14 +86,14 @@ void UpdateStatusManager::OnUpdateTimeoutOccurs() { } void UpdateStatusManager::OnValidUpdateReceived() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); update_status_thread_delegate_->updateTimeOut(0); // Stop Timer set_exchange_pending(false); set_exchange_in_progress(false); } void UpdateStatusManager::OnWrongUpdateReceived() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); update_status_thread_delegate_->updateTimeOut(0); // Stop Timer set_update_required(true); set_exchange_in_progress(false); @@ -101,7 +101,7 @@ void UpdateStatusManager::OnWrongUpdateReceived() { } void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); exchange_in_progress_ = false; update_required_ = is_update_required; exchange_pending_ = false; @@ -109,7 +109,7 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { } void UpdateStatusManager::OnResetRetrySequence() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (exchange_in_progress_) { set_exchange_pending(true); } @@ -117,17 +117,17 @@ void UpdateStatusManager::OnResetRetrySequence() { } void UpdateStatusManager::OnNewApplicationAdded() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); set_update_required(true); } void UpdateStatusManager::OnPolicyInit(bool is_update_required) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); update_required_ = is_update_required; } PolicyTableStatus UpdateStatusManager::GetUpdateStatus() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!exchange_in_progress_ && !exchange_pending_ && !update_required_) { return PolicyTableStatus::StatusUpToDate; } @@ -169,28 +169,28 @@ std::string UpdateStatusManager::StringifiedUpdateStatus() const { } void policy::UpdateStatusManager::OnAppsSearchStarted() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); apps_search_in_progress_ = true; } void policy::UpdateStatusManager::OnAppsSearchCompleted() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); apps_search_in_progress_ = false; } bool policy::UpdateStatusManager::IsAppsSearchInProgress() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); return apps_search_in_progress_; } void UpdateStatusManager::CheckUpdateStatus() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); policy::PolicyTableStatus status = GetUpdateStatus(); if (listener_ && last_update_status_ != status) { - LOGGER_INFO(logger_, "Send OnUpdateStatusChanged"); + SDL_INFO("Send OnUpdateStatusChanged"); listener_->OnUpdateStatusChanged(StringifiedUpdateStatus()); } last_update_status_ = status; @@ -198,22 +198,21 @@ void UpdateStatusManager::CheckUpdateStatus() { void UpdateStatusManager::set_exchange_in_progress(bool value) { sync_primitives::AutoLock lock(exchange_in_progress_lock_); - LOGGER_INFO(logger_, - "Exchange in progress value is:" << std::boolalpha << value); + SDL_INFO("Exchange in progress value is:" << std::boolalpha << value); exchange_in_progress_ = value; CheckUpdateStatus(); } void UpdateStatusManager::set_exchange_pending(bool value) { sync_primitives::AutoLock lock(exchange_pending_lock_); - LOGGER_INFO(logger_, "Exchange pending value is:" << std::boolalpha << value); + SDL_INFO("Exchange pending value is:" << std::boolalpha << value); exchange_pending_ = value; CheckUpdateStatus(); } void UpdateStatusManager::set_update_required(bool value) { sync_primitives::AutoLock lock(update_required_lock_); - LOGGER_INFO(logger_, "Update required value is:" << std::boolalpha << value); + SDL_INFO("Update required value is:" << std::boolalpha << value); update_required_ = value; CheckUpdateStatus(); } @@ -224,19 +223,19 @@ UpdateStatusManager::UpdateThreadDelegate::UpdateThreadDelegate( , stop_flag_(false) , state_lock_(false) , update_status_manager_(update_status_manager) { - LOGGER_INFO(logger_, "Create UpdateThreadDelegate"); + SDL_INFO("Create UpdateThreadDelegate"); } UpdateStatusManager::UpdateThreadDelegate::~UpdateThreadDelegate() { - LOGGER_INFO(logger_, "Delete UpdateThreadDelegate"); + SDL_INFO("Delete UpdateThreadDelegate"); } void UpdateStatusManager::UpdateThreadDelegate::threadMain() { - LOGGER_DEBUG(logger_, "UpdateStatusManager thread started (started normal)"); + SDL_DEBUG("UpdateStatusManager thread started (started normal)"); sync_primitives::AutoLock auto_lock(state_lock_); while (false == stop_flag_) { if (timeout_ > 0) { - LOGGER_DEBUG(logger_, "Timeout is greater then 0"); + SDL_DEBUG("Timeout is greater then 0"); sync_primitives::ConditionalVariable::WaitStatus wait_status = termination_condition_.WaitFor(auto_lock, timeout_); if (sync_primitives::ConditionalVariable::kTimeout == wait_status) { @@ -256,7 +255,7 @@ void UpdateStatusManager::UpdateThreadDelegate::threadMain() { void UpdateStatusManager::UpdateThreadDelegate::exitThreadMain() { sync_primitives::AutoLock auto_lock(state_lock_); stop_flag_ = true; - LOGGER_INFO(logger_, "before notify"); + SDL_INFO("before notify"); termination_condition_.NotifyOne(); } diff --git a/src/components/protocol/src/rpc_type.cc b/src/components/protocol/src/rpc_type.cc index 656790dcf7..cecef2712a 100644 --- a/src/components/protocol/src/rpc_type.cc +++ b/src/components/protocol/src/rpc_type.cc @@ -37,7 +37,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOGGER("ProtocolHandler") namespace { bool IsSupported(RpcType rpc_type) { @@ -56,7 +56,7 @@ RpcType RpcTypeFromByte(uint8_t byte) { RpcType type = RpcType(byte); bool supported_type = IsSupported(type); if (!supported_type) { - LOGGER_INFO(logger_, "Invalid service type: " << int32_t(byte)); + SDL_INFO("Invalid service type: " << int32_t(byte)); } return supported_type ? type : kRpcTypeReserved; diff --git a/src/components/protocol/src/service_type.cc b/src/components/protocol/src/service_type.cc index 07657d336a..518f2db3cc 100644 --- a/src/components/protocol/src/service_type.cc +++ b/src/components/protocol/src/service_type.cc @@ -36,7 +36,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler") +SDL_CREATE_LOGGER("ConnectionHandler") namespace { // Check if provided service value is one of the specified @@ -58,7 +58,7 @@ ServiceType ServiceTypeFromByte(uint8_t byte) { ServiceType type = ServiceType(byte); const bool valid_type = IsValid(type); if (!valid_type) { - LOGGER_INFO(logger_, "Invalid service type: " << int32_t(byte)); + SDL_INFO("Invalid service type: " << int32_t(byte)); } return valid_type ? type : kInvalidServiceType; } diff --git a/src/components/protocol_handler/src/incoming_data_handler.cc b/src/components/protocol_handler/src/incoming_data_handler.cc index 43c6a1b149..0fe87046e4 100644 --- a/src/components/protocol_handler/src/incoming_data_handler.cc +++ b/src/components/protocol_handler/src/incoming_data_handler.cc @@ -37,7 +37,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOGGER("ProtocolHandler") IncomingDataHandler::IncomingDataHandler() : header_(), validator_(NULL), last_portion_of_data_was_malformed_(false) {} @@ -54,7 +54,7 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData( const RawMessage& tm_message, RESULT_CODE* result, size_t* malformed_occurrence) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(result); DCHECK(malformed_occurrence); const transport_manager::ConnectionUID connection_id = @@ -62,41 +62,35 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData( const uint8_t* data = tm_message.data(); const size_t tm_message_size = tm_message.data_size(); if (tm_message_size == 0 || data == NULL) { - LOGGER_WARN(logger_, "Wrong raw message " << tm_message_size << " bytes"); + SDL_WARN("Wrong raw message " << tm_message_size << " bytes"); *result = RESULT_FAIL; return ProtocolFramePtrList(); } - LOGGER_INFO(logger_, - "Processing incoming data of size " - << tm_message_size << " for connection " << connection_id); + SDL_INFO("Processing incoming data of size " + << tm_message_size << " for connection " << connection_id); ConnectionsDataMap::iterator it = connections_data_.find(connection_id); if (connections_data_.end() == it) { - LOGGER_WARN(logger_, "ProcessData requested for unknown connection"); + SDL_WARN("ProcessData requested for unknown connection"); *result = RESULT_FAIL; return ProtocolFramePtrList(); } std::vector<uint8_t>& connection_data = it->second; connection_data.insert(connection_data.end(), data, data + tm_message_size); - LOGGER_DEBUG(logger_, - "Total data size for connection " << connection_id << " is " - << connection_data.size()); + SDL_DEBUG("Total data size for connection " << connection_id << " is " + << connection_data.size()); ProtocolFramePtrList out_frames; *malformed_occurrence = 0; *result = CreateFrame( connection_data, out_frames, *malformed_occurrence, connection_id); - LOGGER_DEBUG(logger_, - "New data size for connection " << connection_id << " is " - << connection_data.size()); + SDL_DEBUG("New data size for connection " << connection_id << " is " + << connection_data.size()); if (!out_frames.empty()) { - LOGGER_INFO(logger_, - "Created and passed " << out_frames.size() << " packets"); + SDL_INFO("Created and passed " << out_frames.size() << " packets"); } else { if (RESULT_DEFERRED == *result) { - LOGGER_DEBUG( - logger_, - "No packets have been created. Waiting next portion of data."); + SDL_DEBUG("No packets have been created. Waiting next portion of data."); } else { - LOGGER_WARN(logger_, "No packets have been created."); + SDL_WARN("No packets have been created."); } } if (*malformed_occurrence > 0u || last_portion_of_data_was_malformed_) { @@ -109,14 +103,14 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData( void IncomingDataHandler::AddConnection( const transport_manager::ConnectionUID connection_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // Add empty list of session to new connection connections_data_[connection_id] = ConnectionsDataMap::mapped_type(); } void IncomingDataHandler::RemoveConnection( const transport_manager::ConnectionUID connection_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); connections_data_.erase(connection_id); } @@ -130,8 +124,7 @@ uint32_t IncomingDataHandler::GetPacketSize( case PROTOCOL_VERSION_4: return header.dataSize + PROTOCOL_HEADER_V2_SIZE; default: - LOGGER_WARN(logger_, - "Unknown version: " << static_cast<int>(header.version)); + SDL_WARN("Unknown version: " << static_cast<int>(header.version)); break; } return 0u; @@ -142,7 +135,7 @@ RESULT_CODE IncomingDataHandler::CreateFrame( ProtocolFramePtrList& out_frames, size_t& malformed_occurrence, const transport_manager::ConnectionUID connection_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::vector<uint8_t>::iterator data_it = incoming_data.begin(); size_t data_size = incoming_data.size(); @@ -152,51 +145,47 @@ RESULT_CODE IncomingDataHandler::CreateFrame( validator_ ? validator_->validate(header_) : RESULT_OK; if (validate_result != RESULT_OK) { - LOGGER_WARN(logger_, "Packet validation failed"); + SDL_WARN("Packet validation failed"); if (!last_portion_of_data_was_malformed_) { ++malformed_occurrence; - LOGGER_DEBUG(logger_, - "Malformed message found " << malformed_occurrence); + SDL_DEBUG("Malformed message found " << malformed_occurrence); } last_portion_of_data_was_malformed_ = true; ++data_it; --data_size; - LOGGER_DEBUG(logger_, - "Moved to the next byte " - << std::hex << static_cast<const void*>(&*data_it)); + SDL_DEBUG("Moved to the next byte " + << std::hex << static_cast<const void*>(&*data_it)); continue; } - LOGGER_DEBUG(logger_, "Payload size " << header_.dataSize); + SDL_DEBUG("Payload size " << header_.dataSize); const uint32_t packet_size = GetPacketSize(header_); if (packet_size <= 0) { - LOGGER_WARN(logger_, "Null packet size"); + SDL_WARN("Null packet size"); ++data_it; --data_size; - LOGGER_DEBUG(logger_, - "Moved to the next byte " - << std::hex << static_cast<const void*>(&*data_it)); + SDL_DEBUG("Moved to the next byte " + << std::hex << static_cast<const void*>(&*data_it)); continue; } if (data_size < packet_size) { - LOGGER_DEBUG(logger_, "Packet data is not available yet"); + SDL_DEBUG("Packet data is not available yet"); incoming_data.erase(incoming_data.begin(), data_it); return RESULT_DEFERRED; } ProtocolFramePtr frame(new protocol_handler::ProtocolPacket(connection_id)); const RESULT_CODE deserialize_result = frame->deserializePacket(&*data_it, packet_size); - LOGGER_DEBUG(logger_, "Deserialized frame " << frame); + SDL_DEBUG("Deserialized frame " << frame); if (deserialize_result != RESULT_OK) { - LOGGER_WARN(logger_, "Packet deserialization failed"); + SDL_WARN("Packet deserialization failed"); incoming_data.erase(incoming_data.begin(), data_it); return RESULT_FAIL; } out_frames.push_back(frame); last_portion_of_data_was_malformed_ = false; - LOGGER_DEBUG(logger_, - "Frame added. " - << "Connection ID " << connection_id); + SDL_DEBUG("Frame added. " + << "Connection ID " << connection_id); data_it += packet_size; data_size -= packet_size; diff --git a/src/components/protocol_handler/src/multiframe_builder.cc b/src/components/protocol_handler/src/multiframe_builder.cc index 45bd9409cb..e066bc05e6 100644 --- a/src/components/protocol_handler/src/multiframe_builder.cc +++ b/src/components/protocol_handler/src/multiframe_builder.cc @@ -41,7 +41,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOGGER("ProtocolHandler") MultiFrameBuilder::MultiFrameBuilder() : consecutive_frame_wait_msecs_(0u) {} @@ -50,19 +50,18 @@ void MultiFrameBuilder::set_waiting_timeout( consecutive_frame_wait_msecs_ = static_cast<int64_t>(consecutive_frame_wait_msecs); if (consecutive_frame_wait_msecs == 0) { - LOGGER_WARN(logger_, "Waiting timout disabled"); + SDL_WARN("Waiting timout disabled"); } else { - LOGGER_DEBUG(logger_, - "Waiting time in msec: " << consecutive_frame_wait_msecs_); + SDL_DEBUG("Waiting time in msec: " << consecutive_frame_wait_msecs_); } } bool MultiFrameBuilder::AddConnection(const ConnectionID connection_id) { - LOGGER_DEBUG(logger_, "Adding connection_id: " << connection_id); - LOGGER_DEBUG(logger_, "Current state is: " << multiframes_map_); + SDL_DEBUG("Adding connection_id: " << connection_id); + SDL_DEBUG("Current state is: " << multiframes_map_); const MultiFrameMap::const_iterator it = multiframes_map_.find(connection_id); if (it != multiframes_map_.end()) { - LOGGER_ERROR(logger_, "Exists connection_id: " << connection_id); + SDL_ERROR("Exists connection_id: " << connection_id); return false; } multiframes_map_[connection_id] = SessionToFrameMap(); @@ -70,62 +69,59 @@ bool MultiFrameBuilder::AddConnection(const ConnectionID connection_id) { } bool MultiFrameBuilder::RemoveConnection(const ConnectionID connection_id) { - LOGGER_DEBUG(logger_, "Removing connection_id: " << connection_id); - LOGGER_DEBUG(logger_, "Current state is: " << multiframes_map_); + SDL_DEBUG("Removing connection_id: " << connection_id); + SDL_DEBUG("Current state is: " << multiframes_map_); const MultiFrameMap::iterator it = multiframes_map_.find(connection_id); if (it == multiframes_map_.end()) { - LOGGER_ERROR(logger_, "Non-existent connection_id: " << connection_id); + SDL_ERROR("Non-existent connection_id: " << connection_id); return false; } const SessionToFrameMap& session_to_frame_map = it->second; if (!session_to_frame_map.empty()) { // FIXME(EZamakhov): Ask ReqManager - do we need to send GenericError - LOGGER_WARN(logger_, - "For connection_id: " << connection_id - << " waiting: " << multiframes_map_); + SDL_WARN("For connection_id: " << connection_id + << " waiting: " << multiframes_map_); } multiframes_map_.erase(it); return true; } ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Current state is: " << multiframes_map_); + SDL_AUTO_TRACE(); + SDL_DEBUG("Current state is: " << multiframes_map_); ProtocolFramePtrList outpute_frame_list; for (MultiFrameMap::iterator connection_it = multiframes_map_.begin(); connection_it != multiframes_map_.end(); ++connection_it) { - LOGGER_TRACE(logger_, "Step over connection: " << connection_it->first); + SDL_TRACE("Step over connection: " << connection_it->first); SessionToFrameMap& session_map = connection_it->second; for (SessionToFrameMap::iterator session_it = session_map.begin(); session_it != session_map.end(); ++session_it) { - LOGGER_TRACE( - logger_, - "Step over session: " << static_cast<int>(session_it->first)); + SDL_TRACE("Step over session: " << static_cast<int>(session_it->first)); MessageIDToFrameMap& messageId_map = session_it->second; MessageIDToFrameMap::iterator messageId_it = messageId_map.begin(); while (messageId_it != messageId_map.end()) { - LOGGER_TRACE(logger_, "Step over messageId: " << messageId_it->first); + SDL_TRACE("Step over messageId: " << messageId_it->first); ProtocolFrameData& frame_data = messageId_it->second; ProtocolFramePtr frame = frame_data.frame; if (frame && frame->frame_data() == FRAME_DATA_LAST_CONSECUTIVE && frame->payload_size() > 0u) { - LOGGER_DEBUG(logger_, "Ready frame: " << frame); + SDL_DEBUG("Ready frame: " << frame); outpute_frame_list.push_back(frame); messageId_map.erase(messageId_it++); continue; } if (consecutive_frame_wait_msecs_ != 0) { - LOGGER_TRACE(logger_, "Expiration verification"); + SDL_TRACE("Expiration verification"); const int64_t time_left = date_time::DateTime::calculateTimeSpan(frame_data.append_time); - LOGGER_DEBUG(logger_, "mSecs left: " << time_left); + SDL_DEBUG("mSecs left: " << time_left); if (time_left >= consecutive_frame_wait_msecs_) { - LOGGER_WARN(logger_, "Expired frame: " << frame); + SDL_WARN("Expired frame: " << frame); outpute_frame_list.push_back(frame); messageId_map.erase(messageId_it++); continue; @@ -135,27 +131,27 @@ ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() { } // iteration over messageId_map } // iteration over session_map } // iteration over multiframes_map_ - LOGGER_DEBUG(logger_, "Result frames count: " << outpute_frame_list.size()); + SDL_DEBUG("Result frames count: " << outpute_frame_list.size()); return outpute_frame_list; } RESULT_CODE MultiFrameBuilder::AddFrame(const ProtocolFramePtr packet) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Handling frame: " << packet); - LOGGER_DEBUG(logger_, "Current state is: " << multiframes_map_); + SDL_AUTO_TRACE(); + SDL_DEBUG("Handling frame: " << packet); + SDL_DEBUG("Current state is: " << multiframes_map_); if (!packet) { - LOGGER_ERROR(logger_, "Skip empty frame"); + SDL_ERROR("Skip empty frame"); return RESULT_FAIL; } switch (packet->frame_type()) { case FRAME_TYPE_FIRST: - LOGGER_TRACE(logger_, "FRAME_TYPE_FIRST"); + SDL_TRACE("FRAME_TYPE_FIRST"); return HandleFirstFrame(packet); case FRAME_TYPE_CONSECUTIVE: - LOGGER_TRACE(logger_, "FRAME_TYPE_CONSECUTIVE"); + SDL_TRACE("FRAME_TYPE_CONSECUTIVE"); return HandleConsecutiveFrame(packet); default: - LOGGER_ERROR(logger_, "Frame is not FIRST or CONSECUTIVE :" << packet); + SDL_ERROR("Frame is not FIRST or CONSECUTIVE :" << packet); break; } return RESULT_FAIL; @@ -163,17 +159,17 @@ RESULT_CODE MultiFrameBuilder::AddFrame(const ProtocolFramePtr packet) { RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) { DCHECK_OR_RETURN(packet->frame_type() == FRAME_TYPE_FIRST, RESULT_FAIL); - LOGGER_DEBUG(logger_, "Waiting : " << multiframes_map_); - LOGGER_DEBUG(logger_, "Handling FIRST frame: " << packet); + SDL_DEBUG("Waiting : " << multiframes_map_); + SDL_DEBUG("Handling FIRST frame: " << packet); if (packet->payload_size() != 0u) { - LOGGER_ERROR(logger_, "First frame shall have no data:" << packet); + SDL_ERROR("First frame shall have no data:" << packet); return RESULT_FAIL; } const ConnectionID connection_id = packet->connection_id(); MultiFrameMap::iterator connection_it = multiframes_map_.find(connection_id); if (connection_it == multiframes_map_.end()) { - LOGGER_ERROR(logger_, "Unknown connection_id: " << connection_id); + SDL_ERROR("Unknown connection_id: " << connection_id); return RESULT_FAIL; } SessionToFrameMap& session_map = connection_it->second; @@ -185,19 +181,16 @@ RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) { const MessageID message_id = packet->message_id(); MessageIDToFrameMap::iterator messageId_it = messageId_map.find(message_id); if (messageId_it != messageId_map.end()) { - LOGGER_ERROR(logger_, - "Already waiting message for connection_id: " - << connection_id - << ", session_id: " << static_cast<int>(session_id) - << ", message_id: " << message_id); + SDL_ERROR("Already waiting message for connection_id: " + << connection_id + << ", session_id: " << static_cast<int>(session_id) + << ", message_id: " << message_id); return RESULT_FAIL; } - LOGGER_DEBUG(logger_, - "Start waiting frames for connection_id: " - << connection_id - << ", session_id: " << static_cast<int>(session_id) - << ", message_id: " << message_id); + SDL_DEBUG("Start waiting frames for connection_id: " + << connection_id << ", session_id: " << static_cast<int>(session_id) + << ", message_id: " << message_id); ProtocolFrameData frame_data; frame_data.frame = packet; frame_data.append_time = date_time::DateTime::getCurrentTime(); @@ -208,12 +201,12 @@ RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) { RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( const ProtocolFramePtr packet) { DCHECK_OR_RETURN(packet->frame_type() == FRAME_TYPE_CONSECUTIVE, RESULT_FAIL); - LOGGER_DEBUG(logger_, "Handling CONSECUTIVE frame: " << packet); + SDL_DEBUG("Handling CONSECUTIVE frame: " << packet); const ConnectionID connection_id = packet->connection_id(); MultiFrameMap::iterator connection_it = multiframes_map_.find(connection_id); if (connection_it == multiframes_map_.end()) { - LOGGER_ERROR(logger_, "Unknown connection_id: " << connection_id); + SDL_ERROR("Unknown connection_id: " << connection_id); return RESULT_FAIL; } SessionToFrameMap& session_map = connection_it->second; @@ -225,11 +218,10 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( const MessageID message_id = packet->message_id(); MessageIDToFrameMap::iterator messageId_it = messageId_map.find(message_id); if (messageId_it == messageId_map.end()) { - LOGGER_ERROR(logger_, - "No waiting message for connection_id: " - << connection_id - << ", session_id: " << static_cast<int>(session_id) - << ", message_id: " << message_id); + SDL_ERROR("No waiting message for connection_id: " + << connection_id + << ", session_id: " << static_cast<int>(session_id) + << ", message_id: " << message_id); return RESULT_FAIL; } @@ -244,7 +236,7 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( if (is_last_consecutive) { // TODO(EZamakhov): implement count of frames and result size verification - LOGGER_DEBUG(logger_, "Last CONSECUTIVE frame"); + SDL_DEBUG("Last CONSECUTIVE frame"); } else { uint8_t previous_frame_data = assembling_frame->frame_data(); if (previous_frame_data == std::numeric_limits<uint8_t>::max()) { @@ -252,34 +244,29 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( } // The next frame data is bigger at 1 if (new_frame_data != (previous_frame_data + 1)) { - LOGGER_ERROR(logger_, - "Unexpected CONSECUTIVE frame for connection_id: " - << connection_id - << ", session_id: " << static_cast<int>(session_id) - << ", message_id: " << message_id - << ", frame: " << packet); + SDL_ERROR("Unexpected CONSECUTIVE frame for connection_id: " + << connection_id + << ", session_id: " << static_cast<int>(session_id) + << ", message_id: " << message_id << ", frame: " << packet); return RESULT_FAIL; } } assembling_frame->set_frame_data(new_frame_data); - LOGGER_DEBUG(logger_, - "Appending " << packet->data_size() << " bytes " - << "; frame_data " - << static_cast<int>(new_frame_data) - << "; for connection_id: " << connection_id - << ", session_id: " << static_cast<int>(session_id) - << ", message_id: " << message_id); + SDL_DEBUG("Appending " << packet->data_size() << " bytes " + << "; frame_data " << static_cast<int>(new_frame_data) + << "; for connection_id: " << connection_id + << ", session_id: " << static_cast<int>(session_id) + << ", message_id: " << message_id); if (assembling_frame->appendData(packet->data(), packet->data_size()) != RESULT_OK) { - LOGGER_ERROR(logger_, "Failed to append frame for multiframe message."); + SDL_ERROR("Failed to append frame for multiframe message."); return RESULT_FAIL; } - LOGGER_INFO(logger_, - "Assembled frame with payload size: " - << assembling_frame->payload_size()); + SDL_INFO("Assembled frame with payload size: " + << assembling_frame->payload_size()); frame_data.append_time = date_time::DateTime::getCurrentTime(); return RESULT_OK; } diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 3aed457ee8..512db68fa5 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -47,7 +47,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOGGER("ProtocolHandler") /** * Function return packet data as std::string. @@ -83,7 +83,7 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( #endif // TELEMETRY_MONITOR { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); protocol_header_validator_.set_max_payload_size( get_settings().maximum_payload_size()); incoming_data_handler_.set_validator(&protocol_header_validator_); @@ -95,12 +95,11 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( if (message_frequency_time > 0u && message_frequency_count > 0u) { message_meter_.set_time_range(message_frequency_time); - LOGGER_DEBUG(logger_, - "Frequency meter is enabled ( " - << message_frequency_count << " per " - << message_frequency_time << " mSecond)"); + SDL_DEBUG("Frequency meter is enabled ( " + << message_frequency_count << " per " << message_frequency_time + << " mSecond)"); } else { - LOGGER_WARN(logger_, "Frequency meter is disabled"); + SDL_WARN("Frequency meter is disabled"); } const size_t& malformed_frequency_time = @@ -111,18 +110,16 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( if (get_settings().malformed_message_filtering()) { if (malformed_frequency_time > 0u && malformed_frequency_count > 0u) { malformed_message_meter_.set_time_range(malformed_frequency_time); - LOGGER_DEBUG(logger_, - "Malformed frequency meter is enabled ( " - << malformed_frequency_count << " per " - << malformed_frequency_time << " mSecond)"); + SDL_DEBUG("Malformed frequency meter is enabled ( " + << malformed_frequency_count << " per " + << malformed_frequency_time << " mSecond)"); } else { - LOGGER_WARN(logger_, "Malformed frequency meter is disabled"); + SDL_WARN("Malformed frequency meter is disabled"); } } else { - LOGGER_WARN( - logger_, + SDL_WARN( "Malformed message filtering is disabled." - << "Connection will be close on first malformed message detection"); + << "Connection will be close on first malformed message detection"); } multiframe_builder_.set_waiting_timeout( get_settings().multiframe_waiting_timeout()); @@ -131,15 +128,15 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( ProtocolHandlerImpl::~ProtocolHandlerImpl() { sync_primitives::AutoLock lock(protocol_observers_lock_); if (!protocol_observers_.empty()) { - LOGGER_WARN(logger_, - "Not all observers have unsubscribed" - " from ProtocolHandlerImpl"); + SDL_WARN( + "Not all observers have unsubscribed" + " from ProtocolHandlerImpl"); } } void ProtocolHandlerImpl::AddProtocolObserver(ProtocolObserver* observer) { if (!observer) { - LOGGER_ERROR(logger_, "Invalid (NULL) pointer to IProtocolObserver."); + SDL_ERROR("Invalid (NULL) pointer to IProtocolObserver."); return; } sync_primitives::AutoLock lock(protocol_observers_lock_); @@ -147,9 +144,9 @@ void ProtocolHandlerImpl::AddProtocolObserver(ProtocolObserver* observer) { } void ProtocolHandlerImpl::RemoveProtocolObserver(ProtocolObserver* observer) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!observer) { - LOGGER_ERROR(logger_, "Invalid (NULL) pointer to IProtocolObserver."); + SDL_ERROR("Invalid (NULL) pointer to IProtocolObserver."); return; } sync_primitives::AutoLock lock(protocol_observers_lock_); @@ -161,13 +158,11 @@ void set_hash_id(uint32_t hash_id, protocol_handler::ProtocolPacket& packet) { return; } if (packet.protocol_version() < PROTOCOL_VERSION_2) { - LOGGER_DEBUG(logger_, - "Packet needs no hash data (protocol version less 2)"); + SDL_DEBUG("Packet needs no hash data (protocol version less 2)"); return; } - LOGGER_DEBUG(logger_, - "Set hash_id 0x" << std::hex << hash_id << " to the packet 0x" - << &packet); + SDL_DEBUG("Set hash_id 0x" << std::hex << hash_id << " to the packet 0x" + << &packet); // Hash id shall be 4 bytes according Ford Protocol v8 DCHECK(sizeof(hash_id) == 4); const uint32_t hash_id_be = LE_TO_BE32(hash_id); @@ -181,7 +176,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(ConnectionID connection_id, uint32_t hash_id, uint8_t service_type, bool protection) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint8_t protocolVersion = SupportedSDLProtocolVersion(); @@ -201,19 +196,18 @@ void ProtocolHandlerImpl::SendStartSessionAck(ConnectionID connection_id, raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOGGER_DEBUG(logger_, - "SendStartSessionAck() for connection " - << connection_id << " for service_type " - << static_cast<int32_t>(service_type) << " session_id " - << static_cast<int32_t>(session_id) << " protection " - << (protection ? "ON" : "OFF")); + SDL_DEBUG("SendStartSessionAck() for connection " + << connection_id << " for service_type " + << static_cast<int32_t>(service_type) << " session_id " + << static_cast<int32_t>(session_id) << " protection " + << (protection ? "ON" : "OFF")); } void ProtocolHandlerImpl::SendStartSessionNAck(ConnectionID connection_id, uint8_t session_id, uint8_t protocol_version, uint8_t service_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ProtocolFramePtr ptr( new protocol_handler::ProtocolPacket(connection_id, @@ -229,18 +223,17 @@ void ProtocolHandlerImpl::SendStartSessionNAck(ConnectionID connection_id, raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOGGER_DEBUG(logger_, - "SendStartSessionNAck() for connection " - << connection_id << " for service_type " - << static_cast<int32_t>(service_type) << " session_id " - << static_cast<int32_t>(session_id)); + SDL_DEBUG("SendStartSessionNAck() for connection " + << connection_id << " for service_type " + << static_cast<int32_t>(service_type) << " session_id " + << static_cast<int32_t>(session_id)); } void ProtocolHandlerImpl::SendEndSessionNAck(ConnectionID connection_id, uint32_t session_id, uint8_t protocol_version, uint8_t service_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ProtocolFramePtr ptr( new protocol_handler::ProtocolPacket(connection_id, @@ -256,11 +249,10 @@ void ProtocolHandlerImpl::SendEndSessionNAck(ConnectionID connection_id, raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOGGER_DEBUG(logger_, - "SendEndSessionNAck() for connection " - << connection_id << " for service_type " - << static_cast<int32_t>(service_type) << " session_id " - << static_cast<int32_t>(session_id)); + SDL_DEBUG("SendEndSessionNAck() for connection " + << connection_id << " for service_type " + << static_cast<int32_t>(service_type) << " session_id " + << static_cast<int32_t>(session_id)); } SessionObserver& ProtocolHandlerImpl::get_session_observer() { @@ -271,7 +263,7 @@ void ProtocolHandlerImpl::SendEndSessionAck(ConnectionID connection_id, uint8_t session_id, uint8_t protocol_version, uint8_t service_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ProtocolFramePtr ptr( new protocol_handler::ProtocolPacket(connection_id, @@ -287,17 +279,16 @@ void ProtocolHandlerImpl::SendEndSessionAck(ConnectionID connection_id, raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOGGER_DEBUG(logger_, - "SendEndSessionAck() for connection " - << connection_id << " for service_type " - << static_cast<int32_t>(service_type) << " session_id " - << static_cast<int32_t>(session_id)); + SDL_DEBUG("SendEndSessionAck() for connection " + << connection_id << " for service_type " + << static_cast<int32_t>(service_type) << " session_id " + << static_cast<int32_t>(session_id)); } void ProtocolHandlerImpl::SendEndServicePrivate(int32_t connection_id, uint8_t session_id, uint8_t service_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint8_t protocol_version; if (session_observer_.ProtocolVersionUsed( @@ -315,14 +306,11 @@ void ProtocolHandlerImpl::SendEndServicePrivate(int32_t connection_id, raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOGGER_DEBUG(logger_, - "SendEndSession() for connection " - << connection_id << " for service_type " << service_type - << " session_id " << static_cast<int32_t>(session_id)); + SDL_DEBUG("SendEndSession() for connection " + << connection_id << " for service_type " << service_type + << " session_id " << static_cast<int32_t>(session_id)); } else { - LOGGER_WARN( - logger_, - "SendEndSession is failed connection or session does not exist"); + SDL_WARN("SendEndSession is failed connection or session does not exist"); } } @@ -340,7 +328,7 @@ void ProtocolHandlerImpl::SendEndService(int32_t connection_id, RESULT_CODE ProtocolHandlerImpl::SendHeartBeatAck(ConnectionID connection_id, uint8_t session_id, uint32_t message_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint8_t protocol_version; if (session_observer_.ProtocolVersionUsed( @@ -360,15 +348,13 @@ RESULT_CODE ProtocolHandlerImpl::SendHeartBeatAck(ConnectionID connection_id, impl::RawFordMessageToMobile(ptr, false)); return RESULT_OK; } - LOGGER_WARN( - logger_, - "SendHeartBeatAck is failed connection or session does not exist"); + SDL_WARN("SendHeartBeatAck is failed connection or session does not exist"); return RESULT_FAIL; } void ProtocolHandlerImpl::SendHeartBeat(int32_t connection_id, uint8_t session_id) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); uint8_t protocol_version; if (session_observer_.ProtocolVersionUsed( connection_id, session_id, protocol_version)) { @@ -384,10 +370,9 @@ void ProtocolHandlerImpl::SendHeartBeat(int32_t connection_id, message_counters_[session_id]++)); raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOGGER_DEBUG(logger_, "SendHeartBeat finished successfully"); + SDL_DEBUG("SendHeartBeat finished successfully"); } else { - LOGGER_WARN(logger_, - "SendHeartBeat is failed connection or session does not exist"); + SDL_WARN("SendHeartBeat is failed connection or session does not exist"); } } @@ -396,10 +381,9 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, #ifdef TELEMETRY_MONITOR const TimevalStruct start_time = date_time::DateTime::getCurrentTime(); #endif // TELEMETRY_MONITOR - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!message) { - LOGGER_ERROR(logger_, - "Invalid message for sending to mobile app is received."); + SDL_ERROR("Invalid message for sending to mobile app is received."); return; } @@ -434,15 +418,12 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, DCHECK(max_block_size > 0); if (max_block_size > 0) { frame_size = max_block_size; - LOGGER_DEBUG(logger_, - "Security set new optimal packet size " << frame_size); + SDL_DEBUG("Security set new optimal packet size " << frame_size); } else { - LOGGER_ERROR( - logger_, - "Security could not return max block size, use the origin one"); + SDL_ERROR("Security could not return max block size, use the origin one"); } } - LOGGER_DEBUG(logger_, "Optimal packet size is " << frame_size); + SDL_DEBUG("Optimal packet size is " << frame_size); #endif // ENABLE_SECURITY if (message->data_size() <= frame_size) { @@ -454,13 +435,11 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, message->data(), final_message); if (result != RESULT_OK) { - LOGGER_ERROR(logger_, - "ProtocolHandler failed to send single frame message."); + SDL_ERROR("ProtocolHandler failed to send single frame message."); } } else { - LOGGER_DEBUG(logger_, - "Message will be sent in multiple frames; max frame size is " - << frame_size); + SDL_DEBUG("Message will be sent in multiple frames; max frame size is " + << frame_size); RESULT_CODE result = SendMultiFrameMessage(connection_handle, sessionID, @@ -471,8 +450,7 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, frame_size, final_message); if (result != RESULT_OK) { - LOGGER_ERROR(logger_, - "ProtocolHandler failed to send multiframe messages."); + SDL_ERROR("ProtocolHandler failed to send multiframe messages."); } } #ifdef TELEMETRY_MONITOR @@ -488,33 +466,29 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, } void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!tm_message) { - LOGGER_ERROR(logger_, - "Invalid incoming message received in" - << " ProtocolHandler from Transport Manager."); + SDL_ERROR("Invalid incoming message received in" + << " ProtocolHandler from Transport Manager."); return; } const uint32_t connection_key = tm_message->connection_key(); - LOGGER_DEBUG(logger_, - "Received data from TM with connection id " - << connection_key << " msg data_size " - << tm_message->data_size()); + SDL_DEBUG("Received data from TM with connection id " + << connection_key << " msg data_size " << tm_message->data_size()); RESULT_CODE result; size_t malformed_occurs = 0u; const ProtocolFramePtrList protocol_frames = incoming_data_handler_.ProcessData( *tm_message, &result, &malformed_occurs); - LOGGER_DEBUG(logger_, "Proccessed " << protocol_frames.size() << " frames"); + SDL_DEBUG("Proccessed " << protocol_frames.size() << " frames"); if (result != RESULT_OK) { if (result == RESULT_MALFORMED_OCCURS) { - LOGGER_WARN(logger_, - "Malformed message occurs, connection id " << connection_key); + SDL_WARN("Malformed message occurs, connection id " << connection_key); if (!get_settings().malformed_message_filtering()) { - LOGGER_DEBUG(logger_, "Malformed message filterign disabled"); + SDL_DEBUG("Malformed message filterign disabled"); session_observer_.OnMalformedMessageCallback(connection_key); // For tracking only malformed occurrence check outpute } else { @@ -523,7 +497,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) { } } } else { - LOGGER_ERROR(logger_, "Incoming data processing failed."); + SDL_ERROR("Incoming data processing failed."); transport_manager_.DisconnectForce(connection_key); } } @@ -538,7 +512,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) { #ifdef ENABLE_SECURITY const RESULT_CODE result = DecryptFrame(frame); if (result != RESULT_OK) { - LOGGER_WARN(logger_, "Error frame decryption. Frame skipped."); + SDL_WARN("Error frame decryption. Frame skipped."); continue; } #endif // ENABLE_SECURITY @@ -556,16 +530,14 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) { void ProtocolHandlerImpl::OnTMMessageReceiveFailed( const transport_manager::DataReceiveError& error) { // TODO(PV): implement - LOGGER_ERROR(logger_, "Received error on attemping to recieve message."); + SDL_ERROR("Received error on attemping to recieve message."); } void ProtocolHandlerImpl::NotifySubscribers(const RawMessagePtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(protocol_observers_lock_); if (protocol_observers_.empty()) { - LOGGER_ERROR( - logger_, - "Cannot handle multiframe message: no IProtocolObserver is set."); + SDL_ERROR("Cannot handle multiframe message: no IProtocolObserver is set."); } for (ProtocolObservers::iterator it = protocol_observers_.begin(); protocol_observers_.end() != it; @@ -576,7 +548,7 @@ void ProtocolHandlerImpl::NotifySubscribers(const RawMessagePtr message) { } void ProtocolHandlerImpl::OnTMMessageSend(const RawMessagePtr message) { - LOGGER_DEBUG(logger_, "Sending message finished successfully."); + SDL_DEBUG("Sending message finished successfully."); uint32_t connection_handle = 0; uint8_t sessionID = 0; @@ -599,7 +571,7 @@ void ProtocolHandlerImpl::OnTMMessageSend(const RawMessagePtr message) { const RESULT_CODE result = sent_message.deserializePacket(message->data(), message->data_size()); if (result != RESULT_OK) { - LOGGER_ERROR(logger_, "Error while message deserialization."); + SDL_ERROR("Error while message deserialization."); return; } std::map<uint8_t, uint32_t>::iterator it = @@ -629,11 +601,9 @@ void ProtocolHandlerImpl::OnTMMessageSendFailed( const RawMessagePtr message) { DCHECK_OR_RETURN_VOID(message); // TODO(PV): implement - LOGGER_ERROR(logger_, - "Sending message " << message->data_size() - << "bytes failed, connection_key " - << message->connection_key() - << "Error_text: " << error.text()); + SDL_ERROR("Sending message " + << message->data_size() << "bytes failed, connection_key " + << message->connection_key() << "Error_text: " << error.text()); } void ProtocolHandlerImpl::OnConnectionEstablished( @@ -652,36 +622,34 @@ void ProtocolHandlerImpl::OnConnectionClosed( } RESULT_CODE ProtocolHandlerImpl::SendFrame(const ProtocolFramePtr packet) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!packet) { - LOGGER_ERROR(logger_, "Failed to send empty packet."); + SDL_ERROR("Failed to send empty packet."); return RESULT_FAIL; } #ifdef ENABLE_SECURITY // and return protect flag to Packet constructor for makeing design by Policy const RESULT_CODE result = EncryptFrame(packet); if (result != RESULT_OK) { - LOGGER_WARN(logger_, "Error frame encryption. Frame droped."); + SDL_WARN("Error frame encryption. Frame droped."); return RESULT_FAIL; } #endif // ENABLE_SECURITY - LOGGER_DEBUG(logger_, - "Packet to be sent: " << ConvertPacketDataToString( - packet->data(), packet->data_size()) - << " of size: " << packet->data_size()); + SDL_DEBUG("Packet to be sent: " + << ConvertPacketDataToString(packet->data(), packet->data_size()) + << " of size: " << packet->data_size()); const RawMessagePtr message_to_send = packet->serializePacket(); if (!message_to_send) { - LOGGER_ERROR(logger_, "Serialization error"); + SDL_ERROR("Serialization error"); return RESULT_FAIL; } - LOGGER_DEBUG(logger_, - "Message to send with connection id " - << static_cast<int>(packet->connection_id())); + SDL_DEBUG("Message to send with connection id " + << static_cast<int>(packet->connection_id())); if (transport_manager::E_SUCCESS != transport_manager_.SendMessageToDevice(message_to_send)) { - LOGGER_WARN(logger_, "Can't send message to device"); + SDL_WARN("Can't send message to device"); return RESULT_FAIL; } return RESULT_OK; @@ -695,7 +663,7 @@ RESULT_CODE ProtocolHandlerImpl::SendSingleFrameMessage( const size_t data_size, const uint8_t* data, const bool is_final_message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ProtocolFramePtr ptr( new protocol_handler::ProtocolPacket(connection_id, @@ -723,11 +691,9 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage( const uint8_t* data, const size_t max_frame_size, const bool is_final_message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); - LOGGER_DEBUG(logger_, - " data size " << data_size << " max_frame_size " - << max_frame_size); + SDL_DEBUG(" data size " << data_size << " max_frame_size " << max_frame_size); // remainder of last frame const size_t lastframe_remainder = data_size % max_frame_size; @@ -739,9 +705,8 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage( // add last frame if not empty (lastframe_remainder > 0 ? 1 : 0); - LOGGER_DEBUG(logger_, - "Data " << data_size << " bytes in " << frames_count - << " frames with last frame size " << lastframe_size); + SDL_DEBUG("Data " << data_size << " bytes in " << frames_count + << " frames with last frame size " << lastframe_size); DCHECK(max_frame_size >= FIRST_FRAME_DATA_SIZE); DCHECK(FIRST_FRAME_DATA_SIZE >= 8); @@ -773,7 +738,7 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage( raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(firstPacket, false)); - LOGGER_DEBUG(logger_, "First frame is sent."); + SDL_DEBUG("First frame is sent."); for (uint32_t i = 0; i < frames_count; ++i) { const bool is_last_frame = (i == (frames_count - 1)); @@ -797,27 +762,27 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage( raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, is_final_packet)); - LOGGER_DEBUG(logger_, '#' << i << " frame is sent."); + SDL_DEBUG('#' << i << " frame is sent."); } return RESULT_OK; } RESULT_CODE ProtocolHandlerImpl::HandleMessage(const ProtocolFramePtr packet) { DCHECK_OR_RETURN(packet, RESULT_UNKNOWN); - LOGGER_DEBUG(logger_, "Handling message " << packet); + SDL_DEBUG("Handling message " << packet); switch (packet->frame_type()) { case FRAME_TYPE_CONTROL: - LOGGER_TRACE(logger_, "FRAME_TYPE_CONTROL"); + SDL_TRACE("FRAME_TYPE_CONTROL"); return HandleControlMessage(packet); case FRAME_TYPE_SINGLE: - LOGGER_TRACE(logger_, "FRAME_TYPE_SINGLE"); + SDL_TRACE("FRAME_TYPE_SINGLE"); return HandleSingleFrameMessage(packet); case FRAME_TYPE_FIRST: case FRAME_TYPE_CONSECUTIVE: - LOGGER_TRACE(logger_, "FRAME_TYPE_FIRST or FRAME_TYPE_CONSECUTIVE"); + SDL_TRACE("FRAME_TYPE_FIRST or FRAME_TYPE_CONSECUTIVE"); return HandleMultiFrameMessage(packet); default: { - LOGGER_WARN(logger_, "Unknown frame type" << packet->frame_type()); + SDL_WARN("Unknown frame type" << packet->frame_type()); return RESULT_FAIL; } } @@ -826,13 +791,11 @@ RESULT_CODE ProtocolHandlerImpl::HandleMessage(const ProtocolFramePtr packet) { RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage( const ProtocolFramePtr packet) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); - LOGGER_DEBUG( - logger_, - "FRAME_TYPE_SINGLE message of size " - << packet->data_size() << "; message " - << ConvertPacketDataToString(packet->data(), packet->data_size())); + SDL_DEBUG("FRAME_TYPE_SINGLE message of size " + << packet->data_size() << "; message " + << ConvertPacketDataToString(packet->data(), packet->data_size())); const uint32_t connection_key = session_observer_.KeyFromPair( packet->connection_id(), packet->session_id()); @@ -864,10 +827,10 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage( RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage( const ProtocolFramePtr packet) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (multiframe_builder_.AddFrame(packet) != RESULT_OK) { - LOGGER_WARN(logger_, "Frame assembling issue"); + SDL_WARN("Frame assembling issue"); } return RESULT_OK; @@ -875,38 +838,37 @@ RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage( RESULT_CODE ProtocolHandlerImpl::HandleControlMessage( const ProtocolFramePtr packet) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO{ALeshin}: Rename "Session" to "Service" on PH, CH, AM levels switch (packet->frame_data()) { case FRAME_DATA_START_SERVICE: { - LOGGER_TRACE(logger_, "FrameData: StartService"); + SDL_TRACE("FrameData: StartService"); return HandleControlMessageStartSession(*packet); } case FRAME_DATA_END_SERVICE: { - LOGGER_TRACE(logger_, "FrameData: StopService"); + SDL_TRACE("FrameData: StopService"); return HandleControlMessageEndSession(*packet); } case FRAME_DATA_END_SERVICE_ACK: { - LOGGER_TRACE(logger_, "FrameData: StopService ACK"); + SDL_TRACE("FrameData: StopService ACK"); return HandleControlMessageEndServiceACK(*packet); } case FRAME_DATA_HEART_BEAT: { - LOGGER_TRACE(logger_, "FrameData: Heartbeat"); + SDL_TRACE("FrameData: Heartbeat"); return HandleControlMessageHeartBeat(*packet); } case FRAME_DATA_HEART_BEAT_ACK: { - LOGGER_TRACE(logger_, "FrameData Heartbeat ACK"); - LOGGER_DEBUG(logger_, - "Received Heartbeat ACK from mobile," - " connection: " - << packet->connection_id()); + SDL_TRACE("FrameData Heartbeat ACK"); + SDL_DEBUG( + "Received Heartbeat ACK from mobile," + " connection: " + << packet->connection_id()); return RESULT_OK; } default: - LOGGER_WARN(logger_, - "Control message of type " - << static_cast<int>(packet->frame_data()) << " ignored"); + SDL_WARN("Control message of type " + << static_cast<int>(packet->frame_data()) << " ignored"); return RESULT_OK; } return RESULT_OK; @@ -914,11 +876,11 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessage( uint32_t get_hash_id(const ProtocolPacket& packet) { if (packet.protocol_version() < PROTOCOL_VERSION_2) { - LOGGER_DEBUG(logger_, "Packet without hash data (protocol version less 2)"); + SDL_DEBUG("Packet without hash data (protocol version less 2)"); return HASH_ID_NOT_SUPPORTED; } if (packet.data_size() < 4) { - LOGGER_WARN(logger_, "Packet without hash data (data size less 4)"); + SDL_WARN("Packet without hash data (data size less 4)"); return HASH_ID_WRONG; } const uint32_t hash_be = *(reinterpret_cast<uint32_t*>(packet.data())); @@ -929,7 +891,7 @@ uint32_t get_hash_id(const ProtocolPacket& packet) { RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession( const ProtocolPacket& packet) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const uint8_t current_session_id = packet.session_id(); const uint32_t hash_id = get_hash_id(packet); @@ -947,9 +909,8 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession( service_type); message_counters_.erase(current_session_id); } else { - LOGGER_WARN(logger_, - "Refused to end session " << static_cast<int>(service_type) - << " type."); + SDL_WARN("Refused to end session " << static_cast<int>(service_type) + << " type."); SendEndSessionNAck(connection_id, current_session_id, packet.protocol_version(), @@ -960,7 +921,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession( RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK( const ProtocolPacket& packet) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const uint8_t current_session_id = packet.session_id(); const uint32_t hash_id = get_hash_id(packet); @@ -971,7 +932,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK( connection_id, current_session_id, hash_id, service_type); if (0 == session_key) { - LOGGER_WARN(logger_, "Refused to end service"); + SDL_WARN("Refused to end service"); return RESULT_FAIL; } @@ -1062,10 +1023,8 @@ class StartSessionHandler : public security_manager::SecurityManagerListener { RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( const ProtocolPacket& packet) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG( - logger_, - "Protocol version:" << static_cast<int>(packet.protocol_version())); + SDL_AUTO_TRACE(); + SDL_DEBUG("Protocol version:" << static_cast<int>(packet.protocol_version())); const ServiceType service_type = ServiceTypeFromByte(packet.service_type()); const uint8_t protocol_version = packet.protocol_version(); @@ -1084,9 +1043,8 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( connection_id, packet.session_id(), service_type, protection, &hash_id); if (0 == session_id) { - LOGGER_WARN(logger_, - "Refused by session_observer to create service " - << static_cast<int32_t>(service_type) << " type."); + SDL_WARN("Refused by session_observer to create service " + << static_cast<int32_t>(service_type) << " type."); SendStartSessionNAck(connection_id, packet.session_id(), protocol_version, @@ -1104,7 +1062,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( security_manager_->CreateSSLContext(connection_key); if (!ssl_context) { const std::string error("CreateSSLContext failed"); - LOGGER_ERROR(logger_, error); + SDL_ERROR(error); security_manager_->SendInternalError( connection_key, security_manager::SecurityManager::ERROR_INTERNAL, @@ -1144,9 +1102,8 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( security_manager_->StartHandshake(connection_key); } } - LOGGER_DEBUG(logger_, - "Protection establishing for connection " - << connection_key << " is in progress"); + SDL_DEBUG("Protection establishing for connection " << connection_key + << " is in progress"); return RESULT_OK; } #endif // ENABLE_SECURITY @@ -1163,9 +1120,8 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat( const ProtocolPacket& packet) { const ConnectionID connection_id = packet.connection_id(); - LOGGER_DEBUG(logger_, - "Sending heart beat acknowledgment for connection " - << connection_id); + SDL_DEBUG("Sending heart beat acknowledgment for connection " + << connection_id); uint8_t protocol_version; if (session_observer_.ProtocolVersionUsed( connection_id, packet.session_id(), protocol_version)) { @@ -1175,14 +1131,12 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat( return SendHeartBeatAck( connection_id, packet.session_id(), packet.message_id()); } else { - LOGGER_WARN(logger_, "HeartBeat is not supported"); + SDL_WARN("HeartBeat is not supported"); return RESULT_HEARTBEAT_IS_NOT_SUPPORTED; } } else { - LOGGER_WARN( - logger_, - "SendHeartBeatAck is failed connection or session does not exist"); + SDL_WARN("SendHeartBeatAck is failed connection or session does not exist"); return RESULT_FAIL; } } @@ -1200,9 +1154,7 @@ void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() { const uint32_t connection_key = session_observer_.KeyFromPair( frame->connection_id(), frame->session_id()); - LOGGER_DEBUG(logger_, - "Result frame" << frame << "for connection " - << connection_key); + SDL_DEBUG("Result frame" << frame << "for connection " << connection_key); const RawMessagePtr rawMessage(new RawMessage(connection_key, frame->protocol_version(), frame->data(), @@ -1224,18 +1176,15 @@ void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() { } bool ProtocolHandlerImpl::TrackMessage(const uint32_t& connection_key) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const size_t& frequency_time = get_settings().message_frequency_time(); const size_t& frequency_count = get_settings().message_frequency_count(); if (frequency_time > 0u && frequency_count > 0u) { const size_t message_frequency = message_meter_.TrackMessage(connection_key); - LOGGER_DEBUG(logger_, - "Frequency of " << connection_key << " is " - << message_frequency); + SDL_DEBUG("Frequency of " << connection_key << " is " << message_frequency); if (message_frequency > frequency_count) { - LOGGER_WARN(logger_, - "Frequency of " << connection_key << " is marked as high."); + SDL_WARN("Frequency of " << connection_key << " is marked as high."); session_observer_.OnApplicationFloodCallBack(connection_key); message_meter_.RemoveIdentifier(connection_key); return true; @@ -1248,19 +1197,17 @@ bool ProtocolHandlerImpl::TrackMalformedMessage(const uint32_t& connection_key, const size_t count) { const size_t& malformed_frequency_count = get_settings().malformed_frequency_count(); - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (get_settings().malformed_frequency_time() > 0u && malformed_frequency_count > 0u) { const size_t malformed_message_frequency = malformed_message_meter_.TrackMessages(connection_key, count); - LOGGER_DEBUG(logger_, - "Malformed frequency of " << connection_key << " is " - << malformed_message_frequency); + SDL_DEBUG("Malformed frequency of " << connection_key << " is " + << malformed_message_frequency); if (!get_settings().malformed_message_filtering() || malformed_message_frequency > malformed_frequency_count) { - LOGGER_WARN(logger_, - "Malformed frequency of " << connection_key - << " is marked as high."); + SDL_WARN("Malformed frequency of " << connection_key + << " is marked as high."); session_observer_.OnMalformedMessageCallback(connection_key); malformed_message_meter_.RemoveIdentifier(connection_key); return true; @@ -1270,7 +1217,7 @@ bool ProtocolHandlerImpl::TrackMalformedMessage(const uint32_t& connection_key, } void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); switch (message->service_type()) { case kMobileNav: @@ -1284,7 +1231,7 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) { } } break; } - LOGGER_DEBUG(logger_, "Message : " << message.get()); + SDL_DEBUG("Message : " << message.get()); const uint8_t c_id = message->connection_id(); const uint32_t m_id = message->session_id(); @@ -1296,24 +1243,21 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) { if (((0 != message->data()) && (0 != message->data_size())) || FRAME_TYPE_CONTROL == message->frame_type() || FRAME_TYPE_FIRST == message->frame_type()) { - LOGGER_DEBUG(logger_, "Packet: dataSize " << message->data_size()); + SDL_DEBUG("Packet: dataSize " << message->data_size()); HandleMessage(message); PopValideAndExpirateMultiframes(); } else { - LOGGER_WARN(logger_, - "handleMessagesFromMobileApp() - incorrect or NULL data"); + SDL_WARN("handleMessagesFromMobileApp() - incorrect or NULL data"); } } void ProtocolHandlerImpl::Handle(const impl::RawFordMessageToMobile message) { - LOGGER_DEBUG(logger_, - "Message to mobile app: connection id " - << static_cast<int>(message->connection_id()) - << ";" - " dataSize: " << message->data_size() - << " ;" - " protocolVersion " - << static_cast<int>(message->protocol_version())); + SDL_DEBUG("Message to mobile app: connection id " + << static_cast<int>(message->connection_id()) + << ";" + " dataSize: " << message->data_size() << " ;" + " protocolVersion " + << static_cast<int>(message->protocol_version())); if (message.is_final) { sessions_last_message_id_.insert(std::pair<uint8_t, uint32_t>( @@ -1332,7 +1276,7 @@ void ProtocolHandlerImpl::Stop() { void ProtocolHandlerImpl::set_security_manager( security_manager::SecurityManager* security_manager) { if (!security_manager) { - LOGGER_ERROR(logger_, "Invalid (NULL) pointer to SecurityManager."); + SDL_ERROR("Invalid (NULL) pointer to SecurityManager."); return; } security_manager_ = security_manager; @@ -1346,7 +1290,7 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) { return RESULT_OK; } if (!security_manager_) { - LOGGER_WARN(logger_, "No security_manager_ set."); + SDL_WARN("No security_manager_ set."); return RESULT_FAIL; } const uint32_t connection_key = session_observer_.KeyFromPair( @@ -1361,7 +1305,7 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) { if (!context->Encrypt( packet->data(), packet->data_size(), &out_data, &out_data_size)) { const std::string error_text(context->LastError()); - LOGGER_ERROR(logger_, "Enryption failed: " << error_text); + SDL_ERROR("Enryption failed: " << error_text); security_manager_->SendInternalError( connection_key, security_manager::SecurityManager::ERROR_ENCRYPTION_FAILED, @@ -1373,9 +1317,8 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) { kRpc); return RESULT_OK; } - LOGGER_DEBUG(logger_, - "Encrypted " << packet->data_size() << " bytes to " - << out_data_size << " bytes"); + SDL_DEBUG("Encrypted " << packet->data_size() << " bytes to " << out_data_size + << " bytes"); DCHECK(out_data); DCHECK(out_data_size); packet->set_protection_flag(true); @@ -1392,7 +1335,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { return RESULT_OK; } if (!security_manager_) { - LOGGER_WARN(logger_, "No security_manager_ set."); + SDL_WARN("No security_manager_ set."); return RESULT_FAIL; } const uint32_t connection_key = session_observer_.KeyFromPair( @@ -1401,8 +1344,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { connection_key, ServiceTypeFromByte(packet->service_type())); if (!context || !context->IsInitCompleted()) { const std::string error_text("Fail decryption for unprotected service "); - LOGGER_ERROR(logger_, - error_text << static_cast<int>(packet->service_type())); + SDL_ERROR(error_text << static_cast<int>(packet->service_type())); security_manager_->SendInternalError( connection_key, security_manager::SecurityManager::ERROR_SERVICE_NOT_PROTECTED, @@ -1414,7 +1356,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { if (!context->Decrypt( packet->data(), packet->data_size(), &out_data, &out_data_size)) { const std::string error_text(context->LastError()); - LOGGER_ERROR(logger_, "Decryption failed: " << error_text); + SDL_ERROR("Decryption failed: " << error_text); security_manager_->SendInternalError( connection_key, security_manager::SecurityManager::ERROR_DECRYPTION_FAILED, @@ -1426,9 +1368,8 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { kRpc); return RESULT_ENCRYPTION_FAILED; } - LOGGER_DEBUG(logger_, - "Decrypted " << packet->data_size() << " bytes to " - << out_data_size << " bytes"); + SDL_DEBUG("Decrypted " << packet->data_size() << " bytes to " << out_data_size + << " bytes"); DCHECK(out_data); DCHECK(out_data_size); packet->set_data(out_data, out_data_size); @@ -1438,8 +1379,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { void ProtocolHandlerImpl::SendFramesNumber(uint32_t connection_key, int32_t number_of_frames) { - LOGGER_DEBUG(logger_, - "SendFramesNumber MobileNaviAck for session " << connection_key); + SDL_DEBUG("SendFramesNumber MobileNaviAck for session " << connection_key); // TODO(EZamakhov): add protocol version check - to avoid send for // PROTOCOL_VERSION_1 @@ -1467,11 +1407,9 @@ void ProtocolHandlerImpl::SendFramesNumber(uint32_t connection_key, sizeof(number_of_frames)); raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOGGER_DEBUG(logger_, "SendFramesNumber finished successfully"); + SDL_DEBUG("SendFramesNumber finished successfully"); } else { - LOGGER_WARN( - logger_, - "SendFramesNumber is failed connection or session does not exist"); + SDL_WARN("SendFramesNumber is failed connection or session does not exist"); } } @@ -1499,7 +1437,7 @@ std::string ConvertPacketDataToString(const uint8_t* data, } uint8_t ProtocolHandlerImpl::SupportedSDLProtocolVersion() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool heart_beat_support = (0 != get_settings().heart_beat_timeout()); diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc index 67c1693d67..2ea0d71b7b 100644 --- a/src/components/protocol_handler/src/protocol_packet.cc +++ b/src/components/protocol_handler/src/protocol_packet.cc @@ -44,7 +44,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOGGER("ProtocolHandler") ProtocolPacket::ProtocolData::ProtocolData() : data(NULL), totalDataBytes(0u) {} @@ -91,11 +91,10 @@ inline uint32_t read_be_uint32(const uint8_t* const data) { void ProtocolPacket::ProtocolHeader::deserialize(const uint8_t* message, const size_t messageSize) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(message); if (messageSize < PROTOCOL_HEADER_V1_SIZE) { - LOGGER_DEBUG(logger_, - "Message size less " << PROTOCOL_HEADER_V1_SIZE << " bytes"); + SDL_DEBUG("Message size less " << PROTOCOL_HEADER_V1_SIZE << " bytes"); return; } // first 4 bits @@ -116,15 +115,13 @@ void ProtocolPacket::ProtocolHeader::deserialize(const uint8_t* message, case PROTOCOL_VERSION_3: case PROTOCOL_VERSION_4: { if (messageSize < PROTOCOL_HEADER_V2_SIZE) { - LOGGER_DEBUG(logger_, - "Message size less " << PROTOCOL_HEADER_V2_SIZE - << " bytes"); + SDL_DEBUG("Message size less " << PROTOCOL_HEADER_V2_SIZE << " bytes"); return; } messageId = read_be_uint32(message + 8); } break; default: - LOGGER_WARN(logger_, "Unknown version:" << static_cast<int>(version)); + SDL_WARN("Unknown version:" << static_cast<int>(version)); messageId = 0; break; } @@ -135,7 +132,7 @@ ProtocolPacket::ProtocolHeaderValidator::ProtocolHeaderValidator() void ProtocolPacket::ProtocolHeaderValidator::set_max_payload_size( const size_t max_payload_size) { - LOGGER_DEBUG(logger_, "New maximum payload size is " << max_payload_size); + SDL_DEBUG("New maximum payload size is " << max_payload_size); max_payload_size_ = max_payload_size; } @@ -145,7 +142,7 @@ size_t ProtocolPacket::ProtocolHeaderValidator::max_payload_size() const { RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( const ProtocolHeader& header) const { - LOGGER_DEBUG(logger_, "Validating header - " << header); + SDL_DEBUG("Validating header - " << header); // expected payload size will be calculated depending // on used protocol version size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE; @@ -161,16 +158,13 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( : MAXIMUM_FRAME_DATA_V2_SIZE; break; default: - LOGGER_WARN(logger_, - "Unknown version:" << static_cast<int>(header.version)); + SDL_WARN("Unknown version:" << static_cast<int>(header.version)); return RESULT_FAIL; } // ServiceType shall be equal 0x0 (Control), 0x07 (RPC), 0x0A (PCM), 0x0B // (Video), 0x0F (Bulk) if (ServiceTypeFromByte(header.serviceType) == kInvalidServiceType) { - LOGGER_WARN(logger_, - "Invalide service type" - << static_cast<int>(header.serviceType)); + SDL_WARN("Invalide service type" << static_cast<int>(header.serviceType)); return RESULT_FAIL; } // Check frame info for each frame type @@ -193,26 +187,23 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( case FRAME_DATA_HEART_BEAT_ACK: break; default: - LOGGER_WARN(logger_, - "FRAME_TYPE_CONTROL - Invalide frame data " - << static_cast<int>(header.frameData)); + SDL_WARN("FRAME_TYPE_CONTROL - Invalide frame data " + << static_cast<int>(header.frameData)); return RESULT_FAIL; } break; } case FRAME_TYPE_SINGLE: if (header.frameData != FRAME_DATA_SINGLE) { - LOGGER_WARN(logger_, - "FRAME_TYPE_SINGLE - Invalide frame data " - << static_cast<int>(header.frameData)); + SDL_WARN("FRAME_TYPE_SINGLE - Invalide frame data " + << static_cast<int>(header.frameData)); return RESULT_FAIL; } break; case FRAME_TYPE_FIRST: if (header.frameData != FRAME_DATA_FIRST) { - LOGGER_WARN(logger_, - "FRAME_TYPE_FIRST - Invalide frame data " - << static_cast<int>(header.frameData)); + SDL_WARN("FRAME_TYPE_FIRST - Invalide frame data " + << static_cast<int>(header.frameData)); return RESULT_FAIL; } break; @@ -220,8 +211,7 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( // Could have any FrameInfo value break; default: - LOGGER_WARN(logger_, - "Unknown frame type " << static_cast<int>(header.frameType)); + SDL_WARN("Unknown frame type " << static_cast<int>(header.frameType)); // All other Frame type is invalid return RESULT_FAIL; } @@ -229,20 +219,18 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( // For Single and Consecutive Data Size value shall be greater than 0x00 // and shall be less than payload size if (header.dataSize > payload_size) { - LOGGER_WARN(logger_, - "Packet data size is " - << header.dataSize - << " and bigger than allowed payload size " << payload_size - << " bytes"); + SDL_WARN("Packet data size is " << header.dataSize + << " and bigger than allowed payload size " + << payload_size << " bytes"); return RESULT_FAIL; } switch (header.frameType) { case FRAME_TYPE_SINGLE: case FRAME_TYPE_CONSECUTIVE: if (header.dataSize <= 0u) { - LOGGER_WARN(logger_, - "Data size of Single and Consecutive frame shall be not " - "equal 0 byte "); + SDL_WARN( + "Data size of Single and Consecutive frame shall be not " + "equal 0 byte "); return RESULT_FAIL; } break; @@ -254,12 +242,12 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( if (header.messageId <= 0) { if (FRAME_TYPE_CONTROL != header.frameType && PROTOCOL_VERSION_1 != header.version) { - LOGGER_WARN(logger_, "Message ID shall be greater than 0x00"); + SDL_WARN("Message ID shall be greater than 0x00"); // Message ID shall be greater than 0x00, but not implemented in SPT return RESULT_FAIL; } } - LOGGER_DEBUG(logger_, "Message header is completely correct."); + SDL_DEBUG("Message header is completely correct."); return RESULT_OK; } @@ -297,7 +285,7 @@ ProtocolPacket::ProtocolPacket(ConnectionID connection_id) // Serialization RawMessagePtr ProtocolPacket::serializePacket() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); // TODO(EZamakhov): Move header serialization to ProtocolHeader // version is low byte const uint8_t version_byte = packet_header_.version << 4; @@ -394,7 +382,7 @@ bool ProtocolPacket::operator==(const ProtocolPacket& other) const { RESULT_CODE ProtocolPacket::deserializePacket(const uint8_t* message, const size_t messageSize) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN(message, RESULT_FAIL); packet_header_.deserialize(message, messageSize); const uint8_t offset = packet_header_.version == PROTOCOL_VERSION_1 diff --git a/src/components/resumption/src/last_state.cc b/src/components/resumption/src/last_state.cc index d5b464afe0..01e7f3b9f3 100644 --- a/src/components/resumption/src/last_state.cc +++ b/src/components/resumption/src/last_state.cc @@ -36,29 +36,28 @@ namespace resumption { -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOGGER("Resumption") LastState::LastState(const std::string& app_storage_folder, const std::string& app_info_storage) : app_storage_folder_(app_storage_folder) , app_info_storage_(app_info_storage) { LoadFromFileSystem(); - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } LastState::~LastState() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); SaveToFileSystem(); } void LastState::SaveToFileSystem() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const std::string str = dictionary_.ToJson(); const std::vector<uint8_t> char_vector_pdata(str.begin(), str.end()); DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_)); - LOGGER_INFO(logger_, - "LastState::SaveToFileSystem " << app_info_storage_ << str); + SDL_INFO("LastState::SaveToFileSystem " << app_info_storage_ << str); DCHECK(file_system::Write(app_info_storage_, char_vector_pdata)); } @@ -71,24 +70,22 @@ void LastState::LoadFromFileSystem() { std::string buffer; bool result = file_system::ReadFile(app_info_storage_, buffer); if (!result) { - LOGGER_WARN(logger_, - "Failed to load last state. Cannot read file " - << app_info_storage_); + SDL_WARN("Failed to load last state. Cannot read file " + << app_info_storage_); return; } if (buffer.empty()) { - LOGGER_DEBUG(logger_, "Buffer is empty."); + SDL_DEBUG("Buffer is empty."); return; } JsonValue::ParseResult parse_result = JsonValue::Parse(buffer); if (!parse_result.second) { - LOGGER_WARN(logger_, - "Failed to load last state. Cannot parse json:\n" << buffer); + SDL_WARN("Failed to load last state. Cannot parse json:\n" << buffer); return; } dictionary_ = parse_result.first; - LOGGER_INFO(logger_, "Valid last state was found." << dictionary_.ToJson()); + SDL_INFO("Valid last state was found." << dictionary_.ToJson()); return; } } diff --git a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h index 0642eb25db..c4faf00e76 100644 --- a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h +++ b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h @@ -18,7 +18,7 @@ class CryptoManagerSettingsImpl : public CryptoManagerSettings { : security_manager::CLIENT; } Protocol security_manager_protocol_name() const OVERRIDE { - CREATE_LOGGERPTR_LOCAL(logger_, "SecurityManager") + SDL_CREATE_LOGGER("SecurityManager") const std::string& protocol_str = profile_.security_manager_protocol_name(); if (protocol_str == "TLSv1.0") { @@ -33,8 +33,7 @@ class CryptoManagerSettingsImpl : public CryptoManagerSettings { if (protocol_str == "SSLv3") { return security_manager::SSLv3; } - LOGGER_ERROR( - logger_, + SDL_ERROR( "Unknown protocol: " << profile_.security_manager_protocol_name()); return static_cast<security_manager::Protocol>(-1); } diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc index 25c918bcfc..6c6a89df68 100644 --- a/src/components/security_manager/src/crypto_manager_impl.cc +++ b/src/components/security_manager/src/crypto_manager_impl.cc @@ -52,7 +52,7 @@ namespace security_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager") +SDL_CREATE_LOGGER("SecurityManager") uint32_t CryptoManagerImpl::instance_count_ = 0; sync_primitives::Lock CryptoManagerImpl::instance_lock_; @@ -62,10 +62,8 @@ int debug_callback(int preverify_ok, X509_STORE_CTX* ctx) { if (!preverify_ok) { const int error = X509_STORE_CTX_get_error(ctx); UNUSED(error); - LOGGER_WARN(logger_, - "Certificate verification failed with error " - << error << " \"" << X509_verify_cert_error_string(error) - << '"'); + SDL_WARN("Certificate verification failed with error " + << error << " \"" << X509_verify_cert_error_string(error) << '"'); } return preverify_ok; } @@ -81,11 +79,11 @@ void free_ctx(SSL_CTX** ctx) { CryptoManagerImpl::CryptoManagerImpl( const utils::SharedPtr<const CryptoManagerSettings> set) : settings_(set), context_(NULL) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(instance_lock_); instance_count_++; if (instance_count_ == 1) { - LOGGER_DEBUG(logger_, "Openssl engine initialization"); + SDL_DEBUG("Openssl engine initialization"); SSL_load_error_strings(); ERR_load_BIO_strings(); OpenSSL_add_all_algorithms(); @@ -94,38 +92,36 @@ CryptoManagerImpl::CryptoManagerImpl( } CryptoManagerImpl::~CryptoManagerImpl() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(instance_lock_); - LOGGER_DEBUG(logger_, "Deinitilization"); + SDL_DEBUG("Deinitilization"); if (!context_) { - LOGGER_WARN(logger_, "Manager is not initialized"); + SDL_WARN("Manager is not initialized"); } else { SSL_CTX_free(context_); } instance_count_--; if (instance_count_ == 0) { - LOGGER_DEBUG(logger_, "Openssl engine deinitialization"); + SDL_DEBUG("Openssl engine deinitialization"); EVP_cleanup(); ERR_free_strings(); } } bool CryptoManagerImpl::Init() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const Mode mode = get_settings().security_manager_mode(); const bool is_server = (mode == SERVER); if (is_server) { - LOGGER_DEBUG(logger_, "Server mode"); + SDL_DEBUG("Server mode"); } else { - LOGGER_DEBUG(logger_, "Client mode"); + SDL_DEBUG("Client mode"); } - LOGGER_DEBUG(logger_, - "Peer verification " - << (get_settings().verify_peer() ? "enabled" : "disabled")); - LOGGER_DEBUG(logger_, - "CA certificate file is \"" << get_settings().ca_cert_path() - << '"'); + SDL_DEBUG("Peer verification " + << (get_settings().verify_peer() ? "enabled" : "disabled")); + SDL_DEBUG("CA certificate file is \"" << get_settings().ca_cert_path() + << '"'); #if OPENSSL_VERSION_NUMBER < CONST_SSL_METHOD_MINIMAL_VERSION SSL_METHOD* method; @@ -141,9 +137,7 @@ bool CryptoManagerImpl::Init() { break; case TLSv1_1: #if OPENSSL_VERSION_NUMBER < TLS1_1_MINIMAL_VERSION - LOGGER_WARN( - logger_, - "OpenSSL has no TLSv1.1 with version lower 1.0.1, set TLSv1.0"); + SDL_WARN("OpenSSL has no TLSv1.1 with version lower 1.0.1, set TLSv1.0"); method = is_server ? TLSv1_server_method() : TLSv1_client_method(); #else method = is_server ? TLSv1_1_server_method() : TLSv1_1_client_method(); @@ -151,18 +145,15 @@ bool CryptoManagerImpl::Init() { break; case TLSv1_2: #if OPENSSL_VERSION_NUMBER < TLS1_1_MINIMAL_VERSION - LOGGER_WARN( - logger_, - "OpenSSL has no TLSv1.2 with version lower 1.0.1, set TLSv1.0"); + SDL_WARN("OpenSSL has no TLSv1.2 with version lower 1.0.1, set TLSv1.0"); method = is_server ? TLSv1_server_method() : TLSv1_client_method(); #else method = is_server ? TLSv1_2_server_method() : TLSv1_2_client_method(); #endif break; default: - LOGGER_ERROR(logger_, - "Unknown protocol: " - << get_settings().security_manager_protocol_name()); + SDL_ERROR("Unknown protocol: " + << get_settings().security_manager_protocol_name()); return false; } if (context_) { @@ -178,33 +169,30 @@ bool CryptoManagerImpl::Init() { set_certificate(get_settings().certificate_data()); if (get_settings().ciphers_list().empty()) { - LOGGER_WARN(logger_, "Empty ciphers list"); + SDL_WARN("Empty ciphers list"); } else { - LOGGER_DEBUG(logger_, "Cipher list: " << get_settings().ciphers_list()); + SDL_DEBUG("Cipher list: " << get_settings().ciphers_list()); if (!SSL_CTX_set_cipher_list(context_, get_settings().ciphers_list().c_str())) { - LOGGER_ERROR( - logger_, - "Could not set cipher list: " << get_settings().ciphers_list()); + SDL_ERROR("Could not set cipher list: " << get_settings().ciphers_list()); return false; } } if (get_settings().ca_cert_path().empty()) { - LOGGER_WARN(logger_, "Setting up empty CA certificate location"); + SDL_WARN("Setting up empty CA certificate location"); } - LOGGER_DEBUG(logger_, "Setting up CA certificate location"); + SDL_DEBUG("Setting up CA certificate location"); const int result = SSL_CTX_load_verify_locations( context_, NULL, get_settings().ca_cert_path().c_str()); if (!result) { const unsigned long error = ERR_get_error(); UNUSED(error); - LOGGER_WARN(logger_, - "Wrong certificate file '" - << get_settings().ca_cert_path() << "', err 0x" << std::hex - << error << " \"" << ERR_reason_error_string(error) << '"'); + SDL_WARN("Wrong certificate file '" + << get_settings().ca_cert_path() << "', err 0x" << std::hex + << error << " \"" << ERR_reason_error_string(error) << '"'); } guard.Dismiss(); @@ -213,16 +201,15 @@ bool CryptoManagerImpl::Init() { get_settings().verify_peer() ? SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT : SSL_VERIFY_NONE; - LOGGER_DEBUG(logger_, - "Setting up peer verification in mode: " << verify_mode); + SDL_DEBUG("Setting up peer verification in mode: " << verify_mode); SSL_CTX_set_verify(context_, verify_mode, &debug_callback); return true; } bool CryptoManagerImpl::OnCertificateUpdated(const std::string& data) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!context_) { - LOGGER_WARN(logger_, "Not initialized"); + SDL_WARN("Not initialized"); return false; } @@ -261,22 +248,20 @@ std::string CryptoManagerImpl::LastError() const { } bool CryptoManagerImpl::IsCertificateUpdateRequired() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const time_t now = time(NULL); const time_t cert_date = mktime(&expiration_time_); if (-1 == cert_date) { - LOGGER_ERROR(logger_, "Can't convert certificate date."); + SDL_ERROR("Can't convert certificate date."); return true; } const double seconds = difftime(cert_date, now); - LOGGER_DEBUG( - logger_, - "Certificate time: " << asctime(&expiration_time_) - << ". Host time: " << asctime(localtime(&now)) - << ". Seconds before expiration: " << seconds); + SDL_DEBUG("Certificate time: " << asctime(&expiration_time_) + << ". Host time: " << asctime(localtime(&now)) + << ". Seconds before expiration: " << seconds); return seconds <= get_settings().update_before_hours(); } @@ -286,7 +271,7 @@ const CryptoManagerSettings& CryptoManagerImpl::get_settings() const { bool CryptoManagerImpl::set_certificate(const std::string& cert_data) { if (cert_data.empty()) { - LOGGER_WARN(logger_, "Empty certificate"); + SDL_WARN("Empty certificate"); return false; } @@ -299,7 +284,7 @@ bool CryptoManagerImpl::set_certificate(const std::string& cert_data) { BIO* bio_cert = BIO_new(BIO_s_mem()); if (NULL == bio_cert) { - LOGGER_WARN(logger_, "Unable to update certificate. BIO not created"); + SDL_WARN("Unable to update certificate. BIO not created"); return false; } @@ -307,13 +292,13 @@ bool CryptoManagerImpl::set_certificate(const std::string& cert_data) { UNUSED(bio_guard) int k = 0; if ((k = BIO_write(bio_cert, buf, len)) <= 0) { - LOGGER_WARN(logger_, "Unable to write into BIO"); + SDL_WARN("Unable to write into BIO"); return false; } PKCS12* p12 = d2i_PKCS12_bio(bio_cert, NULL); if (NULL == p12) { - LOGGER_ERROR(logger_, "Unable to parse certificate"); + SDL_ERROR("Unable to parse certificate"); return false; } @@ -322,23 +307,23 @@ bool CryptoManagerImpl::set_certificate(const std::string& cert_data) { PKCS12_parse(p12, NULL, &pkey, &cert, NULL); if (NULL == cert || NULL == pkey) { - LOGGER_WARN(logger_, "Either certificate or key not valid."); + SDL_WARN("Either certificate or key not valid."); return false; } if (!SSL_CTX_use_certificate(context_, cert)) { - LOGGER_WARN(logger_, "Could not use certificate"); + SDL_WARN("Could not use certificate"); return false; } asn1_time_to_tm(X509_get_notAfter(cert)); if (!SSL_CTX_use_PrivateKey(context_, pkey)) { - LOGGER_ERROR(logger_, "Could not use key"); + SDL_ERROR("Could not use key"); return false; } if (!SSL_CTX_check_private_key(context_)) { - LOGGER_ERROR(logger_, "Could not use certificate "); + SDL_ERROR("Could not use certificate "); return false; } return true; diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc index 16e309661e..75afda51d3 100644 --- a/src/components/security_manager/src/security_manager_impl.cc +++ b/src/components/security_manager/src/security_manager_impl.cc @@ -40,7 +40,7 @@ namespace security_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager") +SDL_CREATE_LOGGER("SecurityManager") static const char* kErrId = "id"; static const char* kErrText = "text"; @@ -63,7 +63,7 @@ void SecurityManagerImpl::OnMessageReceived( if (!result) { // result will be false only if data less then query header const std::string error_text("Incorrect message received"); - LOGGER_ERROR(logger_, error_text); + SDL_ERROR(error_text); SendInternalError( message->connection_key(), ERROR_INVALID_QUERY_SIZE, error_text); return; @@ -80,7 +80,7 @@ void SecurityManagerImpl::OnMobileMessageSent( void SecurityManagerImpl::set_session_observer( protocol_handler::SessionObserver* observer) { if (!observer) { - LOGGER_ERROR(logger_, "Invalid (NULL) pointer to SessionObserver."); + SDL_ERROR("Invalid (NULL) pointer to SessionObserver."); return; } session_observer_ = observer; @@ -89,7 +89,7 @@ void SecurityManagerImpl::set_session_observer( void SecurityManagerImpl::set_protocol_handler( protocol_handler::ProtocolHandler* handler) { if (!handler) { - LOGGER_ERROR(logger_, "Invalid (NULL) pointer to ProtocolHandler."); + SDL_ERROR("Invalid (NULL) pointer to ProtocolHandler."); return; } protocol_handler_ = handler; @@ -97,7 +97,7 @@ void SecurityManagerImpl::set_protocol_handler( void SecurityManagerImpl::set_crypto_manager(CryptoManager* crypto_manager) { if (!crypto_manager) { - LOGGER_ERROR(logger_, "Invalid (NULL) pointer to CryptoManager."); + SDL_ERROR("Invalid (NULL) pointer to CryptoManager."); return; } crypto_manager_ = crypto_manager; @@ -105,10 +105,10 @@ void SecurityManagerImpl::set_crypto_manager(CryptoManager* crypto_manager) { void SecurityManagerImpl::Handle(const SecurityMessage message) { DCHECK(message); - LOGGER_INFO(logger_, "Received Security message from Mobile side"); + SDL_INFO("Received Security message from Mobile side"); if (!crypto_manager_) { const std::string error_text("Invalid (NULL) CryptoManager."); - LOGGER_ERROR(logger_, error_text); + SDL_ERROR(error_text); SendInternalError( message->get_connection_key(), ERROR_NOT_SUPPORTED, error_text); return; @@ -116,18 +116,18 @@ void SecurityManagerImpl::Handle(const SecurityMessage message) { switch (message->get_header().query_id) { case SecurityQuery::SEND_HANDSHAKE_DATA: if (!ProccessHandshakeData(message)) { - LOGGER_ERROR(logger_, "Proccess HandshakeData failed"); + SDL_ERROR("Proccess HandshakeData failed"); } break; case SecurityQuery::SEND_INTERNAL_ERROR: if (!ProccessInternalError(message)) { - LOGGER_ERROR(logger_, "Processing income InternalError failed"); + SDL_ERROR("Processing income InternalError failed"); } break; default: { // SecurityQuery::InvalidQuery const std::string error_text("Unknown query identifier."); - LOGGER_ERROR(logger_, error_text); + SDL_ERROR(error_text); SendInternalError(message->get_connection_key(), ERROR_INVALID_QUERY_ID, error_text, @@ -138,7 +138,7 @@ void SecurityManagerImpl::Handle(const SecurityMessage message) { security_manager::SSLContext* SecurityManagerImpl::CreateSSLContext( const uint32_t& connection_key) { - LOGGER_INFO(logger_, "ProtectService processing"); + SDL_INFO("ProtectService processing"); DCHECK(session_observer_); DCHECK(crypto_manager_); @@ -152,7 +152,7 @@ security_manager::SSLContext* SecurityManagerImpl::CreateSSLContext( ssl_context = crypto_manager_->CreateSSLContext(); if (!ssl_context) { const std::string error_text("CryptoManager could not create SSL context."); - LOGGER_ERROR(logger_, error_text); + SDL_ERROR(error_text); // Generate response query and post to security_messages_ SendInternalError(connection_key, ERROR_INTERNAL, error_text); return NULL; @@ -168,20 +168,20 @@ security_manager::SSLContext* SecurityManagerImpl::CreateSSLContext( } DCHECK(session_observer_->GetSSLContext(connection_key, protocol_handler::kControl)); - LOGGER_DEBUG(logger_, "Set SSL context to connection_key " << connection_key); + SDL_DEBUG("Set SSL context to connection_key " << connection_key); return ssl_context; } void SecurityManagerImpl::StartHandshake(uint32_t connection_key) { DCHECK(session_observer_); - LOGGER_INFO(logger_, "StartHandshake: connection_key " << connection_key); + SDL_INFO("StartHandshake: connection_key " << connection_key); security_manager::SSLContext* ssl_context = session_observer_->GetSSLContext( connection_key, protocol_handler::kControl); if (!ssl_context) { const std::string error_text( "StartHandshake failed, " "connection is not protected"); - LOGGER_ERROR(logger_, error_text); + SDL_ERROR(error_text); SendInternalError(connection_key, ERROR_INTERNAL, error_text); NotifyListenersOnHandshakeDone(connection_key, SSLContext::Handshake_Result_Fail); @@ -208,7 +208,7 @@ void SecurityManagerImpl::StartHandshake(uint32_t connection_key) { ssl_context->StartHandshake(&data, &data_size); if (security_manager::SSLContext::Handshake_Result_Success != result) { const std::string error_text("StartHandshake failed, handshake step fail"); - LOGGER_ERROR(logger_, error_text); + SDL_ERROR(error_text); SendInternalError(connection_key, ERROR_INTERNAL, error_text); NotifyListenersOnHandshakeDone(connection_key, SSLContext::Handshake_Result_Fail); @@ -221,7 +221,7 @@ void SecurityManagerImpl::StartHandshake(uint32_t connection_key) { } void SecurityManagerImpl::AddListener(SecurityManagerListener* const listener) { if (!listener) { - LOGGER_ERROR(logger_, "Invalid (NULL) pointer to SecurityManagerListener."); + SDL_ERROR("Invalid (NULL) pointer to SecurityManagerListener."); return; } listeners_.push_back(listener); @@ -229,14 +229,14 @@ void SecurityManagerImpl::AddListener(SecurityManagerListener* const listener) { void SecurityManagerImpl::RemoveListener( SecurityManagerListener* const listener) { if (!listener) { - LOGGER_ERROR(logger_, "Invalid (NULL) pointer to SecurityManagerListener."); + SDL_ERROR("Invalid (NULL) pointer to SecurityManagerListener."); return; } listeners_.remove(listener); } void SecurityManagerImpl::NotifyListenersOnHandshakeDone( const uint32_t& connection_key, SSLContext::HandshakeResult error) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::list<SecurityManagerListener*>::iterator it = listeners_.begin(); while (it != listeners_.end()) { if ((*it)->OnHandshakeDone(connection_key, error)) { @@ -249,7 +249,7 @@ void SecurityManagerImpl::NotifyListenersOnHandshakeDone( } void SecurityManagerImpl::NotifyOnCertififcateUpdateRequired() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); std::list<SecurityManagerListener*>::iterator it = listeners_.begin(); while (it != listeners_.end()) { (*it)->OnCertificateUpdateRequired(); @@ -259,20 +259,19 @@ void SecurityManagerImpl::NotifyOnCertififcateUpdateRequired() { bool SecurityManagerImpl::ProccessHandshakeData( const SecurityMessage& inMessage) { - LOGGER_INFO(logger_, "SendHandshakeData processing"); + SDL_INFO("SendHandshakeData processing"); DCHECK(inMessage); DCHECK(inMessage->get_header().query_id == SecurityQuery::SEND_HANDSHAKE_DATA); const uint32_t seqNumber = inMessage->get_header().seq_number; const uint32_t connection_key = inMessage->get_connection_key(); - LOGGER_DEBUG(logger_, - "Received " << inMessage->get_data_size() - << " bytes handshake data "); + SDL_DEBUG("Received " << inMessage->get_data_size() + << " bytes handshake data "); if (!inMessage->get_data_size()) { const std::string error_text("SendHandshakeData: null arguments size."); - LOGGER_ERROR(logger_, error_text); + SDL_ERROR(error_text); SendInternalError( connection_key, ERROR_INVALID_QUERY_SIZE, error_text, seqNumber); return false; @@ -282,7 +281,7 @@ bool SecurityManagerImpl::ProccessHandshakeData( connection_key, protocol_handler::kControl); if (!sslContext) { const std::string error_text("SendHandshakeData: No ssl context."); - LOGGER_ERROR(logger_, error_text); + SDL_ERROR(error_text); SendInternalError( connection_key, ERROR_SERVICE_NOT_PROTECTED, error_text, seqNumber); NotifyListenersOnHandshakeDone(connection_key, @@ -299,8 +298,7 @@ bool SecurityManagerImpl::ProccessHandshakeData( if (handshake_result == SSLContext::Handshake_Result_AbnormalFail) { // Do not return handshake data on AbnormalFail or null returned values const std::string erorr_text(sslContext->LastError()); - LOGGER_ERROR(logger_, - "SendHandshakeData: Handshake failed: " << erorr_text); + SDL_ERROR("SendHandshakeData: Handshake failed: " << erorr_text); SendInternalError( connection_key, ERROR_SSL_INVALID_DATA, erorr_text, seqNumber); NotifyListenersOnHandshakeDone(connection_key, @@ -310,12 +308,12 @@ bool SecurityManagerImpl::ProccessHandshakeData( } if (sslContext->IsInitCompleted()) { // On handshake success - LOGGER_DEBUG(logger_, "SSL initialization finished success."); + SDL_DEBUG("SSL initialization finished success."); NotifyListenersOnHandshakeDone(connection_key, SSLContext::Handshake_Result_Success); } else if (handshake_result != SSLContext::Handshake_Result_Success) { // On handshake fail - LOGGER_WARN(logger_, "SSL initialization finished with fail."); + SDL_WARN("SSL initialization finished with fail."); NotifyListenersOnHandshakeDone(connection_key, handshake_result); } @@ -329,8 +327,7 @@ bool SecurityManagerImpl::ProccessHandshakeData( bool SecurityManagerImpl::ProccessInternalError( const SecurityMessage& inMessage) { std::string json_message = inMessage->get_json_message(); - LOGGER_INFO(logger_, - "Received InternalError with Json message" << json_message); + SDL_INFO("Received InternalError with Json message" << json_message); using namespace utils::json; JsonValue::ParseResult parse_result = JsonValue::Parse(json_message); if (!parse_result.second) { @@ -339,10 +336,9 @@ bool SecurityManagerImpl::ProccessInternalError( #if defined(ENABLE_LOG) JsonValue& root_json = parse_result.first; #endif - LOGGER_DEBUG(logger_, - "Received InternalError id " - << root_json[kErrId].AsString() - << ", text: " << root_json[kErrText].AsString()); + SDL_DEBUG("Received InternalError id " + << root_json[kErrId].AsString() + << ", text: " << root_json[kErrText].AsString()); return true; } void SecurityManagerImpl::SendHandshakeBinData(const uint32_t connection_key, @@ -356,7 +352,7 @@ void SecurityManagerImpl::SendHandshakeBinData(const uint32_t connection_key, const SecurityQuery query = SecurityQuery(header, connection_key, data, data_size); SendQuery(query, connection_key); - LOGGER_DEBUG(logger_, "Sent " << data_size << " bytes handshake data "); + SDL_DEBUG("Sent " << data_size << " bytes handshake data "); } void SecurityManagerImpl::SendInternalError(const uint32_t connection_key, @@ -383,9 +379,8 @@ void SecurityManagerImpl::SendInternalError(const uint32_t connection_key, const SecurityQuery query( header, connection_key, &data_sending[0], data_sending.size()); SendQuery(query, connection_key); - LOGGER_DEBUG(logger_, - "Sent Internal error id " << static_cast<int>(error_id) - << " : \"" << erorr_text << "\"."); + SDL_DEBUG("Sent Internal error id " << static_cast<int>(error_id) << " : \"" + << erorr_text << "\"."); } void SecurityManagerImpl::SendQuery(const SecurityQuery& query, diff --git a/src/components/security_manager/src/ssl_context_impl.cc b/src/components/security_manager/src/ssl_context_impl.cc index fb049aa497..2f649bc813 100644 --- a/src/components/security_manager/src/ssl_context_impl.cc +++ b/src/components/security_manager/src/ssl_context_impl.cc @@ -43,7 +43,7 @@ namespace security_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager") +SDL_CREATE_LOGGER("SecurityManager") CryptoManagerImpl::SSLContextImpl::SSLContextImpl(SSL* conn, Mode mode, @@ -149,13 +149,13 @@ void CryptoManagerImpl::SSLContextImpl::PrintCertData( char* subj = X509_NAME_oneline(subj_name, NULL, 0); if (subj) { std::replace(subj, subj + strlen(subj), '/', ' '); - LOGGER_DEBUG(logger_, cert_owner << " subject:" << subj); + SDL_DEBUG(cert_owner << " subject:" << subj); OPENSSL_free(subj); } char* issuer = X509_NAME_oneline(X509_get_issuer_name(cert), NULL, 0); if (issuer) { std::replace(issuer, issuer + strlen(issuer), '/', ' '); - LOGGER_DEBUG(logger_, cert_owner << " issuer:" << issuer); + SDL_DEBUG(cert_owner << " issuer:" << issuer); OPENSSL_free(issuer); } @@ -163,10 +163,10 @@ void CryptoManagerImpl::SSLContextImpl::PrintCertData( ASN1_TIME* notAfter = X509_get_notAfter(cert); if (notBefore) { - LOGGER_DEBUG(logger_, " Start date: " << (char*)notBefore->data); + SDL_DEBUG(" Start date: " << (char*)notBefore->data); } if (notAfter) { - LOGGER_DEBUG(logger_, " End date: " << (char*)notAfter->data); + SDL_DEBUG(" End date: " << (char*)notAfter->data); } } } @@ -197,18 +197,16 @@ CryptoManagerImpl::SSLContextImpl::CheckCertContext() { const std::string& sn = GetTextBy(subj_name, NID_serialNumber); if (!(hsh_context_.expected_cn.CompareIgnoreCase(cn.c_str()))) { - LOGGER_ERROR(logger_, - "Trying to run handshake with wrong app name: " - << cn << ". Expected app name: " - << hsh_context_.expected_cn.AsMBString()); + SDL_ERROR("Trying to run handshake with wrong app name: " + << cn << ". Expected app name: " + << hsh_context_.expected_cn.AsMBString()); return Handshake_Result_AppNameMismatch; } if (!(hsh_context_.expected_sn.CompareIgnoreCase(sn.c_str()))) { - LOGGER_ERROR(logger_, - "Trying to run handshake with wrong app id: " - << sn << ". Expected app id: " - << hsh_context_.expected_sn.AsMBString()); + SDL_ERROR("Trying to run handshake with wrong app id: " + << sn << ". Expected app id: " + << hsh_context_.expected_sn.AsMBString()); return Handshake_Result_AppIDMismatch; } return Handshake_Result_Success; @@ -216,13 +214,13 @@ CryptoManagerImpl::SSLContextImpl::CheckCertContext() { bool CryptoManagerImpl::SSLContextImpl::ReadHandshakeData( const uint8_t** const out_data, size_t* out_data_size) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock locker(ssl_locker_); const size_t pend = BIO_ctrl_pending(bioOut_); - LOGGER_DEBUG(logger_, "Available " << pend << " bytes for handshake"); + SDL_DEBUG("Available " << pend << " bytes for handshake"); if (pend > 0) { - LOGGER_DEBUG(logger_, "Reading handshake data"); + SDL_DEBUG("Reading handshake data"); EnsureBufferSizeEnough(pend); const int read_count = BIO_read(bioOut_, buffer_, pend); @@ -230,7 +228,7 @@ bool CryptoManagerImpl::SSLContextImpl::ReadHandshakeData( *out_data_size = read_count; *out_data = buffer_; } else { - LOGGER_WARN(logger_, "BIO read fail"); + SDL_WARN("BIO read fail"); is_handshake_pending_ = false; ResetConnection(); return false; @@ -242,7 +240,7 @@ bool CryptoManagerImpl::SSLContextImpl::ReadHandshakeData( bool CryptoManagerImpl::SSLContextImpl::WriteHandshakeData( const uint8_t* const in_data, size_t in_data_size) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock locker(ssl_locker_); if (in_data && in_data_size) { const int ret = BIO_write(bioIn_, in_data, in_data_size); @@ -281,7 +279,7 @@ CryptoManagerImpl::SSLContextImpl::ProcessSuccessHandshake() { return result; } - LOGGER_DEBUG(logger_, "SSL handshake successfully finished"); + SDL_DEBUG("SSL handshake successfully finished"); // Handshake is successful bioFilter_ = BIO_new(BIO_f_ssl()); BIO_set_ssl(bioFilter_, connection_, BIO_NOCLOSE); @@ -306,10 +304,9 @@ CryptoManagerImpl::SSLContextImpl::ProcessHandshakeError( if (error != SSL_ERROR_WANT_READ) { const long error = SSL_get_verify_result(connection_); SetHandshakeError(error); - LOGGER_WARN(logger_, - "Handshake failed with error " - << " -> " << SSL_get_error(connection_, error) << " \"" - << last_error << '"'); + SDL_WARN("Handshake failed with error " + << " -> " << SSL_get_error(connection_, error) << " \"" + << last_error << '"'); ResetConnection(); is_handshake_pending_ = false; @@ -329,7 +326,7 @@ SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::DoHandshakeStep( size_t in_data_size, const uint8_t** const out_data, size_t* out_data_size) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(out_data); DCHECK(out_data_size); *out_data = NULL; @@ -361,7 +358,7 @@ bool CryptoManagerImpl::SSLContextImpl::CheckInitFinished() { // TODO(Ezamakhov): add test - hanshake fail -> restart StartHandshake sync_primitives::AutoLock locker(ssl_locker_); if (SSL_is_init_finished(connection_)) { - LOGGER_DEBUG(logger_, "SSL initilization is finished"); + SDL_DEBUG("SSL initilization is finished"); is_handshake_pending_ = false; return true; } @@ -459,19 +456,19 @@ void CryptoManagerImpl::SSLContextImpl::SetHandshakeError(const int error) { } void CryptoManagerImpl::SSLContextImpl::ResetConnection() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const int shutdown_result = SSL_shutdown(connection_); if (shutdown_result != 1) { const size_t pend = BIO_ctrl_pending(bioOut_); - LOGGER_DEBUG(logger_, "Available " << pend << " bytes for shutdown"); + SDL_DEBUG("Available " << pend << " bytes for shutdown"); if (pend > 0) { - LOGGER_DEBUG(logger_, "Reading shutdown data"); + SDL_DEBUG("Reading shutdown data"); EnsureBufferSizeEnough(pend); BIO_read(bioOut_, buffer_, pend); } SSL_shutdown(connection_); } - LOGGER_DEBUG(logger_, "SSL connection recreation"); + SDL_DEBUG("SSL connection recreation"); SSL_CTX* ssl_context = connection_->ctx; SSL_free(connection_); connection_ = SSL_new(ssl_context); @@ -523,8 +520,7 @@ std::string CryptoManagerImpl::SSLContextImpl::GetTextBy(X509_NAME* name, const int req_len = X509_NAME_get_text_by_NID(name, object, NULL, 0); if (-1 == req_len) { - LOGGER_WARN(logger_, - "Unable to obtain object: " << object << " from certificate"); + SDL_WARN("Unable to obtain object: " << object << " from certificate"); return std::string(); } diff --git a/src/components/telemetry_monitor/src/protocol_handler_observer.cc b/src/components/telemetry_monitor/src/protocol_handler_observer.cc index 1541f152ff..3cd3dbb9f2 100644 --- a/src/components/telemetry_monitor/src/protocol_handler_observer.cc +++ b/src/components/telemetry_monitor/src/protocol_handler_observer.cc @@ -37,7 +37,7 @@ namespace telemetry_monitor { -CREATE_LOGGERPTR_GLOBAL(logger_, "TelemetryMonitor") +SDL_CREATE_LOGGER("TelemetryMonitor") ProtocolHandlerObserver::ProtocolHandlerObserver( TelemetryMonitor* telemetry_monitor) @@ -49,8 +49,7 @@ void ProtocolHandlerObserver::StartMessageProcess( return; } if (time_starts.find(message_id) != time_starts.end()) { - LOGGER_DEBUG( - logger_, + SDL_DEBUG( "Already waiting for stop processing for Message ID: " << message_id); return; } @@ -63,7 +62,7 @@ void ProtocolHandlerObserver::EndMessageProcess( std::map<uint32_t, TimevalStruct>::const_iterator it = time_starts.find(message_id); if (it == time_starts.end()) { - LOGGER_WARN(logger_, "Cant find start time for message" << message_id); + SDL_WARN("Cant find start time for message" << message_id); return; } m->begin = time_starts[message_id]; diff --git a/src/components/telemetry_monitor/src/telemetry_monitor.cc b/src/components/telemetry_monitor/src/telemetry_monitor.cc index 3290c02eb8..1443f17228 100644 --- a/src/components/telemetry_monitor/src/telemetry_monitor.cc +++ b/src/components/telemetry_monitor/src/telemetry_monitor.cc @@ -47,7 +47,7 @@ namespace telemetry_monitor { -CREATE_LOGGERPTR_GLOBAL(logger_, "TelemetryMonitor") +SDL_CREATE_LOGGER("TelemetryMonitor") TelemetryMonitor::TelemetryMonitor(const std::string& server_address, uint16_t port) @@ -65,7 +65,7 @@ void TelemetryMonitor::Start() { } void TelemetryMonitor::set_streamer(Streamer* streamer) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (thread_ && !thread_->is_running()) { thread_->set_delegate(streamer); if (streamer_) { @@ -73,7 +73,7 @@ void TelemetryMonitor::set_streamer(Streamer* streamer) { } streamer_ = streamer; } else { - LOGGER_ERROR(logger_, "Unable to replace streamer if it is active"); + SDL_ERROR("Unable to replace streamer if it is active"); } } @@ -95,7 +95,7 @@ void TelemetryMonitor::Init( TelemetryObservable<application_manager::AMTelemetryObserver>* app_manager, TelemetryObservable<transport_manager::TMTelemetryObserver>* transport_manager) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(streamer_); app_manager->SetTelemetryObserver(&app_observer); @@ -107,7 +107,7 @@ void TelemetryMonitor::Init( } void TelemetryMonitor::Stop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (thread_) { thread_->stop(); thread_->join(); @@ -134,18 +134,18 @@ Streamer::~Streamer() { } void Streamer::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Start(); while (!stop_flag_) { - LOGGER_INFO(logger_, "Server socket is listening "); + SDL_INFO("Server socket is listening "); client_socket_fd_ = accept(server_socket_fd_, NULL, NULL); if (0 > client_socket_fd_) { - LOGGER_ERROR(logger_, "Cant open socket . Socket is busy "); + SDL_ERROR("Cant open socket . Socket is busy "); Stop(); break; } - LOGGER_INFO(logger_, "Client connected"); + SDL_INFO("Client connected"); is_client_connected_ = true; while (is_client_connected_) { @@ -158,7 +158,7 @@ void Streamer::threadMain() { } if (!IsReady()) { - LOGGER_INFO(logger_, "Client disconnected."); + SDL_INFO("Client disconnected."); break; } @@ -168,20 +168,20 @@ void Streamer::threadMain() { } void Streamer::exitThreadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Stop(); messages_.Shutdown(); } void Streamer::Start() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); server_socket_fd_ = socket(AF_INET, SOCK_STREAM, 0); if (0 >= server_socket_fd_) { - LOGGER_ERROR(logger_, "Server open error"); + SDL_ERROR("Server open error"); return; } else { - LOGGER_DEBUG(logger_, "Server socket : " << server_socket_fd_); + SDL_DEBUG("Server socket : " << server_socket_fd_); } int32_t optval = 1; @@ -190,7 +190,7 @@ void Streamer::Start() { SO_REUSEADDR, &optval, sizeof optval)) { - LOGGER_ERROR(logger_, "Unable to set sockopt"); + SDL_ERROR("Unable to set sockopt"); return; } @@ -202,45 +202,44 @@ void Streamer::Start() { if (-1 == bind(server_socket_fd_, reinterpret_cast<struct sockaddr*>(&serv_addr_), sizeof(serv_addr_))) { - LOGGER_ERROR(logger_, - "Unable to bind server " << kserver_->ip().c_str() << ':' - << kserver_->port()); + SDL_ERROR("Unable to bind server " << kserver_->ip().c_str() << ':' + << kserver_->port()); return; } if (-1 == listen(server_socket_fd_, 1)) { - LOGGER_ERROR(logger_, "Streamer listen error " << strerror(errno)); + SDL_ERROR("Streamer listen error " << strerror(errno)); return; } } void Streamer::ShutDownAndCloseSocket(int32_t socket_fd) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (0 < socket_fd) { - LOGGER_INFO(logger_, "Shutdown socket"); + SDL_INFO("Shutdown socket"); if (-1 == ::shutdown(socket_fd, SHUT_RDWR)) { - LOGGER_ERROR(logger_, "Unable to shutdown socket"); + SDL_ERROR("Unable to shutdown socket"); } if (-1 == close(socket_fd)) { - LOGGER_ERROR(logger_, "Unable to close socket"); + SDL_ERROR("Unable to close socket"); } } else { - LOGGER_WARN(logger_, "Socket in not connected: " << socket_fd); + SDL_WARN("Socket in not connected: " << socket_fd); } } void Streamer::Stop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (stop_flag_) { - LOGGER_WARN(logger_, "Already Stopped"); + SDL_WARN("Already Stopped"); return; } stop_flag_ = true; messages_.Reset(); - LOGGER_WARN(logger_, "Stop server_socket_fd_"); + SDL_WARN("Stop server_socket_fd_"); ShutDownAndCloseSocket(server_socket_fd_); server_socket_fd_ = -1; - LOGGER_WARN(logger_, "Stop client_socket_fd_"); + SDL_WARN("Stop client_socket_fd_"); ShutDownAndCloseSocket(client_socket_fd_); client_socket_fd_ = -1; is_client_connected_ = false; @@ -258,10 +257,10 @@ bool Streamer::IsReady() const { const int retval = select(client_socket_fd_ + 1, 0, &fds, 0, &tv); if (-1 == retval) { - LOGGER_ERROR(logger_, "An error occurred"); + SDL_ERROR("An error occurred"); result = false; } else if (0 == retval) { - LOGGER_ERROR(logger_, "The timeout expired"); + SDL_ERROR("The timeout expired"); result = false; } @@ -269,14 +268,14 @@ bool Streamer::IsReady() const { } bool Streamer::Send(const std::string& msg) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!IsReady()) { - LOGGER_ERROR(logger_, " Socket is not ready"); + SDL_ERROR(" Socket is not ready"); return false; } if (-1 == ::send(client_socket_fd_, msg.c_str(), msg.size(), MSG_NOSIGNAL)) { - LOGGER_ERROR(logger_, " Unable to send"); + SDL_ERROR(" Unable to send"); return false; } return true; diff --git a/src/components/test_main.cc b/src/components/test_main.cc index 66013d78c4..101464117e 100644 --- a/src/components/test_main.cc +++ b/src/components/test_main.cc @@ -7,6 +7,5 @@ int main(int argc, char** argv) { ::testing::DefaultValue<custom_str::CustomString>::Set(
custom_str::CustomString(""));
const int result = RUN_ALL_TESTS();
- DEINIT_LOGGER();
return result;
}
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc b/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc index 62c879c7a0..40c8013e54 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc @@ -42,7 +42,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") BluetoothConnectionFactory::BluetoothConnectionFactory( TransportAdapterController* controller) @@ -54,17 +54,16 @@ TransportAdapter::Error BluetoothConnectionFactory::Init() { TransportAdapter::Error BluetoothConnectionFactory::CreateConnection( const DeviceUID& device_uid, const ApplicationHandle& app_handle) { - LOGGER_TRACE(logger_, - "enter. device_uid: " << &device_uid - << ", app_handle: " << &app_handle); + SDL_TRACE("enter. device_uid: " << &device_uid + << ", app_handle: " << &app_handle); BluetoothSocketConnection* connection( new BluetoothSocketConnection(device_uid, app_handle, controller_)); TransportAdapter::Error error = connection->Start(); if (TransportAdapter::OK != error) { - LOGGER_ERROR(logger_, "connection::Start() failed"); + SDL_ERROR("connection::Start() failed"); delete connection; } - LOGGER_TRACE(logger_, "exit with error: " << error); + SDL_TRACE("exit with error: " << error); return error; } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_posix.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_posix.cc index cff0ba4e2b..9e341d8d87 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_device_posix.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_posix.cc @@ -49,38 +49,36 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") bool BluetoothDevice::GetRfcommChannel(const ApplicationHandle app_handle, uint8_t* channel_out) { - LOGGER_TRACE(logger_, - "enter. app_handle: " << app_handle - << ", channel_out: " << channel_out); + SDL_TRACE("enter. app_handle: " << app_handle + << ", channel_out: " << channel_out); if (app_handle < 0 || app_handle > std::numeric_limits<uint8_t>::max()) { - LOGGER_TRACE(logger_, - "exit with FALSE. Condition: app_handle < 0 || app_handle > " - "numeric_limits::max()"); + SDL_TRACE( + "exit with FALSE. Condition: app_handle < 0 || app_handle > " + "numeric_limits::max()"); return false; } const uint8_t channel = static_cast<uint8_t>(app_handle); RfcommChannelVector::const_iterator it = std::find(rfcomm_channels_.begin(), rfcomm_channels_.end(), channel); if (it == rfcomm_channels_.end()) { - LOGGER_TRACE( - logger_, + SDL_TRACE( "exit with FALSE. Condition: channel not found in RfcommChannelVector"); return false; } *channel_out = channel; - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); return true; } std::string BluetoothDevice::GetUniqueDeviceId(const bdaddr_t& device_address) { - LOGGER_TRACE(logger_, "enter. device_adress: " << &device_address); + SDL_TRACE("enter. device_adress: " << &device_address); char device_address_string[32]; ba2str(&device_address, device_address_string); - LOGGER_TRACE(logger_, "exit with BT-" << device_address_string); + SDL_TRACE("exit with BT-" << device_address_string); return std::string("BT-") + device_address_string; } @@ -92,7 +90,7 @@ BluetoothDevice::BluetoothDevice(const bdaddr_t& device_address, , rfcomm_channels_(rfcomm_channels) {} bool BluetoothDevice::IsSameAs(const Device* other) const { - LOGGER_TRACE(logger_, "enter. device: " << other); + SDL_TRACE("enter. device: " << other); bool result = false; const BluetoothDevice* other_bluetooth_device = @@ -106,9 +104,9 @@ bool BluetoothDevice::IsSameAs(const Device* other) const { } } if (result) { - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); } else { - LOGGER_TRACE(logger_, "exit with FALSE"); + SDL_TRACE("exit with FALSE"); } return result; } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner_posix.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner_posix.cc index 6b662fbe1b..e21a21a8bd 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner_posix.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner_posix.cc @@ -57,7 +57,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") namespace { char* SplitToAddr(char* dev_list_entry) { @@ -71,14 +71,14 @@ char* SplitToAddr(char* dev_list_entry) { } int FindPairedDevs(std::vector<bdaddr_t>* result) { - LOGGER_TRACE(logger_, "enter. result adress: " << result); + SDL_TRACE("enter. result adress: " << result); DCHECK(result != NULL); const char* cmd = "bt-device -l"; FILE* pipe = popen(cmd, "r"); if (!pipe) { - LOGGER_TRACE(logger_, "exit -1. Condition: !pipe"); + SDL_TRACE("exit -1. Condition: !pipe"); return -1; } char* buffer = new char[1028]; @@ -96,7 +96,7 @@ int FindPairedDevs(std::vector<bdaddr_t>* result) { buffer = new char[1028]; } pclose(pipe); - LOGGER_TRACE(logger_, "exit with 0"); + SDL_TRACE("exit with 0"); return 0; } } // namespace @@ -147,7 +147,7 @@ bool BluetoothDeviceScanner::IsInitialised() const { } void BluetoothDeviceScanner::UpdateTotalDeviceList() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DeviceVector devices; devices.insert(devices.end(), paired_devices_with_sdl_.begin(), @@ -159,11 +159,11 @@ void BluetoothDeviceScanner::UpdateTotalDeviceList() { } void BluetoothDeviceScanner::DoInquiry() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const int device_id = hci_get_route(0); if (device_id < 0) { - LOGGER_INFO(logger_, "HCI device is not available"); + SDL_INFO("HCI device is not available"); shutdown_requested_ = true; controller_->SearchDeviceFailed(SearchDeviceError()); return; @@ -176,23 +176,22 @@ void BluetoothDeviceScanner::DoInquiry() { } if (paired_devices_.empty()) { - LOGGER_INFO(logger_, "Searching for paired devices."); + SDL_INFO("Searching for paired devices."); if (-1 == FindPairedDevs(&paired_devices_)) { - LOGGER_ERROR(logger_, "Failed to retrieve list of paired devices."); + SDL_ERROR("Failed to retrieve list of paired devices."); controller_->SearchDeviceFailed(SearchDeviceError()); } } - LOGGER_INFO(logger_, - "Check rfcomm channel on " << paired_devices_.size() - << " paired devices."); + SDL_INFO("Check rfcomm channel on " << paired_devices_.size() + << " paired devices."); paired_devices_with_sdl_.clear(); CheckSDLServiceOnDevices( paired_devices_, device_handle, &paired_devices_with_sdl_); UpdateTotalDeviceList(); - LOGGER_INFO(logger_, "Starting hci_inquiry on device " << device_id); + SDL_INFO("Starting hci_inquiry on device " << device_id); const uint8_t inquiry_time = 8u; // Time unit is 1.28 seconds const size_t max_devices = 256u; inquiry_info* inquiry_info_list = new inquiry_info[max_devices]; @@ -205,8 +204,7 @@ void BluetoothDeviceScanner::DoInquiry() { IREQ_CACHE_FLUSH); if (number_of_devices >= 0) { - LOGGER_INFO(logger_, - "hci_inquiry: found " << number_of_devices << " devices"); + SDL_INFO("hci_inquiry: found " << number_of_devices << " devices"); std::vector<bdaddr_t> found_devices(number_of_devices); for (int i = 0; i < number_of_devices; ++i) { found_devices[i] = inquiry_info_list[i].bdaddr; @@ -222,7 +220,7 @@ void BluetoothDeviceScanner::DoInquiry() { delete[] inquiry_info_list; if (number_of_devices < 0) { - LOGGER_DEBUG(logger_, "number_of_devices < 0"); + SDL_DEBUG("number_of_devices < 0"); controller_->SearchDeviceFailed(SearchDeviceError()); } } @@ -231,10 +229,9 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices( const std::vector<bdaddr_t>& bd_addresses, int device_handle, DeviceVector* discovered_devices) { - LOGGER_TRACE(logger_, - "enter. bd_addresses: " - << &bd_addresses << ", device_handle: " << device_handle - << ", discovered_devices: " << discovered_devices); + SDL_TRACE("enter. bd_addresses: " + << &bd_addresses << ", device_handle: " << device_handle + << ", discovered_devices: " << discovered_devices); std::vector<RfcommChannelVector> sdl_rfcomm_channels = DiscoverSmartDeviceLinkRFCOMMChannels(bd_addresses); @@ -253,7 +250,7 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices( 0); if (hci_read_remote_name_ret != 0) { - LOGGER_ERROR_WITH_ERRNO(logger_, "hci_read_remote_name failed"); + SDL_ERROR_WITH_ERRNO("hci_read_remote_name failed"); strncpy(deviceName, BluetoothDevice::GetUniqueDeviceId(bd_address).c_str(), sizeof(deviceName) / sizeof(deviceName[0])); @@ -262,19 +259,19 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices( Device* bluetooth_device = new BluetoothDevice(bd_address, deviceName, sdl_rfcomm_channels[i]); if (bluetooth_device) { - LOGGER_INFO(logger_, "Bluetooth device created successfully"); + SDL_INFO("Bluetooth device created successfully"); discovered_devices->push_back(bluetooth_device); } else { - LOGGER_WARN(logger_, "Can't create bluetooth device " << deviceName); + SDL_WARN("Can't create bluetooth device " << deviceName); } } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } std::vector<BluetoothDeviceScanner::RfcommChannelVector> BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( const std::vector<bdaddr_t>& device_addresses) { - LOGGER_TRACE(logger_, "enter device_addresses: " << &device_addresses); + SDL_TRACE("enter device_addresses: " << &device_addresses); const size_t size = device_addresses.size(); std::vector<RfcommChannelVector> result(size); @@ -299,17 +296,14 @@ BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( } sleep(attempt_timeout); } - LOGGER_TRACE( - logger_, - "exit with vector<RfcommChannelVector>: size = " << result.size()); + SDL_TRACE("exit with vector<RfcommChannelVector>: size = " << result.size()); return result; } bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( const bdaddr_t& device_address, RfcommChannelVector* channels) { - LOGGER_TRACE(logger_, - "enter. device_address: " << &device_address - << ", channels: " << channels); + SDL_TRACE("enter. device_address: " << &device_address + << ", channels: " << channels); static bdaddr_t any_address = {{0, 0, 0, 0, 0, 0}}; sdp_session_t* sdp_session = sdp_connect( @@ -317,9 +311,9 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( if (sdp_session == 0) { bool result = !(errno == 31 || errno == 16 || errno == 117 || errno == 114); if (result) { - LOGGER_TRACE(logger_, "exit with TRUE. Condition: sdp_session == 0"); + SDL_TRACE("exit with TRUE. Condition: sdp_session == 0"); } else { - LOGGER_TRACE(logger_, "exit with FALSE. Condition: sdp_session == 0"); + SDL_TRACE("exit with FALSE. Condition: sdp_session == 0"); } return result; } @@ -377,7 +371,7 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( sdp_close(sdp_session); if (!channels->empty()) { - LOGGER_INFO(logger_, "channels not empty"); + SDL_INFO("channels not empty"); std::stringstream rfcomm_channels_string; for (RfcommChannelVector::const_iterator it = channels->begin(); @@ -389,22 +383,19 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( rfcomm_channels_string << static_cast<uint32_t>(*it); } - LOGGER_INFO( - logger_, - "SmartDeviceLink service was discovered on device " - << BluetoothDevice::GetUniqueDeviceId(device_address) - << " at channel(s): " << rfcomm_channels_string.str().c_str()); + SDL_INFO("SmartDeviceLink service was discovered on device " + << BluetoothDevice::GetUniqueDeviceId(device_address) + << " at channel(s): " << rfcomm_channels_string.str().c_str()); } else { - LOGGER_INFO(logger_, - "SmartDeviceLink service was not discovered on device " - << BluetoothDevice::GetUniqueDeviceId(device_address)); + SDL_INFO("SmartDeviceLink service was not discovered on device " + << BluetoothDevice::GetUniqueDeviceId(device_address)); } - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); return true; } void BluetoothDeviceScanner::Thread() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ready_ = true; if (auto_repeat_search_) { while (!shutdown_requested_) { @@ -427,10 +418,10 @@ void BluetoothDeviceScanner::Thread() { } void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (auto_repeat_pause_sec_ == 0) { - LOGGER_TRACE(logger_, "exit. Condition: auto_repeat_pause_sec_ == 0"); + SDL_TRACE("exit. Condition: auto_repeat_pause_sec_ == 0"); return; } @@ -441,7 +432,7 @@ void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() { device_scan_requested_cv_.WaitFor(auto_lock, auto_repeat_pause_sec_ * 1000); if (wait_status == sync_primitives::ConditionalVariable::kTimeout) { - LOGGER_INFO(logger_, "Bluetooth scanner timeout, performing scan"); + SDL_INFO("Bluetooth scanner timeout, performing scan"); device_scan_requested_ = true; } } @@ -449,17 +440,17 @@ void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() { } TransportAdapter::Error BluetoothDeviceScanner::Init() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!thread_->start()) { - LOGGER_ERROR(logger_, "Bluetooth device scanner thread start failed"); + SDL_ERROR("Bluetooth device scanner thread start failed"); return TransportAdapter::FAIL; } - LOGGER_INFO(logger_, "Bluetooth device scanner thread started"); + SDL_INFO("Bluetooth device scanner thread started"); return TransportAdapter::OK; } void BluetoothDeviceScanner::Terminate() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); shutdown_requested_ = true; if (thread_) { { @@ -467,17 +458,16 @@ void BluetoothDeviceScanner::Terminate() { device_scan_requested_ = false; device_scan_requested_cv_.NotifyOne(); } - LOGGER_INFO(logger_, - "Waiting for bluetooth device scanner thread termination"); + SDL_INFO("Waiting for bluetooth device scanner thread termination"); thread_->stop(); - LOGGER_INFO(logger_, "Bluetooth device scanner thread stopped"); + SDL_INFO("Bluetooth device scanner thread stopped"); } } TransportAdapter::Error BluetoothDeviceScanner::Scan() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if ((!IsInitialised()) || shutdown_requested_) { - LOGGER_WARN(logger_, "BAD_STATE"); + SDL_WARN("BAD_STATE"); return TransportAdapter::BAD_STATE; } if (auto_repeat_pause_sec_ == 0) { @@ -487,12 +477,12 @@ TransportAdapter::Error BluetoothDeviceScanner::Scan() { sync_primitives::AutoLock auto_lock(device_scan_requested_lock_); if (!device_scan_requested_) { - LOGGER_TRACE(logger_, "Requesting device Scan"); + SDL_TRACE("Requesting device Scan"); device_scan_requested_ = true; device_scan_requested_cv_.NotifyOne(); } else { ret = TransportAdapter::BAD_STATE; - LOGGER_WARN(logger_, "BAD_STATE"); + SDL_WARN("BAD_STATE"); } return ret; } @@ -502,7 +492,7 @@ BluetoothDeviceScanner::BluetoothDeviceScannerDelegate:: : scanner_(scanner) {} void BluetoothDeviceScanner::BluetoothDeviceScannerDelegate::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(scanner_); scanner_->Thread(); } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner_win.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner_win.cc index eab43cf94a..89e63f6bd3 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner_win.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner_win.cc @@ -54,7 +54,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") BluetoothDeviceScanner::BluetoothDeviceScanner( TransportAdapterController* controller, @@ -107,7 +107,7 @@ bool BluetoothDeviceScanner::IsInitialised() const { } void BluetoothDeviceScanner::UpdateTotalDeviceList() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DeviceVector devices; devices.insert(devices.end(), paired_devices_with_sdl_.begin(), @@ -127,7 +127,7 @@ void BluetoothDeviceScanner::DoInquiry() { BluetoothFindFirstRadio(&bluetooth_find_param, &radio_handle); if (!hdbluetooth_dev_find_res) { - LOGGER_ERROR(logger_, "Failed to find first radio: " << GetLastError()); + SDL_ERROR("Failed to find first radio: " << GetLastError()); return; } @@ -147,9 +147,8 @@ void BluetoothDeviceScanner::DoInquiry() { BLUETOOTH_RADIO_INFO radio_info; radio_info.dwSize = sizeof(radio_info); if (ERROR_SUCCESS != BluetoothGetRadioInfo(radio_handle, &radio_info)) { - LOGGER_WARN(logger_, - "Bluetooth device not found. Error: " - << utils::GetLastErrorMessage(GetLastError())); + SDL_WARN("Bluetooth device not found. Error: " + << utils::GetLastErrorMessage(GetLastError())); return; } HANDLE device_find = @@ -182,7 +181,7 @@ void BluetoothDeviceScanner::DoInquiry() { controller_->FindNewApplicationsRequest(); } if (found_devices.empty()) { - LOGGER_DEBUG(logger_, "No devices were found"); + SDL_DEBUG("No devices were found"); controller_->SearchDeviceFailed(SearchDeviceError()); } } @@ -191,9 +190,8 @@ void BluetoothDeviceScanner::QueryBthProtocolInfo() { SOCKET bth_socket = ::socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); DWORD lastError = ::GetLastError(); if (bth_socket == INVALID_SOCKET) { - LOGGER_ERROR(logger_, - "Failed to get bluetooth socket! " - << utils::GetLastErrorMessage(lastError)); + SDL_ERROR("Failed to get bluetooth socket! " + << utils::GetLastErrorMessage(lastError)); return; } int protocol_info_size = sizeof(protocol_info_); @@ -205,9 +203,8 @@ void BluetoothDeviceScanner::QueryBthProtocolInfo() { lastError = ::GetLastError(); closesocket(bth_socket); if (retVal) { - LOGGER_ERROR(logger_, - "Failed to get bluetooth socket options! " - << utils::GetLastErrorMessage(lastError)); + SDL_ERROR("Failed to get bluetooth socket options! " + << utils::GetLastErrorMessage(lastError)); } } @@ -236,7 +233,7 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices( NI_NUMERICSERV); if (hci_read_remote_name_ret != 0) { - LOGGER_ERROR_WITH_ERRNO(logger_, "hci_read_remote_name failed"); + SDL_ERROR_WITH_ERRNO("hci_read_remote_name failed"); strncpy(deviceName, BluetoothDevice::GetUniqueDeviceId(bd_address).c_str(), sizeof(deviceName) / sizeof(deviceName[0])); @@ -246,10 +243,10 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices( bd_address, deviceName, sdl_rfcomm_channels[i], sock_addr_bth_server_); if (bluetooth_device) { - LOGGER_INFO(logger_, "Bluetooth device created successfully"); + SDL_INFO("Bluetooth device created successfully"); discovered_devices->push_back(bluetooth_device); } else { - LOGGER_WARN(logger_, "Can't create bluetooth device " << deviceName); + SDL_WARN("Can't create bluetooth device " << deviceName); } } } @@ -315,9 +312,7 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( handle_service_search, flags, &bufferLength, pResults)) { DWORD error = GetLastError(); if (WSA_E_NO_MORE != error) { - LOGGER_WARN( - logger_, - "Service scan error: " << utils::GetLastErrorMessage(error)); + SDL_WARN("Service scan error: " << utils::GetLastErrorMessage(error)); } break; } else { @@ -349,8 +344,7 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( } WSALookupServiceEnd(handle_service_search); } else { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Service search error:" << utils::GetLastErrorMessage(GetLastError())); return false; } @@ -358,7 +352,7 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( } void BluetoothDeviceScanner::Thread() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ready_ = true; if (auto_repeat_search_) { while (!shutdown_requested_) { @@ -392,7 +386,7 @@ void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() { device_scan_requested_cv_.WaitFor(auto_lock, auto_repeat_pause_sec_ * 1000); if (wait_status == sync_primitives::ConditionalVariable::kTimeout) { - LOGGER_INFO(logger_, "Bluetooth scanner timeout, performing scan"); + SDL_INFO("Bluetooth scanner timeout, performing scan"); device_scan_requested_ = true; } } @@ -400,17 +394,17 @@ void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() { } TransportAdapter::Error BluetoothDeviceScanner::Init() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!thread_->start()) { - LOGGER_ERROR(logger_, "Bluetooth device scanner thread start failed"); + SDL_ERROR("Bluetooth device scanner thread start failed"); return TransportAdapter::FAIL; } - LOGGER_INFO(logger_, "Bluetooth device scanner thread started"); + SDL_INFO("Bluetooth device scanner thread started"); return TransportAdapter::OK; } void BluetoothDeviceScanner::Terminate() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); shutdown_requested_ = true; if (thread_) { { @@ -418,17 +412,16 @@ void BluetoothDeviceScanner::Terminate() { device_scan_requested_ = false; device_scan_requested_cv_.NotifyOne(); } - LOGGER_INFO(logger_, - "Waiting for bluetooth device scanner thread termination"); + SDL_INFO("Waiting for bluetooth device scanner thread termination"); thread_->stop(); - LOGGER_INFO(logger_, "Bluetooth device scanner thread stopped"); + SDL_INFO("Bluetooth device scanner thread stopped"); } } TransportAdapter::Error BluetoothDeviceScanner::Scan() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if ((!IsInitialised()) || shutdown_requested_) { - LOGGER_WARN(logger_, "BAD_STATE"); + SDL_WARN("BAD_STATE"); return TransportAdapter::BAD_STATE; } if (auto_repeat_pause_sec_ == 0) { @@ -438,12 +431,12 @@ TransportAdapter::Error BluetoothDeviceScanner::Scan() { sync_primitives::AutoLock auto_lock(device_scan_requested_lock_); if (!device_scan_requested_) { - LOGGER_TRACE(logger_, "Requesting device Scan"); + SDL_TRACE("Requesting device Scan"); device_scan_requested_ = true; device_scan_requested_cv_.NotifyOne(); } else { ret = TransportAdapter::BAD_STATE; - LOGGER_WARN(logger_, "BAD_STATE"); + SDL_WARN("BAD_STATE"); } return ret; } @@ -453,7 +446,7 @@ BluetoothDeviceScanner::BluetoothDeviceScannerDelegate:: : scanner_(scanner) {} void BluetoothDeviceScanner::BluetoothDeviceScannerDelegate::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(scanner_); scanner_->Thread(); } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_win.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_win.cc index 0c29069e40..67429a3710 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_device_win.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_win.cc @@ -43,41 +43,38 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") bool BluetoothDevice::GetRfcommChannel(const ApplicationHandle app_handle, uint8_t* channel_out) { - LOGGER_TRACE(logger_, - "enter. app_handle: " << app_handle - << ", channel_out: " << channel_out); + SDL_TRACE("enter. app_handle: " << app_handle + << ", channel_out: " << channel_out); if (app_handle < 0 || app_handle > std::numeric_limits<uint8_t>::max()) { - LOGGER_TRACE(logger_, - "exit with FALSE. Condition: app_handle < 0 || app_handle > " - "numeric_limits::max()"); + SDL_TRACE( + "exit with FALSE. Condition: app_handle < 0 || app_handle > " + "numeric_limits::max()"); return false; } const uint8_t channel = static_cast<uint8_t>(app_handle); RfcommChannelVector::const_iterator it = std::find(rfcomm_channels_.begin(), rfcomm_channels_.end(), channel); if (it == rfcomm_channels_.end()) { - LOGGER_TRACE( - logger_, + SDL_TRACE( "exit with FALSE. Condition: channel not found in RfcommChannelVector"); return false; } *channel_out = channel; - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); return true; } std::string BluetoothDevice::GetUniqueDeviceId( const BLUETOOTH_ADDR_INFO& device_address) { - LOGGER_TRACE( - logger_, + SDL_TRACE( "enter. device_adress: " << utils::BthDeviceAddrToStr(device_address)); char device_address_string[32]; sprintf(device_address_string, "%ws", device_address.szName); - LOGGER_TRACE(logger_, "exit with BT-" << device_address_string); + SDL_TRACE("exit with BT-" << device_address_string); return std::string("BT-") + device_address_string; } @@ -91,7 +88,7 @@ BluetoothDevice::BluetoothDevice(const BLUETOOTH_ADDR_INFO& device_address, , sock_addr_bth_server_(sock_addr_bth_server) {} bool BluetoothDevice::IsSameAs(const Device* other) const { - LOGGER_TRACE(logger_, "enter. device: " << other); + SDL_TRACE("enter. device: " << other); bool result = false; const BluetoothDevice* other_bluetooth_device = @@ -105,9 +102,9 @@ bool BluetoothDevice::IsSameAs(const Device* other) const { } } if (result) { - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); } else { - LOGGER_TRACE(logger_, "exit with FALSE"); + SDL_TRACE("exit with FALSE"); } return result; } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection_posix.cc b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection_posix.cc index 9f45b098f8..a36636e029 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection_posix.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection_posix.cc @@ -52,20 +52,19 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") namespace { bool CloseSocket(int& socket) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (0 == socket) { - LOGGER_DEBUG(logger_, - "Socket " << socket << " is not valid. Skip closing."); + SDL_DEBUG("Socket " << socket << " is not valid. Skip closing."); return true; } errno = 0; if (-1 != close(socket)) { - LOGGER_WARN_WITH_ERRNO(logger_, "Failed recvto close socket " << socket); + SDL_WARN_WITH_ERRNO("Failed recvto close socket " << socket); return false; } socket = 0; @@ -94,7 +93,7 @@ BluetoothSocketConnection::BluetoothSocketConnection( } BluetoothSocketConnection::~BluetoothSocketConnection() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Disconnect(); thread_->join(); delete thread_->delegate(); @@ -102,33 +101,33 @@ BluetoothSocketConnection::~BluetoothSocketConnection() { } TransportAdapter::Error BluetoothSocketConnection::Start() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!thread_->start()) { - LOGGER_ERROR(logger_, "thread creation failed"); + SDL_ERROR("thread creation failed"); return TransportAdapter::FAIL; } - LOGGER_INFO(logger_, "thread created"); + SDL_INFO("thread created"); return TransportAdapter::OK; } void BluetoothSocketConnection::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); controller_->ConnectionCreated(this, device_uid_, app_handle_); ConnectError* connect_error = NULL; if (!Establish(&connect_error)) { - LOGGER_ERROR(logger_, "Connection Establish failed"); + SDL_ERROR("Connection Establish failed"); delete connect_error; } - LOGGER_DEBUG(logger_, "Connection established"); + SDL_DEBUG("Connection established"); controller_->ConnectDone(device_handle(), application_handle()); while (!terminate_flag_) { Transmit(); } - LOGGER_DEBUG(logger_, "Connection is to finalize"); + SDL_DEBUG("Connection is to finalize"); Finalize(); sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); while (!frames_to_send_.empty()) { - LOGGER_INFO(logger_, "removing message"); + SDL_INFO("removing message"); ::protocol_handler::RawMessagePtr message = frames_to_send_.front(); frames_to_send_.pop(); controller_->DataSendFailed( @@ -137,8 +136,8 @@ void BluetoothSocketConnection::threadMain() { } void BluetoothSocketConnection::Transmit() { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Waiting for connection events. " << this); + SDL_AUTO_TRACE(); + SDL_DEBUG("Waiting for connection events. " << this); const nfds_t kPollFdsSize = 2; pollfd poll_fds[kPollFdsSize]; @@ -149,26 +148,23 @@ void BluetoothSocketConnection::Transmit() { poll_fds[1].events = POLLIN | POLLPRI; errno = 0; if (-1 == poll(poll_fds, kPollFdsSize, -1)) { - LOGGER_ERROR_WITH_ERRNO(logger_, - "poll failed for the socket " << rfcomm_socket_); + SDL_ERROR_WITH_ERRNO("poll failed for the socket " << rfcomm_socket_); OnError(errno); return; } - LOGGER_DEBUG(logger_, - "poll is ok for the socket " - << rfcomm_socket_ << " revents0: " << std::hex - << poll_fds[0].revents << " revents1:" << std::hex - << poll_fds[1].revents); + SDL_DEBUG("poll is ok for the socket " + << rfcomm_socket_ << " revents0: " << std::hex + << poll_fds[0].revents << " revents1:" << std::hex + << poll_fds[1].revents); // error check if (0 != (poll_fds[1].revents & (POLLERR | POLLHUP | POLLNVAL))) { - LOGGER_ERROR(logger_, - "Notification pipe for socket " << rfcomm_socket_ - << " terminated."); + SDL_ERROR("Notification pipe for socket " << rfcomm_socket_ + << " terminated."); OnError(errno); return; } if (poll_fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) { - LOGGER_DEBUG(logger_, "Socket " << rfcomm_socket_ << " has terminated."); + SDL_DEBUG("Socket " << rfcomm_socket_ << " has terminated."); OnClose(); return; } @@ -181,10 +177,9 @@ void BluetoothSocketConnection::Transmit() { bytes_read = read(read_fd_, buffer, sizeof(buffer)); } while (bytes_read > 0); if ((bytes_read < 0) && (EAGAIN != errno)) { - LOGGER_ERROR_WITH_ERRNO( - logger_, + SDL_ERROR_WITH_ERRNO( "Failed to clear notification pipe. Poll failed for socket " - << rfcomm_socket_); + << rfcomm_socket_); OnError(errno); return; } @@ -202,8 +197,8 @@ void BluetoothSocketConnection::Transmit() { } void BluetoothSocketConnection::Send() { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Trying to send data if available"); + SDL_AUTO_TRACE(); + SDL_DEBUG("Trying to send data if available"); FrameQueue frames_to_send; { sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); @@ -219,7 +214,7 @@ void BluetoothSocketConnection::Send() { frame->data_size() - offset, bytes_sent); if (!sent) { - LOGGER_ERROR(logger_, "Send failed for connection " << this); + SDL_ERROR("Send failed for connection " << this); frames_to_send.pop(); offset = 0; controller_->DataSendFailed( @@ -243,7 +238,7 @@ bool BluetoothSocketConnection::Send(const char* const buffer, std::size_t& bytes_written) { bytes_written = 0u; if (!IsValid()) { - LOGGER_ERROR(logger_, "Failed to send data socket is not valid"); + SDL_ERROR("Failed to send data socket is not valid"); return false; } const int flags = MSG_NOSIGNAL; @@ -252,7 +247,7 @@ bool BluetoothSocketConnection::Send(const char* const buffer, int socket_error = errno; if (-1 == written) { if (EAGAIN != socket_error && EWOULDBLOCK != socket_error) { - LOGGER_ERROR_WITH_ERRNO(logger_, "Failed to send data."); + SDL_ERROR_WITH_ERRNO("Failed to send data."); return false; } else { return true; @@ -261,17 +256,16 @@ bool BluetoothSocketConnection::Send(const char* const buffer, // Lets double chek written because we have signed to unsigned conversion DCHECK(written >= 0); bytes_written = static_cast<std::size_t>(written); - LOGGER_DEBUG(logger_, - "Sent " << written << " bytes to socket " << rfcomm_socket_); + SDL_DEBUG("Sent " << written << " bytes to socket " << rfcomm_socket_); return true; } bool BluetoothSocketConnection::Close() { if (!IsValid()) { - LOGGER_DEBUG(logger_, "Connection is not valid. Nothing to close."); + SDL_DEBUG("Connection is not valid. Nothing to close."); return true; } - LOGGER_DEBUG(logger_, "Closing connection."); + SDL_DEBUG("Closing connection."); // Possibly we're waiting on Wait. We have to interrupt this. Notify(); @@ -291,7 +285,7 @@ bool BluetoothSocketConnection::IsValid() const { } void BluetoothSocketConnection::OnError(int error) { - LOGGER_ERROR(logger_, "Connection error: " << error); + SDL_ERROR("Connection error: " << error); Abort(); } @@ -303,17 +297,17 @@ void BluetoothSocketConnection::OnData(const uint8_t* const buffer, } void BluetoothSocketConnection::OnCanWrite() { - LOGGER_DEBUG(logger_, "OnCanWrite event. Trying to send data."); + SDL_DEBUG("OnCanWrite event. Trying to send data."); Send(); } bool BluetoothSocketConnection::Establish(ConnectError** error) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "error: " << error); + SDL_AUTO_TRACE(); + SDL_DEBUG("error: " << error); DeviceSptr device = controller()->FindDevice(device_handle()); if (!device.valid()) { - LOGGER_ERROR(logger_, "Device is not valid."); + SDL_ERROR("Device is not valid."); return false; } @@ -323,17 +317,15 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) { uint8_t rfcomm_channel = 0; if (!bluetooth_device->GetRfcommChannel(application_handle(), &rfcomm_channel)) { - LOGGER_DEBUG(logger_, - "Application " << application_handle() << " not found"); + SDL_DEBUG("Application " << application_handle() << " not found"); *error = new ConnectError(); - LOGGER_TRACE(logger_, "exit with FALSE"); + SDL_TRACE("exit with FALSE"); return false; } - LOGGER_DEBUG(logger_, - "Connecting to " - << "bluetooth device on port" - << ":" << rfcomm_channel); + SDL_DEBUG("Connecting to " + << "bluetooth device on port" + << ":" << rfcomm_channel); sockaddr_rc remoteSocketAddress = {0}; remoteSocketAddress.rc_family = AF_BLUETOOTH; @@ -344,16 +336,15 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) { uint8_t attempts = 4; int connect_status = 0; - LOGGER_DEBUG(logger_, "start rfcomm Connect attempts"); + SDL_DEBUG("start rfcomm Connect attempts"); do { - LOGGER_DEBUG(logger_, "Attempts left: " << attempts); + SDL_DEBUG("Attempts left: " << attempts); errno = 0; rfcomm_socket = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); if (-1 == rfcomm_socket) { - LOGGER_ERROR_WITH_ERRNO(logger_, - "Failed to create RFCOMM socket for device."); + SDL_ERROR_WITH_ERRNO("Failed to create RFCOMM socket for device."); Close(); - LOGGER_TRACE(logger_, "exit with FALSE"); + SDL_TRACE("exit with FALSE"); return false; } errno = 0; @@ -362,26 +353,25 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) { reinterpret_cast<sockaddr*>(&remoteSocketAddress), sizeof(remoteSocketAddress)); if (0 == connect_status) { - LOGGER_DEBUG(logger_, "rfcomm Connect ok"); + SDL_DEBUG("rfcomm Connect ok"); break; } if (errno != 111 && errno != 104) { - LOGGER_ERROR_WITH_ERRNO(logger_, "rfcomm connect error."); + SDL_ERROR_WITH_ERRNO("rfcomm connect error."); } if (errno) { - LOGGER_ERROR_WITH_ERRNO(logger_, "rfcomm connect error."); + SDL_ERROR_WITH_ERRNO("rfcomm connect error."); CloseSocket(rfcomm_socket); } sleep(2); } while (--attempts > 0); - LOGGER_INFO(logger_, "rfcomm Connect attempts finished"); + SDL_INFO("rfcomm Connect attempts finished"); if (0 != connect_status) { - LOGGER_DEBUG(logger_, - "Failed to Connect to remote bluetooth device for session " - << this); + SDL_DEBUG("Failed to Connect to remote bluetooth device for session " + << this); CloseSocket(rfcomm_socket); - LOGGER_TRACE(logger_, "exit with FALSE"); + SDL_TRACE("exit with FALSE"); return false; } @@ -391,42 +381,42 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) { } rfcomm_socket_ = rfcomm_socket; - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); return true; } TransportAdapter::Error BluetoothSocketConnection::Notify() { if (-1 == write_fd_) { - LOGGER_ERROR(logger_, - "File descriptior for writing is invalid. " - "Failed to wake up connection thread for connection " - << this); + SDL_ERROR( + "File descriptior for writing is invalid. " + "Failed to wake up connection thread for connection " + << this); return TransportAdapter::FAIL; } uint8_t buffer = 0; errno = 0; if (1 != write(write_fd_, &buffer, 1)) { - LOGGER_ERROR_WITH_ERRNO( - logger_, "Failed to wake up connection thread for connection " << this); + SDL_ERROR_WITH_ERRNO("Failed to wake up connection thread for connection " + << this); return TransportAdapter::FAIL; } return TransportAdapter::OK; } void BluetoothSocketConnection::Abort() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); unexpected_disconnect_ = true; terminate_flag_ = true; } void BluetoothSocketConnection::Finalize() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (unexpected_disconnect_) { - LOGGER_DEBUG(logger_, "unexpected_disconnect"); + SDL_DEBUG("unexpected_disconnect"); controller_->ConnectionAborted( device_handle(), application_handle(), CommunicationError()); } else { - LOGGER_DEBUG(logger_, "not unexpected_disconnect"); + SDL_DEBUG("not unexpected_disconnect"); controller_->ConnectionFinished(device_handle(), application_handle()); } CloseSocket(rfcomm_socket_); @@ -434,14 +424,14 @@ void BluetoothSocketConnection::Finalize() { TransportAdapter::Error BluetoothSocketConnection::SendData( ::protocol_handler::RawMessagePtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); frames_to_send_.push(message); return Notify(); } TransportAdapter::Error BluetoothSocketConnection::Disconnect() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); terminate_flag_ = true; return Notify(); } @@ -459,7 +449,7 @@ ApplicationHandle BluetoothSocketConnection::application_handle() const { } void BluetoothSocketConnection::OnRead() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const std::size_t buffer_size = 4096u; char buffer[buffer_size]; int bytes_read = -1; @@ -468,22 +458,19 @@ void BluetoothSocketConnection::OnRead() { errno = 0; bytes_read = recv(rfcomm_socket_, buffer, sizeof(buffer), MSG_DONTWAIT); if (bytes_read > 0) { - LOGGER_DEBUG(logger_, - "Received " << bytes_read << " bytes from socket " - << rfcomm_socket_); + SDL_DEBUG("Received " << bytes_read << " bytes from socket " + << rfcomm_socket_); uint8_t* casted_buffer = reinterpret_cast<uint8_t*>(buffer); OnData(casted_buffer, bytes_read); } else if (bytes_read < 0) { int socket_error = errno; if (EAGAIN != socket_error && EWOULDBLOCK != socket_error) { - LOGGER_ERROR_WITH_ERRNO( - logger_, "recv() failed for connection " << rfcomm_socket_); + SDL_ERROR_WITH_ERRNO("recv() failed for connection " << rfcomm_socket_); OnError(socket_error); return; } } else { - LOGGER_WARN(logger_, - "Socket " << rfcomm_socket_ << " closed by remote peer"); + SDL_WARN("Socket " << rfcomm_socket_ << " closed by remote peer"); OnError(errno); return; } @@ -500,11 +487,11 @@ bool BluetoothSocketConnection::CreateNotifictionPipes() { const int result = pipe(fds); if (0 != result) { - LOGGER_ERROR_WITH_ERRNO(logger_, "Pipe creation failed."); + SDL_ERROR_WITH_ERRNO("Pipe creation failed."); return false; } - LOGGER_DEBUG(logger_, "Pipe has been created."); + SDL_DEBUG("Pipe has been created."); read_fd_ = fds[0]; write_fd_ = fds[1]; @@ -512,7 +499,7 @@ bool BluetoothSocketConnection::CreateNotifictionPipes() { const int fcntl_ret = fcntl(read_fd_, F_SETFL, fcntl(read_fd_, F_GETFL) | O_NONBLOCK); if (0 != fcntl_ret) { - LOGGER_ERROR_WITH_ERRNO(logger_, "fcntl failed."); + SDL_ERROR_WITH_ERRNO("fcntl failed."); return false; } return true; @@ -531,13 +518,13 @@ BluetoothSocketConnection::BthConnectionDelegate::BthConnectionDelegate( : connection_(connection) {} void BluetoothSocketConnection::BthConnectionDelegate::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(connection_); connection_->threadMain(); } void BluetoothSocketConnection::BthConnectionDelegate::exitThreadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } } // namespace transport_adapter diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection_win.cc b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection_win.cc index c0141fbedd..d9cc46e932 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection_win.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection_win.cc @@ -40,21 +40,18 @@ #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") namespace { bool CloseSocket(SOCKET& socket) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Closing socket " << socket); + SDL_AUTO_TRACE(); + SDL_DEBUG("Closing socket " << socket); if (NULL == socket) { - LOGGER_DEBUG(logger_, - "Socket " << socket << " is not valid. Skip closing."); + SDL_DEBUG("Socket " << socket << " is not valid. Skip closing."); return true; } if (SOCKET_ERROR == closesocket(socket)) { - LOGGER_WARN(logger_, - "Failed to close socket " << socket << ": " - << WSAGetLastError()); + SDL_WARN("Failed to close socket " << socket << ": " << WSAGetLastError()); return false; } socket = NULL; @@ -62,7 +59,7 @@ bool CloseSocket(SOCKET& socket) { } HANDLE CreateNotifyEvent() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HANDLE result = CreateEvent(NULL, // no security attribute true, // is manual-reset event false, // initial state = non-signaled @@ -94,7 +91,7 @@ BluetoothSocketConnection::BluetoothSocketConnection( } BluetoothSocketConnection::~BluetoothSocketConnection() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Disconnect(); thread_->join(); delete thread_->delegate(); @@ -102,33 +99,33 @@ BluetoothSocketConnection::~BluetoothSocketConnection() { } TransportAdapter::Error BluetoothSocketConnection::Start() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!thread_->start()) { - LOGGER_ERROR(logger_, "thread creation failed"); + SDL_ERROR("thread creation failed"); return TransportAdapter::FAIL; } - LOGGER_INFO(logger_, "thread created"); + SDL_INFO("thread created"); return TransportAdapter::OK; } void BluetoothSocketConnection::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); controller_->ConnectionCreated(this, device_uid_, app_handle_); ConnectError* connect_error = NULL; if (!Establish(&connect_error)) { - LOGGER_ERROR(logger_, "Connection Establish failed"); + SDL_ERROR("Connection Establish failed"); delete connect_error; } - LOGGER_DEBUG(logger_, "Connection established"); + SDL_DEBUG("Connection established"); controller_->ConnectDone(device_handle(), application_handle()); while (!terminate_flag_) { Transmit(); } - LOGGER_DEBUG(logger_, "Connection is to finalize"); + SDL_DEBUG("Connection is to finalize"); Finalize(); sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); while (!frames_to_send_.empty()) { - LOGGER_INFO(logger_, "removing message"); + SDL_INFO("removing message"); ::protocol_handler::RawMessagePtr message = frames_to_send_.front(); frames_to_send_.pop(); controller_->DataSendFailed( @@ -137,11 +134,11 @@ void BluetoothSocketConnection::threadMain() { } void BluetoothSocketConnection::Transmit() { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Waiting for connection events. " << this); + SDL_AUTO_TRACE(); + SDL_DEBUG("Waiting for connection events. " << this); if (!IsValid()) { - LOGGER_ERROR(logger_, "Cannot wait. Not connected."); + SDL_ERROR("Cannot wait. Not connected."); Close(); return; } @@ -165,14 +162,12 @@ void BluetoothSocketConnection::Transmit() { const bool is_notify_event = (waited_index == WAIT_OBJECT_0 + 1); if (is_socket_event || is_notify_event) { - LOGGER_DEBUG(logger_, - "Waited event for the connection " - << rfcomm_socket_ << ". Socket event: " << is_socket_event - << ". Notify event: " << is_notify_event); + SDL_DEBUG("Waited event for the connection " + << rfcomm_socket_ << ". Socket event: " << is_socket_event + << ". Notify event: " << is_notify_event); } else { - LOGGER_ERROR(logger_, - "Wait for socket or notification has failed with error: " - << WSAGetLastError()); + SDL_ERROR("Wait for socket or notification has failed with error: " + << WSAGetLastError()); OnError(WSAGetLastError()); return; } @@ -181,24 +176,22 @@ void BluetoothSocketConnection::Transmit() { if (WSAEnumNetworkEvents(rfcomm_socket_, events_to_wait[waited_index - WAIT_OBJECT_0], &net_events) == SOCKET_ERROR) { - LOGGER_ERROR(logger_, - "Failed to enum socket events: " << WSAGetLastError()); + SDL_ERROR("Failed to enum socket events: " << WSAGetLastError()); OnError(WSAGetLastError()); return; } if (net_events.lNetworkEvents & FD_READ) { - LOGGER_DEBUG(logger_, "Network event: FD_READ"); + SDL_DEBUG("Network event: FD_READ"); OnRead(); return; } if (net_events.lNetworkEvents & FD_WRITE) { - LOGGER_DEBUG(logger_, "Network event: FD_WRITE"); + SDL_DEBUG("Network event: FD_WRITE"); is_can_write = true; } if (net_events.lNetworkEvents & FD_CLOSE) { - LOGGER_DEBUG(logger_, - "Network event: FD_CLOSE. " - << "Connection " << this << " terminated"); + SDL_DEBUG("Network event: FD_CLOSE. " + << "Connection " << this << " terminated"); OnClose(); return; } @@ -211,12 +204,12 @@ void BluetoothSocketConnection::Transmit() { if (is_notify_event || is_can_write) { OnWrite(); } - LOGGER_DEBUG(logger_, "Waited for connection events: " << this); + SDL_DEBUG("Waited for connection events: " << this); } void BluetoothSocketConnection::Send() { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Trying to send data if available"); + SDL_AUTO_TRACE(); + SDL_DEBUG("Trying to send data if available"); FrameQueue frames_to_send; { sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); @@ -232,7 +225,7 @@ void BluetoothSocketConnection::Send() { frame->data_size() - offset, bytes_sent); if (!sent) { - LOGGER_ERROR(logger_, "Send failed for connection " << this); + SDL_ERROR("Send failed for connection " << this); frames_to_send.pop(); offset = 0; controller_->DataSendFailed( @@ -256,7 +249,7 @@ bool BluetoothSocketConnection::Send(const char* const buffer, std::size_t& bytes_written) { bytes_written = 0u; if (!IsValid()) { - LOGGER_ERROR(logger_, "Failed to send data socket is not valid"); + SDL_ERROR("Failed to send data socket is not valid"); return false; } const int flags = 0; @@ -264,7 +257,7 @@ bool BluetoothSocketConnection::Send(const char* const buffer, int socket_error = WSAGetLastError(); if (SOCKET_ERROR == written) { if (WSAEWOULDBLOCK != socket_error) { - LOGGER_ERROR(logger_, "Failed to send data: " << socket_error); + SDL_ERROR("Failed to send data: " << socket_error); return false; } else { return true; @@ -273,14 +266,13 @@ bool BluetoothSocketConnection::Send(const char* const buffer, // Lets double chek written because we have signed to unsigned conversion DCHECK(written >= 0); bytes_written = static_cast<size_t>(written); - LOGGER_DEBUG(logger_, - "Sent " << written << " bytes to socket " << rfcomm_socket_); + SDL_DEBUG("Sent " << written << " bytes to socket " << rfcomm_socket_); return true; } bool BluetoothSocketConnection::Close() { if (!IsValid()) { - LOGGER_DEBUG(logger_, "Connection is not valid. Nothing to close."); + SDL_DEBUG("Connection is not valid. Nothing to close."); return true; } // Possibly we're waiting on Wait. We have to interrupt this. @@ -288,12 +280,12 @@ bool BluetoothSocketConnection::Close() { const BOOL event_closed = CloseHandle(notify_event_); if (!event_closed) { - LOGGER_WARN(logger_, "Failed to close event handler"); + SDL_WARN("Failed to close event handler"); } const bool socket_closed = CloseSocket(rfcomm_socket_); if (!socket_closed) { - LOGGER_WARN(logger_, "Failed to close socket handler"); + SDL_WARN("Failed to close socket handler"); } return event_closed && socket_closed; @@ -304,7 +296,7 @@ bool BluetoothSocketConnection::IsValid() const { } void BluetoothSocketConnection::OnError(int error) { - LOGGER_ERROR(logger_, "Connection error: " << error); + SDL_ERROR("Connection error: " << error); Abort(); } @@ -316,67 +308,63 @@ void BluetoothSocketConnection::OnData(const uint8_t* const buffer, } void BluetoothSocketConnection::OnCanWrite() { - LOGGER_DEBUG(logger_, "OnCanWrite event. Trying to send data."); + SDL_DEBUG("OnCanWrite event. Trying to send data."); Send(); } bool BluetoothSocketConnection::Establish(ConnectError** error) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "error: " << error); + SDL_AUTO_TRACE(); + SDL_DEBUG("error: " << error); DeviceSptr device = controller()->FindDevice(device_handle()); BluetoothDevice* bluetooth_device = static_cast<BluetoothDevice*>(device.get()); SOCKADDR_BTH bthAddr = bluetooth_device->getSocketBthAddr(); if (bthAddr.port == NULL) { - LOGGER_DEBUG(logger_, - "Application " << application_handle() << " not found"); + SDL_DEBUG("Application " << application_handle() << " not found"); *error = new ConnectError(); - LOGGER_TRACE(logger_, "exit with FALSE"); + SDL_TRACE("exit with FALSE"); return false; } int attempts = 4; int connect_status = 0; - LOGGER_DEBUG(logger_, "start rfcomm Connect attempts"); + SDL_DEBUG("start rfcomm Connect attempts"); do { rfcomm_socket_ = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); if (-1 == rfcomm_socket_) { - LOGGER_ERROR_WITH_ERRNO(logger_, - "Failed to create RFCOMM socket for device " - << device_handle()); - LOGGER_TRACE(logger_, "exit with FALSE"); + SDL_ERROR_WITH_ERRNO("Failed to create RFCOMM socket for device " + << device_handle()); + SDL_TRACE("exit with FALSE"); return false; } const sockaddr* p_sockaddr = reinterpret_cast<const sockaddr*>(&bthAddr); connect_status = connect(rfcomm_socket_, p_sockaddr, sizeof(SOCKADDR_BTH)); if (0 == connect_status) { - LOGGER_DEBUG(logger_, "rfcomm Connect ok"); + SDL_DEBUG("rfcomm Connect ok"); break; } if (errno != 111 && errno != 104) { - LOGGER_DEBUG(logger_, "rfcomm Connect errno " << errno); + SDL_DEBUG("rfcomm Connect errno " << errno); break; } if (errno) { - LOGGER_DEBUG(logger_, "rfcomm Connect errno " << errno); + SDL_DEBUG("rfcomm Connect errno " << errno); CloseSocket(rfcomm_socket_); } Sleep(2); } while (--attempts > 0); - LOGGER_INFO(logger_, "rfcomm Connect attempts finished"); + SDL_INFO("rfcomm Connect attempts finished"); if (0 != connect_status) { - LOGGER_TRACE(logger_, "exit with FALSE"); - LOGGER_DEBUG( - logger_, - "Failed to Connect to remote device " - << BluetoothDevice::GetUniqueDeviceId(bluetooth_device->address()) - << " for session " << this); + SDL_TRACE("exit with FALSE"); + SDL_DEBUG("Failed to Connect to remote device " + << BluetoothDevice::GetUniqueDeviceId(bluetooth_device->address()) + << " for session " << this); *error = new ConnectError(); return false; } notify_event_ = CreateNotifyEvent(); - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); return true; } @@ -386,19 +374,19 @@ TransportAdapter::Error BluetoothSocketConnection::Notify() { } void BluetoothSocketConnection::Abort() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); unexpected_disconnect_ = true; terminate_flag_ = true; } void BluetoothSocketConnection::Finalize() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (unexpected_disconnect_) { - LOGGER_DEBUG(logger_, "unexpected_disconnect"); + SDL_DEBUG("unexpected_disconnect"); controller_->ConnectionAborted( device_handle(), application_handle(), CommunicationError()); } else { - LOGGER_DEBUG(logger_, "not unexpected_disconnect"); + SDL_DEBUG("not unexpected_disconnect"); controller_->ConnectionFinished(device_handle(), application_handle()); } CloseSocket(rfcomm_socket_); @@ -406,14 +394,14 @@ void BluetoothSocketConnection::Finalize() { TransportAdapter::Error BluetoothSocketConnection::SendData( ::protocol_handler::RawMessagePtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); frames_to_send_.push(message); return Notify(); } TransportAdapter::Error BluetoothSocketConnection::Disconnect() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); terminate_flag_ = true; return Notify(); } @@ -431,7 +419,7 @@ ApplicationHandle BluetoothSocketConnection::application_handle() const { } void BluetoothSocketConnection::OnRead() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); const std::size_t buffer_size = 4096u; char buffer[buffer_size]; int bytes_read = -1; @@ -439,23 +427,20 @@ void BluetoothSocketConnection::OnRead() { do { bytes_read = recv(rfcomm_socket_, buffer, sizeof(buffer), 0); if (bytes_read > 0) { - LOGGER_DEBUG(logger_, - "Received " << bytes_read << " bytes from socket " - << rfcomm_socket_); + SDL_DEBUG("Received " << bytes_read << " bytes from socket " + << rfcomm_socket_); uint8_t* casted_buffer = reinterpret_cast<uint8_t*>(buffer); OnData(casted_buffer, bytes_read); } else if (bytes_read < 0) { int socket_error = WSAGetLastError(); if (bytes_read == SOCKET_ERROR && WSAEWOULDBLOCK != socket_error) { - LOGGER_ERROR(logger_, - "recv() failed for connection " - << rfcomm_socket_ << ". Error: " << socket_error); + SDL_ERROR("recv() failed for connection " + << rfcomm_socket_ << ". Error: " << socket_error); OnError(socket_error); return; } } else { - LOGGER_WARN(logger_, - "Socket " << rfcomm_socket_ << " closed by remote peer"); + SDL_WARN("Socket " << rfcomm_socket_ << " closed by remote peer"); OnError(WSAGetLastError()); return; } @@ -479,13 +464,13 @@ BluetoothSocketConnection::BthConnectionDelegate::BthConnectionDelegate( : connection_(connection) {} void BluetoothSocketConnection::BthConnectionDelegate::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(connection_); connection_->threadMain(); } void BluetoothSocketConnection::BthConnectionDelegate::exitThreadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } } // namespace transport_adapter diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter_posix.cc b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter_posix.cc index 77f33e6765..4ca269f3d3 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter_posix.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter_posix.cc @@ -52,7 +52,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") BluetoothTransportAdapter::~BluetoothTransportAdapter() {} @@ -74,7 +74,7 @@ DeviceType BluetoothTransportAdapter::GetDeviceType() const { void BluetoothTransportAdapter::Store() const { using namespace utils::json; - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); JsonValue bluetooth_adapter_dictionary; JsonValue devices_dictionary; DeviceList device_ids = GetDeviceList(); @@ -119,12 +119,12 @@ void BluetoothTransportAdapter::Store() const { JsonValue& dictionary = last_state().dictionary(); dictionary["TransportManager"]["BluetoothAdapter"] = bluetooth_adapter_dictionary; - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } bool BluetoothTransportAdapter::Restore() { using namespace utils::json; - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); bool errors_occured = false; const JsonValue& dictionary = last_state().dictionary(); const JsonValueRef bluetooth_adapter_dictionary = @@ -170,9 +170,9 @@ bool BluetoothTransportAdapter::Restore() { } bool result = !errors_occured; if (result) { - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); } else { - LOGGER_TRACE(logger_, "exit with FALSE"); + SDL_TRACE("exit with FALSE"); } return result; } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter_win.cc b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter_win.cc index f9b973b52b..4d1905e49e 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter_win.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter_win.cc @@ -56,7 +56,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") BluetoothTransportAdapter::BluetoothTransportAdapter( resumption::LastState& last_state, const TransportManagerSettings& settings) @@ -78,7 +78,7 @@ DeviceType BluetoothTransportAdapter::GetDeviceType() const { void BluetoothTransportAdapter::Store() const { using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); JsonValue bluetooth_adapter_dictionary; JsonValue devices_dictionary; DeviceList device_ids = GetDeviceList(); @@ -104,12 +104,12 @@ void BluetoothTransportAdapter::Store() const { JsonValue& dictionary = last_state().dictionary(); dictionary["TransportManager"]["BluetoothAdapter"] = bluetooth_adapter_dictionary; - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } bool BluetoothTransportAdapter::Restore() { using namespace utils::json; - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool errors_occured = false; const JsonValue& bluetooth_adapter_dictionary = @@ -189,9 +189,9 @@ bool BluetoothTransportAdapter::Restore() { } bool result = !errors_occured; if (result) { - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); } else { - LOGGER_TRACE(logger_, "exit with FALSE"); + SDL_TRACE("exit with FALSE"); } return result; } diff --git a/src/components/transport_manager/src/tcp/tcp_client_listener.cc b/src/components/transport_manager/src/tcp/tcp_client_listener.cc index 2491e7c812..2a6a2a9bd4 100644 --- a/src/components/transport_manager/src/tcp/tcp_client_listener.cc +++ b/src/components/transport_manager/src/tcp/tcp_client_listener.cc @@ -42,7 +42,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") TcpClientListener::TcpClientListener(TransportAdapterController* controller, const uint16_t port, @@ -57,14 +57,14 @@ TcpClientListener::TcpClientListener(TransportAdapterController* controller, } TransportAdapter::Error TcpClientListener::Init() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); thread_stop_requested_ = false; return TransportAdapter::OK; } void TcpClientListener::Terminate() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } bool TcpClientListener::IsInitialised() const { @@ -72,7 +72,7 @@ bool TcpClientListener::IsInitialised() const { } TcpClientListener::~TcpClientListener() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); StopListening(); delete thread_->delegate(); threads::DeleteThread(thread_); @@ -80,14 +80,13 @@ TcpClientListener::~TcpClientListener() { } void TcpClientListener::Loop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); utils::TcpServerSocket server_socket; // Moved from init for compatibility with the Qt const int kBacklog = 128; const utils::HostAddress address(utils::SpecialAddress::Any); if (!server_socket.Listen(address, port_, kBacklog)) { - LOGGER_ERROR(logger_, - "Failed to listen on " << address.ToString() << ":" << port_); + SDL_ERROR("Failed to listen on " << address.ToString() << ":" << port_); return; } while (!thread_stop_requested_) { @@ -95,20 +94,19 @@ void TcpClientListener::Loop() { utils::TcpSocketConnection client_connection = server_socket.Accept(); if (thread_stop_requested_) { - LOGGER_DEBUG(logger_, "thread_stop_requested_"); + SDL_DEBUG("thread_stop_requested_"); client_connection.Close(); break; } if (!client_connection.IsValid()) { - LOGGER_ERROR(logger_, "Failed to accept new client connection"); + SDL_ERROR("Failed to accept new client connection"); continue; } const utils::HostAddress client_address = client_connection.GetAddress(); - LOGGER_INFO(logger_, - "Connected client " << client_address.ToString() << ":" - << client_connection.GetPort()); + SDL_INFO("Connected client " << client_address.ToString() << ":" + << client_connection.GetPort()); if (enable_keepalive_) { client_connection.EnableKeepalive(); @@ -131,40 +129,37 @@ void TcpClientListener::Loop() { } } if (server_socket.Close()) { - LOGGER_DEBUG(logger_, "Server socket successfully closed"); + SDL_DEBUG("Server socket successfully closed"); } else { - LOGGER_ERROR(logger_, "Failed to close server socket"); + SDL_ERROR("Failed to close server socket"); } } void TcpClientListener::StopLoop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); thread_stop_requested_ = true; // We need to connect to the listening socket to unblock accept() call // "0.0.0.0" is not valid address to connect to. utils::TcpSocketConnection byesocket; utils::HostAddress address(utils::SpecialAddress::LoopBack); if (!byesocket.Connect(address, port_)) { - LOGGER_ERROR(logger_, - "Bye socket has failed to connect to the server " - << address.ToString() << ":" << port_); + SDL_ERROR("Bye socket has failed to connect to the server " + << address.ToString() << ":" << port_); } } TransportAdapter::Error TcpClientListener::StartListening() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (thread_->is_running()) { - LOGGER_WARN( - logger_, - "TransportAdapter::BAD_STATE. Listener has already been started"); + SDL_WARN("TransportAdapter::BAD_STATE. Listener has already been started"); return TransportAdapter::BAD_STATE; } if (!thread_->start()) { - LOGGER_ERROR(logger_, "Tcp client listener thread start failed"); + SDL_ERROR("Tcp client listener thread start failed"); return TransportAdapter::FAIL; } - LOGGER_INFO(logger_, "Tcp client listener has started successfully"); + SDL_INFO("Tcp client listener has started successfully"); return TransportAdapter::OK; } @@ -181,15 +176,15 @@ TcpClientListener::ListeningThreadDelegate::ListeningThreadDelegate( : parent_(parent) {} TransportAdapter::Error TcpClientListener::StopListening() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!thread_->is_running()) { - LOGGER_DEBUG(logger_, "TcpClientListener is not running now"); + SDL_DEBUG("TcpClientListener is not running now"); return TransportAdapter::BAD_STATE; } thread_->join(); - LOGGER_INFO(logger_, "Tcp client listener has stopped successfully"); + SDL_INFO("Tcp client listener has stopped successfully"); return TransportAdapter::OK; } diff --git a/src/components/transport_manager/src/tcp/tcp_connection_factory.cc b/src/components/transport_manager/src/tcp/tcp_connection_factory.cc index c96868ff16..3b703939b0 100644 --- a/src/components/transport_manager/src/tcp/tcp_connection_factory.cc +++ b/src/components/transport_manager/src/tcp/tcp_connection_factory.cc @@ -42,7 +42,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") TcpConnectionFactory::TcpConnectionFactory( TransportAdapterController* controller) @@ -54,19 +54,18 @@ TransportAdapter::Error TcpConnectionFactory::Init() { TransportAdapter::Error TcpConnectionFactory::CreateConnection( const DeviceUID& device_uid, const ApplicationHandle& app_handle) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "DeviceUID: " << &device_uid - << ", ApplicationHandle: " << &app_handle); + SDL_AUTO_TRACE(); + SDL_DEBUG("DeviceUID: " << &device_uid + << ", ApplicationHandle: " << &app_handle); TcpServerOiginatedSocketConnection* connection( new TcpServerOiginatedSocketConnection( device_uid, app_handle, controller_)); controller_->ConnectionCreated(connection, device_uid, app_handle); if (connection->Start() == TransportAdapter::OK) { - LOGGER_DEBUG(logger_, "TCP connection initialised"); + SDL_DEBUG("TCP connection initialised"); return TransportAdapter::OK; } else { - LOGGER_ERROR(logger_, "Could not initialise TCP connection"); + SDL_ERROR("Could not initialise TCP connection"); return TransportAdapter::FAIL; } } diff --git a/src/components/transport_manager/src/tcp/tcp_device.cc b/src/components/transport_manager/src/tcp/tcp_device.cc index 5a213938a9..bab8a08747 100644 --- a/src/components/transport_manager/src/tcp/tcp_device.cc +++ b/src/components/transport_manager/src/tcp/tcp_device.cc @@ -36,35 +36,34 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") TcpDevice::TcpDevice(const utils::HostAddress& address, const std::string& name) : Device(name, name) , applications_mutex_() , address_(address) , last_handle_(0) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Created TCPDevice with name " << name); + SDL_AUTO_TRACE(); + SDL_DEBUG("Created TCPDevice with name " << name); } bool TcpDevice::IsSameAs(const Device* other) const { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Device: " << other); + SDL_AUTO_TRACE(); + SDL_DEBUG("Device: " << other); const TcpDevice* other_tcp_device = static_cast<const TcpDevice*>(other); if (other_tcp_device->address_ == address_) { - LOGGER_TRACE( - logger_, + SDL_TRACE( "exit with TRUE. Condition: other_tcp_device->address_ == address_"); return true; } else { - LOGGER_TRACE(logger_, "exit with FALSE"); + SDL_TRACE("exit with FALSE"); return false; } } ApplicationList TcpDevice::GetApplicationList() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); ApplicationList app_list; app_list.reserve(applications_.size()); sync_primitives::AutoLock locker(applications_mutex_); @@ -79,41 +78,41 @@ ApplicationList TcpDevice::GetApplicationList() const { ApplicationHandle TcpDevice::AddApplication(const uint16_t port, const bool is_incomming) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Port " << port); + SDL_AUTO_TRACE(); + SDL_DEBUG("Port " << port); Application appplication(is_incomming, port); sync_primitives::AutoLock locker(applications_mutex_); const ApplicationHandle app_handle = ++last_handle_; applications_[app_handle] = appplication; - LOGGER_DEBUG(logger_, "App_handle " << app_handle); + SDL_DEBUG("App_handle " << app_handle); return app_handle; } void TcpDevice::RemoveApplication(const ApplicationHandle app_handle) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "ApplicationHandle: " << app_handle); + SDL_AUTO_TRACE(); + SDL_DEBUG("ApplicationHandle: " << app_handle); sync_primitives::AutoLock locker(applications_mutex_); applications_.erase(app_handle); } TcpDevice::~TcpDevice() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } int TcpDevice::GetApplicationPort(const ApplicationHandle app_handle) const { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "ApplicationHandle: " << app_handle); + SDL_AUTO_TRACE(); + SDL_DEBUG("ApplicationHandle: " << app_handle); std::map<ApplicationHandle, Application>::const_iterator it = applications_.find(app_handle); if (applications_.end() == it) { - LOGGER_WARN(logger_, "Application was not found"); + SDL_WARN("Application was not found"); return -1; } if (it->second.incoming) { - LOGGER_DEBUG(logger_, "Application is incoming"); + SDL_DEBUG("Application is incoming"); return -1; } - LOGGER_DEBUG(logger_, "port " << it->second.port); + SDL_DEBUG("port " << it->second.port); return it->second.port; } diff --git a/src/components/transport_manager/src/tcp/tcp_socket_connection.cc b/src/components/transport_manager/src/tcp/tcp_socket_connection.cc index f6aa72774b..cd68a3344c 100644 --- a/src/components/transport_manager/src/tcp/tcp_socket_connection.cc +++ b/src/components/transport_manager/src/tcp/tcp_socket_connection.cc @@ -41,7 +41,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") TcpSocketConnection::TcpSocketConnection(const DeviceUID& device_uid, const ApplicationHandle& app_handle, @@ -63,12 +63,12 @@ TcpServerOiginatedSocketConnection::TcpServerOiginatedSocketConnection( TcpServerOiginatedSocketConnection::~TcpServerOiginatedSocketConnection() {} bool TcpServerOiginatedSocketConnection::Establish(ConnectError** error) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(error); - LOGGER_DEBUG(logger_, "error " << error); + SDL_DEBUG("error " << error); DeviceSptr device = controller()->FindDevice(device_handle()); if (!device.valid()) { - LOGGER_ERROR(logger_, "Device " << device_handle() << " not found"); + SDL_ERROR("Device " << device_handle() << " not found"); *error = new ConnectError(); return false; } @@ -76,21 +76,18 @@ bool TcpServerOiginatedSocketConnection::Establish(ConnectError** error) { const int port = tcp_device->GetApplicationPort(application_handle()); if (-1 == port) { - LOGGER_ERROR(logger_, - "Application port for " << application_handle() - << " not found"); + SDL_ERROR("Application port for " << application_handle() << " not found"); *error = new ConnectError(); return false; } const std::string address = tcp_device->Address().ToString(); - LOGGER_DEBUG(logger_, "Connecting to " << address << ":" << port); + SDL_DEBUG("Connecting to " << address << ":" << port); utils::TcpSocketConnection connection; if (!connection.Connect(tcp_device->Address(), port)) { - LOGGER_ERROR(logger_, - "Failed to connect to the server " << address << ":" << port - << " for application " - << application_handle()); + SDL_ERROR("Failed to connect to the server " << address << ":" << port + << " for application " + << application_handle()); *error = new ConnectError(); return false; } diff --git a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc index 9485f82bb2..e5fe8a7099 100644 --- a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc +++ b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc @@ -56,7 +56,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") TcpTransportAdapter::TcpTransportAdapter( const uint16_t port, @@ -75,7 +75,7 @@ DeviceType TcpTransportAdapter::GetDeviceType() const { } void TcpTransportAdapter::Store() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace utils::json; JsonValue tcp_adapter_dictionary; @@ -121,7 +121,7 @@ void TcpTransportAdapter::Store() const { } bool TcpTransportAdapter::Restore() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); using namespace utils::json; bool errors_occurred = false; const JsonValue& dictionary = last_state().dictionary(); @@ -154,7 +154,7 @@ bool TcpTransportAdapter::Restore() { } } bool result = !errors_occurred; - LOGGER_DEBUG(logger_, "result " << std::boolalpha << result); + SDL_DEBUG("result " << std::boolalpha << result); return result; } diff --git a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc index 5ecdbb8820..e0d0d26529 100644 --- a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc +++ b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc @@ -36,7 +36,7 @@ #include "utils/logger.h" #include "utils/threads/thread.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") namespace transport_manager { namespace transport_adapter { @@ -63,7 +63,7 @@ ThreadedSocketConnection::ThreadedSocketConnection( } ThreadedSocketConnection::~ThreadedSocketConnection() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Disconnect(); thread_->join(); delete thread_->delegate(); @@ -71,7 +71,7 @@ ThreadedSocketConnection::~ThreadedSocketConnection() { } void ThreadedSocketConnection::Abort() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); unexpected_disconnect_ = true; terminate_flag_ = true; } @@ -83,66 +83,66 @@ void ThreadedSocketConnection::SetSocket( } TransportAdapter::Error ThreadedSocketConnection::Start() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!thread_->start()) { - LOGGER_ERROR(logger_, "thread creation failed"); + SDL_ERROR("thread creation failed"); return TransportAdapter::FAIL; } - LOGGER_INFO(logger_, "thread created"); + SDL_INFO("thread created"); return TransportAdapter::OK; } void ThreadedSocketConnection::Finalize() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (unexpected_disconnect_) { - LOGGER_DEBUG(logger_, "unexpected_disconnect"); + SDL_DEBUG("unexpected_disconnect"); controller_->ConnectionAborted( device_handle(), application_handle(), CommunicationError()); } else { - LOGGER_DEBUG(logger_, "not unexpected_disconnect"); + SDL_DEBUG("not unexpected_disconnect"); controller_->ConnectionFinished(device_handle(), application_handle()); } socket_connection_.Close(); } TransportAdapter::Error ThreadedSocketConnection::Notify() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return socket_connection_.Notify() ? TransportAdapter::OK : TransportAdapter::FAIL; } TransportAdapter::Error ThreadedSocketConnection::SendData( ::protocol_handler::RawMessagePtr message) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); frames_to_send_.push(message); return Notify(); } TransportAdapter::Error ThreadedSocketConnection::Disconnect() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); terminate_flag_ = true; return Notify(); } void ThreadedSocketConnection::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); controller_->ConnectionCreated(this, device_uid_, app_handle_); ConnectError* connect_error = NULL; if (!Establish(&connect_error)) { - LOGGER_ERROR(logger_, "Connection Establish failed"); + SDL_ERROR("Connection Establish failed"); delete connect_error; } - LOGGER_DEBUG(logger_, "Connection established"); + SDL_DEBUG("Connection established"); controller_->ConnectDone(device_handle(), application_handle()); while (!terminate_flag_) { Transmit(); } - LOGGER_DEBUG(logger_, "Connection is to finalize"); + SDL_DEBUG("Connection is to finalize"); Finalize(); sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); while (!frames_to_send_.empty()) { - LOGGER_INFO(logger_, "removing message"); + SDL_INFO("removing message"); ::protocol_handler::RawMessagePtr message = frames_to_send_.front(); frames_to_send_.pop(); controller_->DataSendFailed( @@ -151,16 +151,16 @@ void ThreadedSocketConnection::threadMain() { } void ThreadedSocketConnection::Transmit() { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Waiting for connection events. " << this); + SDL_AUTO_TRACE(); + SDL_DEBUG("Waiting for connection events. " << this); socket_connection_.Wait(); - LOGGER_DEBUG(logger_, "Waited for connection events: " << this); + SDL_DEBUG("Waited for connection events: " << this); } void ThreadedSocketConnection::Send() { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Trying to send data if available"); + SDL_AUTO_TRACE(); + SDL_DEBUG("Trying to send data if available"); FrameQueue frames_to_send; { sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); @@ -174,7 +174,7 @@ void ThreadedSocketConnection::Send() { const bool sent = socket_connection_.Send( frame->data() + offset, frame->data_size() - offset, bytes_sent); if (!sent) { - LOGGER_ERROR(logger_, "Send failed for connection " << this); + SDL_ERROR("Send failed for connection " << this); frames_to_send.pop(); offset = 0; controller_->DataSendFailed( @@ -195,7 +195,7 @@ void ThreadedSocketConnection::Send() { } void ThreadedSocketConnection::OnError(int error) { - LOGGER_ERROR(logger_, "Connection error: " << error); + SDL_ERROR("Connection error: " << error); Abort(); } @@ -207,12 +207,12 @@ void ThreadedSocketConnection::OnData(const uint8_t* const buffer, } void ThreadedSocketConnection::OnCanWrite() { - LOGGER_DEBUG(logger_, "OnCanWrite event. Trying to send data."); + SDL_DEBUG("OnCanWrite event. Trying to send data."); Send(); } void ThreadedSocketConnection::OnClose() { - LOGGER_DEBUG(logger_, "Connection has been closed"); + SDL_DEBUG("Connection has been closed"); Abort(); } @@ -225,13 +225,13 @@ ThreadedSocketConnection::SocketConnectionDelegate::SocketConnectionDelegate( : connection_(connection) {} void ThreadedSocketConnection::SocketConnectionDelegate::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(connection_); connection_->threadMain(); } void ThreadedSocketConnection::SocketConnectionDelegate::exitThreadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); } } // namespace transport_adapter diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc index 3a25fc54ae..4536f919df 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc @@ -43,7 +43,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") namespace { #ifdef SDL_CPP11 DeviceTypes devices_type = { @@ -96,43 +96,38 @@ TransportAdapterImpl::~TransportAdapterImpl() { Terminate(); if (device_scanner_) { - LOGGER_DEBUG(logger_, "Deleting device_scanner_ " << device_scanner_); + SDL_DEBUG("Deleting device_scanner_ " << device_scanner_); delete device_scanner_; - LOGGER_DEBUG(logger_, "device_scanner_ deleted."); + SDL_DEBUG("device_scanner_ deleted."); } if (server_connection_factory_) { - LOGGER_DEBUG(logger_, - "Deleting server_connection_factory " - << server_connection_factory_); + SDL_DEBUG("Deleting server_connection_factory " + << server_connection_factory_); delete server_connection_factory_; - LOGGER_DEBUG(logger_, "server_connection_factory deleted."); + SDL_DEBUG("server_connection_factory deleted."); } if (client_connection_listener_) { - LOGGER_DEBUG(logger_, - "Deleting client_connection_listener_ " - << client_connection_listener_); + SDL_DEBUG("Deleting client_connection_listener_ " + << client_connection_listener_); delete client_connection_listener_; - LOGGER_DEBUG(logger_, "client_connection_listener_ deleted."); + SDL_DEBUG("client_connection_listener_ deleted."); } } void TransportAdapterImpl::Terminate() { if (device_scanner_) { device_scanner_->Terminate(); - LOGGER_DEBUG(logger_, - "device_scanner_ " << device_scanner_ << " terminated."); + SDL_DEBUG("device_scanner_ " << device_scanner_ << " terminated."); } if (server_connection_factory_) { server_connection_factory_->Terminate(); - LOGGER_DEBUG(logger_, - "server_connection_factory " << server_connection_factory_ - << " terminated."); + SDL_DEBUG("server_connection_factory " << server_connection_factory_ + << " terminated."); } if (client_connection_listener_) { client_connection_listener_->Terminate(); - LOGGER_DEBUG(logger_, - "client_connection_listener_ " << client_connection_listener_ - << " terminated."); + SDL_DEBUG("client_connection_listener_ " << client_connection_listener_ + << " terminated."); } ConnectionMap connections; @@ -142,7 +137,7 @@ void TransportAdapterImpl::Terminate() { } connections.clear(); - LOGGER_DEBUG(logger_, "Connections deleted"); + SDL_DEBUG("Connections deleted"); DeviceMap devices; devices_mutex_.Acquire(); @@ -150,11 +145,11 @@ void TransportAdapterImpl::Terminate() { devices_mutex_.Release(); devices.clear(); - LOGGER_DEBUG(logger_, "Devices deleted"); + SDL_DEBUG("Devices deleted"); } TransportAdapter::Error TransportAdapterImpl::Init() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); Error error = OK; @@ -172,39 +167,38 @@ TransportAdapter::Error TransportAdapterImpl::Init() { if (get_settings().use_last_state()) { if (!Restore()) { - LOGGER_WARN(logger_, "could not restore transport adapter state"); + SDL_WARN("could not restore transport adapter state"); error = FAIL; } } - LOGGER_TRACE(logger_, "exit with error: " << error); + SDL_TRACE("exit with error: " << error); return error; } TransportAdapter::Error TransportAdapterImpl::SearchDevices() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); if (device_scanner_ == NULL) { - LOGGER_TRACE(logger_, "exit with NOT_SUPPORTED"); + SDL_TRACE("exit with NOT_SUPPORTED"); return NOT_SUPPORTED; } else if (!device_scanner_->IsInitialised()) { - LOGGER_TRACE(logger_, "exit with BAD_STATE"); + SDL_TRACE("exit with BAD_STATE"); return BAD_STATE; } TransportAdapter::Error er = device_scanner_->Scan(); - LOGGER_TRACE(logger_, "exit with error: " << er); + SDL_TRACE("exit with error: " << er); return er; } TransportAdapter::Error TransportAdapterImpl::Connect( const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOGGER_TRACE(logger_, - "enter. DeviceUID " << device_id << " ApplicationHandle " - << app_handle); + SDL_TRACE("enter. DeviceUID " << device_id << " ApplicationHandle " + << app_handle); if (server_connection_factory_ == 0) { - LOGGER_TRACE(logger_, "exit with NOT_SUPPORTED"); + SDL_TRACE("exit with NOT_SUPPORTED"); return NOT_SUPPORTED; } if (!server_connection_factory_->IsInitialised()) { - LOGGER_TRACE(logger_, "exit with BAD_STATE"); + SDL_TRACE("exit with BAD_STATE"); return BAD_STATE; } @@ -220,7 +214,7 @@ TransportAdapter::Error TransportAdapterImpl::Connect( info.device_id = device_id; info.state = ConnectionInfo::NEW; } else { - LOGGER_TRACE(logger_, "exit with ALREADY_EXISTS"); + SDL_TRACE("exit with ALREADY_EXISTS"); return ALREADY_EXISTS; } } @@ -231,49 +225,48 @@ TransportAdapter::Error TransportAdapterImpl::Connect( sync_primitives::AutoWriteLock lock(connections_lock_); connections_.erase(std::make_pair(device_id, app_handle)); } - LOGGER_TRACE(logger_, "exit with error: " << err); + SDL_TRACE("exit with error: " << err); return err; } TransportAdapter::Error TransportAdapterImpl::ConnectDevice( const DeviceUID& device_handle) { - LOGGER_TRACE(logger_, "enter with device_handle: " << &device_handle); + SDL_TRACE("enter with device_handle: " << &device_handle); DeviceSptr device = FindDevice(device_handle); if (device) { TransportAdapter::Error err = ConnectDevice(device); - LOGGER_TRACE(logger_, "exit with error: " << err); + SDL_TRACE("exit with error: " << err); return err; } else { - LOGGER_TRACE(logger_, "exit with BAD_PARAM"); + SDL_TRACE("exit with BAD_PARAM"); return BAD_PARAM; } } TransportAdapter::Error TransportAdapterImpl::Disconnect( const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOGGER_TRACE(logger_, - "enter. device_id: " << &device_id - << ", device_id: " << &device_id); + SDL_TRACE("enter. device_id: " << &device_id + << ", device_id: " << &device_id); if (!initialised_) { - LOGGER_TRACE(logger_, "exit with BAD_STATE"); + SDL_TRACE("exit with BAD_STATE"); return BAD_STATE; } ConnectionSPtr connection = FindEstablishedConnection(device_id, app_handle); if (connection) { TransportAdapter::Error err = connection->Disconnect(); - LOGGER_TRACE(logger_, "exit with error: " << err); + SDL_TRACE("exit with error: " << err); return err; } else { - LOGGER_TRACE(logger_, "exit with BAD_PARAM"); + SDL_TRACE("exit with BAD_PARAM"); return BAD_PARAM; } } TransportAdapter::Error TransportAdapterImpl::DisconnectDevice( const DeviceUID& device_id) { - LOGGER_TRACE(logger_, "enter. device_id: " << &device_id); + SDL_TRACE("enter. device_id: " << &device_id); if (!initialised_) { - LOGGER_TRACE(logger_, "exit with BAD_STATE"); + SDL_TRACE("exit with BAD_STATE"); return BAD_STATE; } @@ -299,7 +292,7 @@ TransportAdapter::Error TransportAdapterImpl::DisconnectDevice( ConnectionInfo info = *j; if (OK != info.connection->Disconnect()) { error = FAIL; - LOGGER_ERROR(logger_, "Error on disconnect " << error); + SDL_ERROR("Error on disconnect " << error); } } @@ -310,48 +303,47 @@ TransportAdapter::Error TransportAdapterImpl::SendData( const DeviceUID& device_id, const ApplicationHandle& app_handle, const ::protocol_handler::RawMessagePtr data) { - LOGGER_TRACE(logger_, - "enter. device_id: " << &device_id << ", app_handle: " - << &app_handle << ", data: " << data); + SDL_TRACE("enter. device_id: " << &device_id << ", app_handle: " + << &app_handle << ", data: " << data); if (!initialised_) { - LOGGER_TRACE(logger_, "exit with BAD_STATE"); + SDL_TRACE("exit with BAD_STATE"); return BAD_STATE; } ConnectionSPtr connection = FindEstablishedConnection(device_id, app_handle); if (connection) { TransportAdapter::Error err = connection->SendData(data); - LOGGER_TRACE(logger_, "exit with error: " << err); + SDL_TRACE("exit with error: " << err); return err; } else { - LOGGER_TRACE(logger_, "exit with BAD_PARAM"); + SDL_TRACE("exit with BAD_PARAM"); return BAD_PARAM; } } TransportAdapter::Error TransportAdapterImpl::StartClientListening() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); if (client_connection_listener_ == 0) { - LOGGER_TRACE(logger_, "exit with NOT_SUPPORTED"); + SDL_TRACE("exit with NOT_SUPPORTED"); return NOT_SUPPORTED; } if (!client_connection_listener_->IsInitialised()) { - LOGGER_TRACE(logger_, "exit with BAD_STATE"); + SDL_TRACE("exit with BAD_STATE"); return BAD_STATE; } TransportAdapter::Error err = client_connection_listener_->StartListening(); - LOGGER_TRACE(logger_, "exit with error: " << err); + SDL_TRACE("exit with error: " << err); return err; } TransportAdapter::Error TransportAdapterImpl::StopClientListening() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); if (client_connection_listener_ == 0) { - LOGGER_TRACE(logger_, "exit with NOT_SUPPORTED"); + SDL_TRACE("exit with NOT_SUPPORTED"); return NOT_SUPPORTED; } if (!client_connection_listener_->IsInitialised()) { - LOGGER_TRACE(logger_, "exit with BAD_STATE"); + SDL_TRACE("exit with BAD_STATE"); return BAD_STATE; } TransportAdapter::Error err = client_connection_listener_->StopListening(); @@ -359,25 +351,24 @@ TransportAdapter::Error TransportAdapterImpl::StopClientListening() { for (DeviceMap::iterator it = devices_.begin(); it != devices_.end(); ++it) { it->second->Stop(); } - LOGGER_TRACE(logger_, "exit with error: " << err); + SDL_TRACE("exit with error: " << err); return err; } DeviceList TransportAdapterImpl::GetDeviceList() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DeviceList devices; sync_primitives::AutoLock locker(devices_mutex_); for (DeviceMap::const_iterator it = devices_.begin(); it != devices_.end(); ++it) { devices.push_back(it->first); } - LOGGER_TRACE(logger_, - "exit with DeviceList. It's' size = " << devices.size()); + SDL_TRACE("exit with DeviceList. It's' size = " << devices.size()); return devices; } DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) { - LOGGER_TRACE(logger_, "enter. device: " << device); + SDL_TRACE("enter. device: " << device); DeviceSptr existing_device; bool same_device_found = false; devices_mutex_.Acquire(); @@ -386,7 +377,7 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) { existing_device = i->second; if (device->IsSameAs(existing_device.get())) { same_device_found = true; - LOGGER_DEBUG(logger_, "device " << device << "already exists"); + SDL_DEBUG("device " << device << "already exists"); break; } } @@ -395,7 +386,7 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) { } devices_mutex_.Release(); if (same_device_found) { - LOGGER_TRACE(logger_, "exit with TRUE. Condition: same_device_found"); + SDL_TRACE("exit with TRUE. Condition: same_device_found"); return existing_device; } else { for (TransportAdapterListenerList::iterator it = listeners_.begin(); @@ -406,13 +397,13 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) { if (ToBeAutoConnected(device)) { ConnectDevice(device); } - LOGGER_TRACE(logger_, "exit with DeviceSptr " << device); + SDL_TRACE("exit with DeviceSptr " << device); return device; } } void TransportAdapterImpl::SearchDeviceDone(const DeviceVector& devices) { - LOGGER_TRACE(logger_, "enter. devices: " << &devices); + SDL_TRACE("enter. devices: " << &devices); DeviceMap new_devices; for (DeviceVector::const_iterator it = devices.begin(); it != devices.end(); ++it) { @@ -426,16 +417,15 @@ void TransportAdapterImpl::SearchDeviceDone(const DeviceVector& devices) { if (device->IsSameAs(existing_device.get())) { existing_device->set_keep_on_disconnect(true); device_found = true; - LOGGER_DEBUG(logger_, "device found. DeviceSptr" << it->second); + SDL_DEBUG("device found. DeviceSptr" << it->second); break; } } devices_mutex_.Release(); if (!device_found) { - LOGGER_INFO(logger_, - "Adding new device " << device->unique_device_id() << " (\"" - << device->name() << "\")"); + SDL_INFO("Adding new device " << device->unique_device_id() << " (\"" + << device->name() << "\")"); } device->set_keep_on_disconnect(true); @@ -484,7 +474,7 @@ void TransportAdapterImpl::SearchDeviceDone(const DeviceVector& devices) { ConnectDevice(device); } } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterImpl::ApplicationListUpdated( @@ -494,40 +484,40 @@ void TransportAdapterImpl::ApplicationListUpdated( } void TransportAdapterImpl::FindNewApplicationsRequest() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); for (TransportAdapterListenerList::iterator i = listeners_.begin(); i != listeners_.end(); ++i) { TransportAdapterListener* listener = *i; listener->OnFindNewApplicationsRequest(this); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterImpl::SearchDeviceFailed(const SearchDeviceError& error) { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { (*it)->OnSearchDeviceFailed(this, error); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } bool TransportAdapterImpl::IsSearchDevicesSupported() const { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); return device_scanner_ != 0; - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } bool TransportAdapterImpl::IsServerOriginatedConnectSupported() const { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); return server_connection_factory_ != 0; - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } bool TransportAdapterImpl::IsClientOriginatedConnectSupported() const { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); return client_connection_listener_ != 0; } @@ -535,10 +525,8 @@ void TransportAdapterImpl::ConnectionCreated( ConnectionSPtr connection, const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOGGER_TRACE(logger_, - "enter connection:" << connection - << ", device_id: " << &device_id - << ", app_handle: " << &app_handle); + SDL_TRACE("enter connection:" << connection << ", device_id: " << &device_id + << ", app_handle: " << &app_handle); sync_primitives::AutoReadLock lock(connections_lock_); ConnectionInfo& info = connections_[std::make_pair(device_id, app_handle)]; info.app_handle = app_handle; @@ -550,9 +538,7 @@ void TransportAdapterImpl::ConnectionCreated( void TransportAdapterImpl::DeviceDisconnected( const DeviceUID& device_handle, const DisconnectDeviceError& error) { const DeviceUID device_uid = device_handle; - LOGGER_TRACE(logger_, - "enter. device_handle: " << &device_uid - << ", error: " << &error); + SDL_TRACE("enter. device_handle: " << &device_uid << ", error: " << &error); ApplicationList app_list = GetApplicationList(device_uid); for (ApplicationList::const_iterator i = app_list.begin(); i != app_list.end(); @@ -585,7 +571,7 @@ void TransportAdapterImpl::DeviceDisconnected( } RemoveDevice(device_uid); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } bool TransportAdapterImpl::IsSingleApplication( @@ -597,9 +583,9 @@ bool TransportAdapterImpl::IsSingleApplication( const DeviceUID& current_device_id = it->first.first; const ApplicationHandle& current_app_handle = it->first.second; if (current_device_id == device_uid && current_app_handle != app_uid) { - LOGGER_DEBUG(logger_, - "break. Condition: current_device_id == device_id && " - "current_app_handle != app_handle"); + SDL_DEBUG( + "break. Condition: current_device_id == device_id && " + "current_app_handle != app_handle"); return false; } @@ -611,12 +597,11 @@ void TransportAdapterImpl::DisconnectDone(const DeviceUID& device_handle, const ApplicationHandle& app_handle) { const DeviceUID device_uid = device_handle; const ApplicationHandle app_uid = app_handle; - LOGGER_TRACE(logger_, - "enter. device_id: " << &device_uid - << ", app_handle: " << &app_uid); + SDL_TRACE("enter. device_id: " << &device_uid + << ", app_handle: " << &app_uid); DeviceSptr device = FindDevice(device_handle); if (!device) { - LOGGER_WARN(logger_, "Device: uid " << &device_uid << " not found"); + SDL_WARN("Device: uid " << &device_uid << " not found"); return; } @@ -642,16 +627,15 @@ void TransportAdapterImpl::DisconnectDone(const DeviceUID& device_handle, } Store(); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterImpl::DataReceiveDone( const DeviceUID& device_id, const ApplicationHandle& app_handle, ::protocol_handler::RawMessagePtr message) { - LOGGER_TRACE(logger_, - "enter. device_id: " << &device_id << ", app_handle: " - << &app_handle << ", message: " << message); + SDL_TRACE("enter. device_id: " << &device_id << ", app_handle: " + << &app_handle << ", message: " << message); #ifdef TELEMETRY_MONITOR if (metric_observer_) { @@ -664,33 +648,33 @@ void TransportAdapterImpl::DataReceiveDone( ++it) { (*it)->OnDataReceiveDone(this, device_id, app_handle, message); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterImpl::DataReceiveFailed( const DeviceUID& device_id, const ApplicationHandle& app_handle, const DataReceiveError& error) { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { (*it)->OnDataReceiveFailed(this, device_id, app_handle, error); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterImpl::DataSendDone( const DeviceUID& device_id, const ApplicationHandle& app_handle, ::protocol_handler::RawMessagePtr message) { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { (*it)->OnDataSendDone(this, device_id, app_handle, message); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterImpl::DataSendFailed( @@ -698,35 +682,34 @@ void TransportAdapterImpl::DataSendFailed( const ApplicationHandle& app_handle, ::protocol_handler::RawMessagePtr message, const DataSendError& error) { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { (*it)->OnDataSendFailed(this, device_id, app_handle, message, error); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } DeviceSptr TransportAdapterImpl::FindDevice(const DeviceUID& device_id) const { - LOGGER_TRACE(logger_, "enter. device_id: " << &device_id); + SDL_TRACE("enter. device_id: " << &device_id); DeviceSptr ret; sync_primitives::AutoLock locker(devices_mutex_); - LOGGER_DEBUG(logger_, "devices_.size() = " << devices_.size()); + SDL_DEBUG("devices_.size() = " << devices_.size()); DeviceMap::const_iterator it = devices_.find(device_id); if (it != devices_.end()) { ret = it->second; } else { - LOGGER_WARN(logger_, "Device " << device_id << " not found."); + SDL_WARN("Device " << device_id << " not found."); } - LOGGER_TRACE(logger_, "exit with DeviceSptr: " << ret); + SDL_TRACE("exit with DeviceSptr: " << ret); return ret; } void TransportAdapterImpl::ConnectDone(const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOGGER_TRACE(logger_, - "enter. device_id: " << &device_id - << ", app_handle: " << &app_handle); + SDL_TRACE("enter. device_id: " << &device_id + << ", app_handle: " << &app_handle); { sync_primitives::AutoReadLock lock(connections_lock_); ConnectionMap::iterator it_conn = @@ -744,7 +727,7 @@ void TransportAdapterImpl::ConnectDone(const DeviceUID& device_id, } Store(); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterImpl::ConnectFailed(const DeviceUID& device_handle, @@ -752,9 +735,8 @@ void TransportAdapterImpl::ConnectFailed(const DeviceUID& device_handle, const ConnectError& error) { const DeviceUID device_uid = device_handle; const ApplicationHandle app_uid = app_handle; - LOGGER_TRACE(logger_, - "enter. device_id: " << &device_uid << ", app_handle: " - << &app_uid << ", error: " << &error); + SDL_TRACE("enter. device_id: " << &device_uid << ", app_handle: " << &app_uid + << ", error: " << &error); { sync_primitives::AutoWriteLock lock(connections_lock_); connections_.erase(std::make_pair(device_uid, app_uid)); @@ -764,61 +746,56 @@ void TransportAdapterImpl::ConnectFailed(const DeviceUID& device_handle, ++it) { (*it)->OnConnectFailed(this, device_uid, app_uid, error); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterImpl::RemoveFinalizedConnection( const DeviceUID& device_handle, const ApplicationHandle& app_handle) { const DeviceUID device_uid = device_handle; const ApplicationHandle app_uid = app_handle; - LOGGER_AUTO_TRACE(logger_); + UNUSED(app_uid); + SDL_AUTO_TRACE(); sync_primitives::AutoWriteLock lock(connections_lock_); ConnectionMap::iterator it_conn = connections_.find(std::make_pair(device_uid, app_handle)); if (it_conn == connections_.end()) { - LOGGER_WARN(logger_, - "Device_id: " << &device_uid << ", app_handle: " << &app_uid - << " connection not found"); + SDL_WARN("Device_id: " << &device_uid << ", app_handle: " << &app_uid + << " connection not found"); return; } const ConnectionInfo& info = it_conn->second; if (info.state != ConnectionInfo::FINALISING) { - LOGGER_WARN(logger_, - "Device_id: " << &device_uid << ", app_handle: " << &app_uid - << " connection not finalized"); + SDL_WARN("Device_id: " << &device_uid << ", app_handle: " << &app_uid + << " connection not finalized"); return; } connections_.erase(it_conn); } void TransportAdapterImpl::AddListener(TransportAdapterListener* listener) { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); listeners_.push_back(listener); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } ApplicationList TransportAdapterImpl::GetApplicationList( const DeviceUID& device_id) const { - LOGGER_TRACE(logger_, "enter. device_id: " << &device_id); + SDL_TRACE("enter. device_id: " << &device_id); DeviceSptr device = FindDevice(device_id); if (device.valid()) { ApplicationList lst = device->GetApplicationList(); - LOGGER_TRACE(logger_, - "exit with ApplicationList. It's size = " - << lst.size() << " Condition: device.valid()"); + SDL_TRACE("exit with ApplicationList. It's size = " + << lst.size() << " Condition: device.valid()"); return lst; } - LOGGER_TRACE( - logger_, - "exit with empty ApplicationList. Condition: NOT device.valid()"); + SDL_TRACE("exit with empty ApplicationList. Condition: NOT device.valid()"); return ApplicationList(); } void TransportAdapterImpl::ConnectionFinished( const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOGGER_TRACE(logger_, - "enter. device_id: " << &device_id - << ", app_handle: " << &app_handle); + SDL_TRACE("enter. device_id: " << &device_id + << ", app_handle: " << &app_handle); sync_primitives::AutoReadLock lock(connections_lock_); ConnectionMap::iterator it = connections_.find(std::make_pair(device_id, app_handle)); @@ -841,32 +818,32 @@ void TransportAdapterImpl::ConnectionAborted( } bool TransportAdapterImpl::IsInitialised() const { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); if (!initialised_) { - LOGGER_TRACE(logger_, "exit with FALSE. Condition: !initialised_"); + SDL_TRACE("exit with FALSE. Condition: !initialised_"); return false; } if (device_scanner_ && !device_scanner_->IsInitialised()) { - LOGGER_TRACE(logger_, - "exit with FALSE. Condition: device_scanner_ && " - "!device_scanner_->IsInitialised()"); + SDL_TRACE( + "exit with FALSE. Condition: device_scanner_ && " + "!device_scanner_->IsInitialised()"); return false; } if (server_connection_factory_ && !server_connection_factory_->IsInitialised()) { - LOGGER_TRACE(logger_, - "exit with FALSE. Condition: server_connection_factory_ && " - "!server_connection_factory_->IsInitialised()"); + SDL_TRACE( + "exit with FALSE. Condition: server_connection_factory_ && " + "!server_connection_factory_->IsInitialised()"); return false; } if (client_connection_listener_ && !client_connection_listener_->IsInitialised()) { - LOGGER_TRACE(logger_, - "exit with FALSE. Condition: client_connection_listener_ && " - "!client_connection_listener_->IsInitialised()"); + SDL_TRACE( + "exit with FALSE. Condition: client_connection_listener_ && " + "!client_connection_listener_->IsInitialised()"); return false; } - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); return true; } @@ -911,9 +888,8 @@ bool TransportAdapterImpl::ToBeAutoDisconnected(DeviceSptr device) const { ConnectionSPtr TransportAdapterImpl::FindEstablishedConnection( const DeviceUID& device_id, const ApplicationHandle& app_handle) const { - LOGGER_TRACE(logger_, - "enter. device_id: " << &device_id - << ", app_handle: " << &app_handle); + SDL_TRACE("enter. device_id: " << &device_id + << ", app_handle: " << &app_handle); ConnectionSPtr connection; { sync_primitives::AutoReadLock lock(connections_lock_); @@ -926,54 +902,51 @@ ConnectionSPtr TransportAdapterImpl::FindEstablishedConnection( } } } - LOGGER_TRACE(logger_, "exit with Connection: " << connection); + SDL_TRACE("exit with Connection: " << connection); return connection; } TransportAdapter::Error TransportAdapterImpl::ConnectDevice(DeviceSptr device) { - LOGGER_TRACE(logger_, "enter. device: " << device); + SDL_TRACE("enter. device: " << device); DeviceUID device_id = device->unique_device_id(); ApplicationList app_list = device->GetApplicationList(); - LOGGER_INFO(logger_, - "Device " << device->name() << " has " << app_list.size() - << " applications."); + SDL_INFO("Device " << device->name() << " has " << app_list.size() + << " applications."); bool errors_occurred = false; for (ApplicationList::iterator it = app_list.begin(); it != app_list.end(); ++it) { const ApplicationHandle app_handle = *it; - LOGGER_DEBUG(logger_, - "Attempt to connect device " << device_id << ", channel " - << app_handle); + SDL_DEBUG("Attempt to connect device " << device_id << ", channel " + << app_handle); const Error error = Connect(device_id, app_handle); switch (error) { case OK: - LOGGER_DEBUG(logger_, "error = OK"); + SDL_DEBUG("error = OK"); break; case ALREADY_EXISTS: - LOGGER_DEBUG(logger_, "error = ALREADY_EXISTS"); + SDL_DEBUG("error = ALREADY_EXISTS"); break; default: - LOGGER_ERROR(logger_, - "Connect to device " << device_id << ", channel " - << app_handle << " failed with error " - << error); + SDL_ERROR("Connect to device " << device_id << ", channel " + << app_handle << " failed with error " + << error); errors_occurred = true; - LOGGER_DEBUG(logger_, "switch (error), default case"); + SDL_DEBUG("switch (error), default case"); break; } } if (errors_occurred) { - LOGGER_TRACE(logger_, "exit with error:FAIL"); + SDL_TRACE("exit with error:FAIL"); return FAIL; } else { - LOGGER_TRACE(logger_, "exit with error:OK"); + SDL_TRACE("exit with error:OK"); return OK; } } void TransportAdapterImpl::RemoveDevice(const DeviceUID& device_handle) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Device_handle: " << &device_handle); + SDL_AUTO_TRACE(); + SDL_DEBUG("Device_handle: " << &device_handle); sync_primitives::AutoLock locker(devices_mutex_); DeviceMap::iterator i = devices_.find(device_handle); if (i != devices_.end()) { diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc index e32a23f0b2..c463c3b988 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc @@ -39,7 +39,7 @@ #include "transport_manager/transport_adapter/transport_adapter_event.h" namespace transport_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") TransportAdapterListenerImpl::TransportAdapterListenerImpl( TransportManager* manager, TransportAdapter* adapter) @@ -47,7 +47,7 @@ TransportAdapterListenerImpl::TransportAdapterListenerImpl( void TransportAdapterListenerImpl::OnSearchDeviceDone( const TransportAdapter* adapter) { - LOGGER_TRACE(logger_, "enter. adapter* " << adapter); + SDL_TRACE("enter. adapter* " << adapter); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE, transport_adapter_, @@ -58,14 +58,14 @@ void TransportAdapterListenerImpl::OnSearchDeviceDone( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnSearchDeviceFailed( const TransportAdapter* adapter, const SearchDeviceError& error) { - LOGGER_TRACE(logger_, "enter. adapter: " << adapter << ", error: " << &error); + SDL_TRACE("enter. adapter: " << adapter << ", error: " << &error); SearchDeviceError* err = new SearchDeviceError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL, @@ -77,14 +77,14 @@ void TransportAdapterListenerImpl::OnSearchDeviceFailed( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnDeviceListUpdated( const TransportAdapter* adapter) { - LOGGER_TRACE(logger_, "enter. adapter* " << adapter); + SDL_TRACE("enter. adapter* " << adapter); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED, transport_adapter_, @@ -95,14 +95,14 @@ void TransportAdapterListenerImpl::OnDeviceListUpdated( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnFindNewApplicationsRequest( const TransportAdapter* adapter) { - LOGGER_TRACE(logger_, "enter. adapter* " << adapter); + SDL_TRACE("enter. adapter* " << adapter); const TransportAdapterEvent event( TransportAdapterListenerImpl::ON_FIND_NEW_APPLICATIONS_REQUEST, transport_adapter_, @@ -113,18 +113,17 @@ void TransportAdapterListenerImpl::OnFindNewApplicationsRequest( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnConnectDone( const TransportAdapter* adapter, const DeviceUID& device, const ApplicationHandle& application_id) { - LOGGER_TRACE(logger_, - "enter adapter*: " << adapter << ", device: " << &device - << ", application_id: " << &application_id); + SDL_TRACE("enter adapter*: " << adapter << ", device: " << &device + << ", application_id: " << &application_id); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE, transport_adapter_, @@ -135,9 +134,9 @@ void TransportAdapterListenerImpl::OnConnectDone( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnConnectFailed( @@ -145,10 +144,9 @@ void TransportAdapterListenerImpl::OnConnectFailed( const DeviceUID& device, const ApplicationHandle& app_id, const ConnectError& error) { - LOGGER_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device - << ", application_id: " << &app_id - << ", error: " << &error); + SDL_TRACE("enter. adapter: " << adapter << ", device: " << &device + << ", application_id: " << &app_id + << ", error: " << &error); ConnectError* err = new ConnectError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL, @@ -160,18 +158,17 @@ void TransportAdapterListenerImpl::OnConnectFailed( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnDisconnectDone( const TransportAdapter* adapter, const DeviceUID& device, const ApplicationHandle& app_id) { - LOGGER_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device - << ", application_id: " << &app_id); + SDL_TRACE("enter. adapter: " << adapter << ", device: " << &device + << ", application_id: " << &app_id); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE, transport_adapter_, @@ -182,9 +179,9 @@ void TransportAdapterListenerImpl::OnDisconnectDone( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnDisconnectFailed( @@ -192,10 +189,9 @@ void TransportAdapterListenerImpl::OnDisconnectFailed( const DeviceUID& device, const ApplicationHandle& app_id, const DisconnectError& error) { - LOGGER_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device - << ", application_id: " << &app_id - << ", error: " << &error); + SDL_TRACE("enter. adapter: " << adapter << ", device: " << &device + << ", application_id: " << &app_id + << ", error: " << &error); DisconnectError* err = new DisconnectError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL, @@ -207,9 +203,9 @@ void TransportAdapterListenerImpl::OnDisconnectFailed( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnDisconnectDeviceDone( @@ -225,10 +221,9 @@ void TransportAdapterListenerImpl::OnDataReceiveDone( const DeviceUID& device, const ApplicationHandle& app_id, const ::protocol_handler::RawMessagePtr data_container) { - LOGGER_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device - << ", application_id: " << &app_id - << ", data_container: " << data_container); + SDL_TRACE("enter. adapter: " << adapter << ", device: " << &device + << ", application_id: " << &app_id + << ", data_container: " << data_container); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE, transport_adapter_, @@ -239,9 +234,9 @@ void TransportAdapterListenerImpl::OnDataReceiveDone( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnDataReceiveFailed( @@ -249,10 +244,9 @@ void TransportAdapterListenerImpl::OnDataReceiveFailed( const DeviceUID& device, const ApplicationHandle& app_id, const DataReceiveError& error) { - LOGGER_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device - << ", application_id: " << &app_id - << ", error: " << &error); + SDL_TRACE("enter. adapter: " << adapter << ", device: " << &device + << ", application_id: " << &app_id + << ", error: " << &error); DataReceiveError* err = new DataReceiveError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL, @@ -264,9 +258,9 @@ void TransportAdapterListenerImpl::OnDataReceiveFailed( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnDataSendDone( @@ -274,10 +268,9 @@ void TransportAdapterListenerImpl::OnDataSendDone( const DeviceUID& device, const ApplicationHandle& app_id, const ::protocol_handler::RawMessagePtr data_container) { - LOGGER_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device - << ", application_id: " << &app_id - << ", data_container: " << data_container); + SDL_TRACE("enter. adapter: " << adapter << ", device: " << &device + << ", application_id: " << &app_id + << ", data_container: " << data_container); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE, transport_adapter_, @@ -288,9 +281,9 @@ void TransportAdapterListenerImpl::OnDataSendDone( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnDataSendFailed( @@ -299,11 +292,10 @@ void TransportAdapterListenerImpl::OnDataSendFailed( const ApplicationHandle& app_id, const ::protocol_handler::RawMessagePtr data_container, const DataSendError& error) { - LOGGER_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device - << ", application_id: " << &app_id - << ", data_container: " << data_container - << ", error: " << &error); + SDL_TRACE("enter. adapter: " << adapter << ", device: " << &device + << ", application_id: " << &app_id + << ", data_container: " << data_container + << ", error: " << &error); DataSendError* err = new DataSendError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL, @@ -315,9 +307,9 @@ void TransportAdapterListenerImpl::OnDataSendFailed( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnConnectRequested( @@ -330,10 +322,9 @@ void TransportAdapterListenerImpl::OnUnexpectedDisconnect( const DeviceUID& device, const ApplicationHandle& application, const CommunicationError& error) { - LOGGER_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device - << ", application: " << &application - << ", error: " << &error); + SDL_TRACE("enter. adapter: " << adapter << ", device: " << &device + << ", application: " << &application + << ", error: " << &error); CommunicationError* err = new CommunicationError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT, @@ -345,18 +336,17 @@ void TransportAdapterListenerImpl::OnUnexpectedDisconnect( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportAdapterListenerImpl::OnCommunicationError( const TransportAdapter* adapter, const DeviceUID& device, const ApplicationHandle& app_id) { - LOGGER_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device - << ", application_id: " << &app_id); + SDL_TRACE("enter. adapter: " << adapter << ", device: " << &device + << ", application_id: " << &app_id); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_COMMUNICATION_ERROR, transport_adapter_, @@ -367,8 +357,8 @@ void TransportAdapterListenerImpl::OnCommunicationError( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOGGER_WARN(logger_, "Failed to receive event from device"); + SDL_WARN("Failed to receive event from device"); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } } // namespace transport_manager diff --git a/src/components/transport_manager/src/transport_manager_default.cc b/src/components/transport_manager/src/transport_manager_default.cc index 2e92057b1e..a9dc08514b 100644 --- a/src/components/transport_manager/src/transport_manager_default.cc +++ b/src/components/transport_manager/src/transport_manager_default.cc @@ -46,18 +46,18 @@ #endif // USB_SUPPORT namespace transport_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") TransportManagerDefault::TransportManagerDefault( const TransportManagerSettings& settings) : TransportManagerImpl(settings) {} int TransportManagerDefault::Init(resumption::LastState& last_state) { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); if (E_SUCCESS != TransportManagerImpl::Init(last_state)) { - LOGGER_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: E_SUCCESS != " - "TransportManagerImpl::Init()"); + SDL_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: E_SUCCESS != " + "TransportManagerImpl::Init()"); return E_TM_IS_NOT_INITIALIZED; } @@ -98,7 +98,7 @@ int TransportManagerDefault::Init(resumption::LastState& last_state) { ta_usb = NULL; #endif // USB_SUPPORT - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc index c03caa6c1d..3017c7540f 100644 --- a/src/components/transport_manager/src/transport_manager_impl.cc +++ b/src/components/transport_manager/src/transport_manager_impl.cc @@ -59,19 +59,17 @@ using ::transport_manager::transport_adapter::TransportAdapter; namespace transport_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") TransportManagerImpl::Connection TransportManagerImpl::convert( const TransportManagerImpl::ConnectionInternal& p) { - LOGGER_TRACE(logger_, "enter. ConnectionInternal: " << &p); + SDL_TRACE("enter. ConnectionInternal: " << &p); TransportManagerImpl::Connection c; c.application = p.application; c.device = p.device; c.id = p.id; - LOGGER_TRACE( - logger_, - "exit with TransportManagerImpl::Connection. It's ConnectionUID = " - << c.id); + SDL_TRACE("exit with TransportManagerImpl::Connection. It's ConnectionUID = " + << c.id); return c; } @@ -85,11 +83,11 @@ TransportManagerImpl::TransportManagerImpl( , message_queue_("TM MessageQueue", this) , event_queue_("TM EventQueue", this) , settings_(settings) { - LOGGER_TRACE(logger_, "TransportManager has created"); + SDL_TRACE("TransportManager has created"); } TransportManagerImpl::~TransportManagerImpl() { - LOGGER_DEBUG(logger_, "TransportManager object destroying"); + SDL_DEBUG("TransportManager object destroying"); message_queue_.Shutdown(); event_queue_.Shutdown(); @@ -107,68 +105,65 @@ TransportManagerImpl::~TransportManagerImpl() { delete it->second; } - LOGGER_INFO(logger_, "TransportManager object destroyed"); + SDL_INFO("TransportManager object destroyed"); } int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) { - LOGGER_TRACE(logger_, "enter. DeviceHandle: " << &device_handle); + SDL_TRACE("enter. DeviceHandle: " << &device_handle); if (!this->is_initialized_) { - LOGGER_ERROR(logger_, "TransportManager is not initialized."); - LOGGER_TRACE( - logger_, + SDL_ERROR("TransportManager is not initialized."); + SDL_TRACE( "exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } DeviceUID device_id = converter_.HandleToUid(device_handle); - LOGGER_DEBUG(logger_, "Convert handle to id:" << device_id); + SDL_DEBUG("Convert handle to id:" << device_id); sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_); DeviceToAdapterMap::iterator it = device_to_adapter_map_.find(device_id); if (it == device_to_adapter_map_.end()) { - LOGGER_ERROR(logger_, "No device adapter found by id " << device_id); - LOGGER_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta"); + SDL_ERROR("No device adapter found by id " << device_id); + SDL_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == ta"); return E_INVALID_HANDLE; } transport_adapter::TransportAdapter* ta = it->second; TransportAdapter::Error ta_error = ta->ConnectDevice(device_id); int err = (TransportAdapter::OK == ta_error) ? E_SUCCESS : E_INTERNAL_ERROR; - LOGGER_TRACE(logger_, "exit with error: " << err); + SDL_TRACE("exit with error: " << err); return err; } int TransportManagerImpl::DisconnectDevice(const DeviceHandle device_handle) { - LOGGER_TRACE(logger_, "enter. DeviceHandle: " << &device_handle); + SDL_TRACE("enter. DeviceHandle: " << &device_handle); if (!this->is_initialized_) { - LOGGER_ERROR(logger_, "TransportManager is not initialized."); - LOGGER_TRACE( - logger_, + SDL_ERROR("TransportManager is not initialized."); + SDL_TRACE( "exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } DeviceUID device_id = converter_.HandleToUid(device_handle); - LOGGER_DEBUG(logger_, "Convert handle to id:" << device_id); + SDL_DEBUG("Convert handle to id:" << device_id); sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_); DeviceToAdapterMap::iterator it = device_to_adapter_map_.find(device_id); if (it == device_to_adapter_map_.end()) { - LOGGER_WARN(logger_, "No device adapter found by id " << device_id); - LOGGER_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta"); + SDL_WARN("No device adapter found by id " << device_id); + SDL_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == ta"); return E_INVALID_HANDLE; } transport_adapter::TransportAdapter* ta = it->second; ta->DisconnectDevice(device_id); - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::Disconnect(const ConnectionUID cid) { - LOGGER_TRACE(logger_, "enter. ConnectionUID: " << &cid); + SDL_TRACE("enter. ConnectionUID: " << &cid); if (!this->is_initialized_) { - LOGGER_ERROR(logger_, "TransportManager is not initialized."); - LOGGER_TRACE( - logger_, + SDL_ERROR("TransportManager is not initialized."); + SDL_TRACE( "exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } @@ -176,11 +171,8 @@ int TransportManagerImpl::Disconnect(const ConnectionUID cid) { sync_primitives::AutoReadLock lock(connections_lock_); ConnectionInternal* connection = GetConnection(cid); if (NULL == connection) { - LOGGER_ERROR( - logger_, - "TransportManagerImpl::Disconnect: Connection does not exist."); - LOGGER_TRACE(logger_, - "exit with E_INVALID_HANDLE. Condition: NULL == connection"); + SDL_ERROR("TransportManagerImpl::Disconnect: Connection does not exist."); + SDL_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == connection"); return E_INVALID_HANDLE; } @@ -211,44 +203,42 @@ int TransportManagerImpl::Disconnect(const ConnectionUID cid) { connection->application); } */ - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::DisconnectForce(const ConnectionUID cid) { - LOGGER_TRACE(logger_, "enter ConnectionUID: " << &cid); + SDL_TRACE("enter ConnectionUID: " << &cid); if (false == this->is_initialized_) { - LOGGER_ERROR(logger_, "TransportManager is not initialized."); - LOGGER_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " - "this->is_initialized_"); + SDL_ERROR("TransportManager is not initialized."); + SDL_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " + "this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } sync_primitives::AutoReadLock lock(connections_lock_); const ConnectionInternal* connection = GetConnection(cid); if (NULL == connection) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "TransportManagerImpl::DisconnectForce: Connection does not exist."); - LOGGER_TRACE(logger_, - "exit with E_INVALID_HANDLE. Condition: NULL == connection"); + SDL_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == connection"); return E_INVALID_HANDLE; } connection->transport_adapter->Disconnect(connection->device, connection->application); - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::AddEventListener(TransportManagerListener* listener) { - LOGGER_TRACE(logger_, "enter. TransportManagerListener: " << listener); + SDL_TRACE("enter. TransportManagerListener: " << listener); transport_manager_listener_.push_back(listener); - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } void TransportManagerImpl::DisconnectAllDevices() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoReadLock lock(device_list_lock_); for (DeviceInfoList::iterator i = device_list_.begin(); i != device_list_.end(); @@ -259,7 +249,7 @@ void TransportManagerImpl::DisconnectAllDevices() { } void TransportManagerImpl::TerminateAllAdapters() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); for (std::vector<TransportAdapter*>::iterator i = transport_adapters_.begin(); i != transport_adapters_.end(); ++i) { @@ -268,7 +258,7 @@ void TransportManagerImpl::TerminateAllAdapters() { } int TransportManagerImpl::InitAllAdapters() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); for (std::vector<TransportAdapter*>::iterator i = transport_adapters_.begin(); i != transport_adapters_.end(); ++i) { @@ -280,9 +270,9 @@ int TransportManagerImpl::InitAllAdapters() { } int TransportManagerImpl::Stop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!is_initialized_) { - LOGGER_WARN(logger_, "TransportManager is not initialized_"); + SDL_WARN("TransportManager is not initialized_"); return E_TM_IS_NOT_INITIALIZED; } @@ -298,14 +288,13 @@ int TransportManagerImpl::Stop() { int TransportManagerImpl::SendMessageToDevice( const ::protocol_handler::RawMessagePtr message) { - LOGGER_TRACE(logger_, "enter. RawMessageSptr: " << message); - LOGGER_INFO(logger_, - "Send message to device called with arguments " << message.get()); + SDL_TRACE("enter. RawMessageSptr: " << message); + SDL_INFO("Send message to device called with arguments " << message.get()); if (false == this->is_initialized_) { - LOGGER_ERROR(logger_, "TM is not initialized."); - LOGGER_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " - "this->is_initialized_"); + SDL_ERROR("TM is not initialized."); + SDL_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " + "this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } @@ -314,21 +303,18 @@ int TransportManagerImpl::SendMessageToDevice( const ConnectionInternal* connection = GetConnection(message->connection_key()); if (NULL == connection) { - LOGGER_ERROR(logger_, - "Connection with id " << message->connection_key() - << " does not exist."); - LOGGER_TRACE(logger_, - "exit with E_INVALID_HANDLE. Condition: NULL == connection"); + SDL_ERROR("Connection with id " << message->connection_key() + << " does not exist."); + SDL_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == connection"); return E_INVALID_HANDLE; } if (connection->shutdown_) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "TransportManagerImpl::Disconnect: Connection is to shut down."); - LOGGER_TRACE(logger_, - "exit with E_CONNECTION_IS_TO_SHUTDOWN. Condition: " - "connection->shutDown"); + SDL_TRACE( + "exit with E_CONNECTION_IS_TO_SHUTDOWN. Condition: " + "connection->shutDown"); return E_CONNECTION_IS_TO_SHUTDOWN; } } @@ -338,52 +324,52 @@ int TransportManagerImpl::SendMessageToDevice( } #endif // TELEMETRY_MONITOR this->PostMessage(message); - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::ReceiveEventFromDevice( const TransportAdapterEvent& event) { - LOGGER_TRACE(logger_, "enter. TransportAdapterEvent: " << &event); + SDL_TRACE("enter. TransportAdapterEvent: " << &event); if (!is_initialized_) { - LOGGER_ERROR(logger_, "TM is not initialized."); - LOGGER_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " - "this->is_initialized_"); + SDL_ERROR("TM is not initialized."); + SDL_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " + "this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } this->PostEvent(event); - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::RemoveDevice(const DeviceHandle device_handle) { - LOGGER_TRACE(logger_, "enter. DeviceHandle: " << &device_handle); + SDL_TRACE("enter. DeviceHandle: " << &device_handle); DeviceUID device_id = converter_.HandleToUid(device_handle); if (false == this->is_initialized_) { - LOGGER_ERROR(logger_, "TM is not initialized."); - LOGGER_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " - "this->is_initialized_"); + SDL_ERROR("TM is not initialized."); + SDL_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " + "this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } sync_primitives::AutoWriteLock lock(device_to_adapter_map_lock_); device_to_adapter_map_.erase(device_id); - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::AddTransportAdapter( transport_adapter::TransportAdapter* transport_adapter) { - LOGGER_TRACE(logger_, "enter. TransportAdapter: " << transport_adapter); + SDL_TRACE("enter. TransportAdapter: " << transport_adapter); if (transport_adapter_listeners_.find(transport_adapter) != transport_adapter_listeners_.end()) { - LOGGER_ERROR(logger_, "Adapter already exists."); - LOGGER_TRACE(logger_, - "exit with E_ADAPTER_EXISTS. Condition: " - "transport_adapter_listeners_.find(transport_adapter) != " - "transport_adapter_listeners_.end()"); + SDL_ERROR("Adapter already exists."); + SDL_TRACE( + "exit with E_ADAPTER_EXISTS. Condition: " + "transport_adapter_listeners_.find(transport_adapter) != " + "transport_adapter_listeners_.end()"); return E_ADAPTER_EXISTS; } transport_adapter_listeners_[transport_adapter] = @@ -395,21 +381,20 @@ int TransportManagerImpl::AddTransportAdapter( transport_adapter->Init() == TransportAdapter::OK) { transport_adapters_.push_back(transport_adapter); } - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::SearchDevices() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); if (!this->is_initialized_) { - LOGGER_ERROR(logger_, "TM is not initialized"); - LOGGER_TRACE( - logger_, + SDL_ERROR("TM is not initialized"); + SDL_TRACE( "exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } - LOGGER_INFO(logger_, "Search device called"); + SDL_INFO("Search device called"); bool success_occurred = false; @@ -417,32 +402,29 @@ int TransportManagerImpl::SearchDevices() { transport_adapters_.begin(); it != transport_adapters_.end(); ++it) { - LOGGER_DEBUG(logger_, "Iterating over transport adapters"); + SDL_DEBUG("Iterating over transport adapters"); TransportAdapter::Error scanResult = (*it)->SearchDevices(); if (transport_adapter::TransportAdapter::OK == scanResult) { success_occurred = true; } else { - LOGGER_ERROR(logger_, - "Transport Adapter search failed " - << *it << "[" << (*it)->GetDeviceType() << "]"); + SDL_ERROR("Transport Adapter search failed " + << *it << "[" << (*it)->GetDeviceType() << "]"); switch (scanResult) { case transport_adapter::TransportAdapter::NOT_SUPPORTED: { - LOGGER_ERROR(logger_, - "Search feature is not supported " - << *it << "[" << (*it)->GetDeviceType() << "]"); - LOGGER_DEBUG(logger_, "scanResult = TransportAdapter::NOT_SUPPORTED"); + SDL_ERROR("Search feature is not supported " + << *it << "[" << (*it)->GetDeviceType() << "]"); + SDL_DEBUG("scanResult = TransportAdapter::NOT_SUPPORTED"); break; } case transport_adapter::TransportAdapter::BAD_STATE: { - LOGGER_ERROR(logger_, - "Transport Adapter has bad state " - << *it << "[" << (*it)->GetDeviceType() << "]"); - LOGGER_DEBUG(logger_, "scanResult = TransportAdapter::BAD_STATE"); + SDL_ERROR("Transport Adapter has bad state " + << *it << "[" << (*it)->GetDeviceType() << "]"); + SDL_DEBUG("scanResult = TransportAdapter::BAD_STATE"); break; } default: { - LOGGER_ERROR(logger_, "Invalid scan result"); - LOGGER_DEBUG(logger_, "scanResult = default switch case"); + SDL_ERROR("Invalid scan result"); + SDL_DEBUG("scanResult = default switch case"); return E_ADAPTERS_FAIL; } } @@ -452,27 +434,27 @@ int TransportManagerImpl::SearchDevices() { (success_occurred || transport_adapters_.empty()) ? E_SUCCESS : E_ADAPTERS_FAIL; if (transport_adapter_search == E_SUCCESS) { - LOGGER_TRACE(logger_, - "exit with E_SUCCESS. Condition: success_occured || " - "transport_adapters_.empty()"); + SDL_TRACE( + "exit with E_SUCCESS. Condition: success_occured || " + "transport_adapters_.empty()"); } else { - LOGGER_TRACE(logger_, - "exit with E_ADAPTERS_FAIL. Condition: success_occured || " - "transport_adapters_.empty()"); + SDL_TRACE( + "exit with E_ADAPTERS_FAIL. Condition: success_occured || " + "transport_adapters_.empty()"); } return transport_adapter_search; } int TransportManagerImpl::Init(resumption::LastState& last_state) { // Last state requred to initialize Transport adapters - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); is_initialized_ = true; - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::Reinit() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DisconnectAllDevices(); TerminateAllAdapters(); int ret = InitAllAdapters(); @@ -480,15 +462,15 @@ int TransportManagerImpl::Reinit() { } int TransportManagerImpl::Visibility(const bool& on_off) const { - LOGGER_TRACE(logger_, "enter. On_off: " << &on_off); + SDL_TRACE("enter. On_off: " << &on_off); TransportAdapter::Error ret; - LOGGER_DEBUG(logger_, "Visibility change requested to " << on_off); + SDL_DEBUG("Visibility change requested to " << on_off); if (!is_initialized_) { - LOGGER_ERROR(logger_, "TM is not initialized"); - LOGGER_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " - "is_initialized_"); + SDL_ERROR("TM is not initialized"); + SDL_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " + "is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } @@ -502,17 +484,16 @@ int TransportManagerImpl::Visibility(const bool& on_off) const { ret = (*it)->StopClientListening(); } if (TransportAdapter::Error::NOT_SUPPORTED == ret) { - LOGGER_DEBUG(logger_, - "Visibility change is not supported for adapter " - << *it << "[" << (*it)->GetDeviceType() << "]"); + SDL_DEBUG("Visibility change is not supported for adapter " + << *it << "[" << (*it)->GetDeviceType() << "]"); } } - LOGGER_TRACE(logger_, "exit with E_SUCCESS"); + SDL_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } void TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) { - LOGGER_TRACE(logger_, "enter. TransportAdapter: " << ta); + SDL_TRACE("enter. TransportAdapter: " << ta); std::set<DeviceInfo> old_devices; std::set<DeviceInfo> new_devices; { @@ -562,19 +543,19 @@ void TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) { ++it) { RaiseEvent(&TransportManagerListener::OnDeviceRemoved, *it); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportManagerImpl::PostMessage( const ::protocol_handler::RawMessagePtr message) { - LOGGER_TRACE(logger_, "enter. RawMessageSptr: " << message); + SDL_TRACE("enter. RawMessageSptr: " << message); message_queue_.PostMessage(message); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportManagerImpl::PostEvent(const TransportAdapterEvent& event) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "TransportAdapterEvent: " << &event); + SDL_AUTO_TRACE(); + SDL_DEBUG("TransportAdapterEvent: " << &event); event_queue_.PostMessage(event); } @@ -582,16 +563,16 @@ const TransportManagerSettings& TransportManagerImpl::get_settings() const { return settings_; } void TransportManagerImpl::AddConnection(const ConnectionInternal& c) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "ConnectionInternal: " << &c); + SDL_AUTO_TRACE(); + SDL_DEBUG("ConnectionInternal: " << &c); sync_primitives::AutoWriteLock lock(connections_lock_); connections_.push_back(c); } void TransportManagerImpl::RemoveConnection( const uint32_t id, transport_adapter::TransportAdapter* transport_adapter) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Id: " << id); + SDL_AUTO_TRACE(); + SDL_DEBUG("Id: " << id); sync_primitives::AutoWriteLock lock(connections_lock_); for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); it != connections_.end(); @@ -609,13 +590,13 @@ void TransportManagerImpl::RemoveConnection( TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( const ConnectionUID id) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "ConnectionUID: " << &id); + SDL_AUTO_TRACE(); + SDL_DEBUG("ConnectionUID: " << &id); for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); it != connections_.end(); ++it) { if (it->id == id) { - LOGGER_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it); + SDL_DEBUG("ConnectionInternal. It's address: " << &*it); return &*it; } } @@ -624,15 +605,13 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( const DeviceUID& device, const ApplicationHandle& application) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "DeviceUID: " << &device - << "ApplicationHandle: " << &application); + SDL_AUTO_TRACE(); + SDL_DEBUG("DeviceUID: " << &device << "ApplicationHandle: " << &application); for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); it != connections_.end(); ++it) { if (it->device == device && it->application == application) { - LOGGER_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it); + SDL_DEBUG("ConnectionInternal. It's address: " << &*it); return &*it; } } @@ -640,9 +619,9 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( } void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) { - LOGGER_TRACE(logger_, "enter. TransportAdapter: " << ta); + SDL_TRACE("enter. TransportAdapter: " << ta); const DeviceList device_list = ta->GetDeviceList(); - LOGGER_DEBUG(logger_, "DEVICE_LIST_UPDATED " << device_list.size()); + SDL_DEBUG("DEVICE_LIST_UPDATED " << device_list.size()); for (DeviceList::const_iterator it = device_list.begin(); it != device_list.end(); ++it) { @@ -664,32 +643,32 @@ void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) { } device_list_lock_.ReleaseForReading(); RaiseEvent(&TransportManagerListener::OnDeviceListUpdated, device_infos); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void TransportManagerImpl::Handle(TransportAdapterEvent event) { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); switch (event.event_type) { case TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE: { RaiseEvent(&TransportManagerListener::OnScanDevicesFinished); - LOGGER_DEBUG(logger_, "event_type = ON_SEARCH_DONE"); + SDL_DEBUG("event_type = ON_SEARCH_DONE"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL: { // error happened in real search process (external error) RaiseEvent(&TransportManagerListener::OnScanDevicesFailed, *static_cast<SearchDeviceError*>(event.event_error.get())); - LOGGER_DEBUG(logger_, "event_type = ON_SEARCH_FAIL"); + SDL_DEBUG("event_type = ON_SEARCH_FAIL"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED: { OnDeviceListUpdated(event.transport_adapter); - LOGGER_DEBUG(logger_, "event_type = ON_DEVICE_LIST_UPDATED"); + SDL_DEBUG("event_type = ON_DEVICE_LIST_UPDATED"); break; } case TransportAdapterListenerImpl::ON_FIND_NEW_APPLICATIONS_REQUEST: { RaiseEvent(&TransportManagerListener::OnFindNewApplicationsRequest); - LOGGER_DEBUG(logger_, "event_type = ON_FIND_NEW_APPLICATIONS_REQUEST"); + SDL_DEBUG("event_type = ON_FIND_NEW_APPLICATIONS_REQUEST"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE: { @@ -708,7 +687,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { event.transport_adapter->DeviceName(event.device_uid), event.transport_adapter->GetConnectionType()), connection_id_counter_); - LOGGER_DEBUG(logger_, "event_type = ON_CONNECT_DONE"); + SDL_DEBUG("event_type = ON_CONNECT_DONE"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL: { @@ -719,7 +698,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { event.transport_adapter->DeviceName(event.device_uid), event.transport_adapter->GetConnectionType()), ConnectError()); - LOGGER_DEBUG(logger_, "event_type = ON_CONNECT_FAIL"); + SDL_DEBUG("event_type = ON_CONNECT_FAIL"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE: { @@ -727,9 +706,8 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); if (NULL == connection) { - LOGGER_ERROR(logger_, "Connection not found"); - LOGGER_DEBUG(logger_, - "event_type = ON_DISCONNECT_DONE && NULL == connection"); + SDL_ERROR("Connection not found"); + SDL_DEBUG("event_type = ON_DISCONNECT_DONE && NULL == connection"); connections_lock_.ReleaseForReading(); break; } @@ -738,7 +716,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { RaiseEvent(&TransportManagerListener::OnConnectionClosed, id); RemoveConnection(id, connection->transport_adapter); - LOGGER_DEBUG(logger_, "event_type = ON_DISCONNECT_DONE"); + SDL_DEBUG("event_type = ON_DISCONNECT_DONE"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL: { @@ -747,7 +725,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { RaiseEvent(&TransportManagerListener::OnDisconnectFailed, device_handle, DisconnectDeviceError()); - LOGGER_DEBUG(logger_, "event_type = ON_DISCONNECT_FAIL"); + SDL_DEBUG("event_type = ON_DISCONNECT_FAIL"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE: { @@ -760,12 +738,9 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); if (connection == NULL) { - LOGGER_ERROR(logger_, - "Connection ('" << event.device_uid << ", " - << event.application_id << ") not found"); - LOGGER_DEBUG( - logger_, - "event_type = ON_SEND_DONE. Condition: NULL == connection"); + SDL_ERROR("Connection ('" << event.device_uid << ", " + << event.application_id << ") not found"); + SDL_DEBUG("event_type = ON_SEND_DONE. Condition: NULL == connection"); break; } RaiseEvent(&TransportManagerListener::OnTMMessageSend, event.event_data); @@ -774,7 +749,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { connection->transport_adapter->Disconnect(connection->device, connection->application); } - LOGGER_DEBUG(logger_, "event_type = ON_SEND_DONE"); + SDL_DEBUG("event_type = ON_SEND_DONE"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL: { @@ -788,28 +763,24 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); if (connection == NULL) { - LOGGER_ERROR(logger_, - "Connection ('" << event.device_uid << ", " - << event.application_id - << ") not found"); - LOGGER_DEBUG( - logger_, - "event_type = ON_SEND_FAIL. Condition: NULL == connection"); + SDL_ERROR("Connection ('" << event.device_uid << ", " + << event.application_id << ") not found"); + SDL_DEBUG("event_type = ON_SEND_FAIL. Condition: NULL == connection"); break; } } // TODO(YK): start timer here to wait before notify caller // and remove unsent messages - LOGGER_ERROR(logger_, "Transport adapter failed to send data"); + SDL_ERROR("Transport adapter failed to send data"); // TODO(YK): potential error case -> thread unsafe // update of message content if (event.event_data.valid()) { event.event_data->set_waiting(true); } else { - LOGGER_DEBUG(logger_, "Data is invalid"); + SDL_DEBUG("Data is invalid"); } - LOGGER_DEBUG(logger_, "eevent_type = ON_SEND_FAIL"); + SDL_DEBUG("eevent_type = ON_SEND_FAIL"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE: { @@ -818,12 +789,9 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); if (connection == NULL) { - LOGGER_ERROR(logger_, - "Connection ('" << event.device_uid << ", " - << event.application_id - << ") not found"); - LOGGER_DEBUG( - logger_, + SDL_ERROR("Connection ('" << event.device_uid << ", " + << event.application_id << ") not found"); + SDL_DEBUG( "event_type = ON_RECEIVED_DONE. Condition: NULL == connection"); break; } @@ -836,18 +804,17 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { #endif // TELEMETRY_MONITOR RaiseEvent(&TransportManagerListener::OnTMMessageReceived, event.event_data); - LOGGER_DEBUG(logger_, "event_type = ON_RECEIVED_DONE"); + SDL_DEBUG("event_type = ON_RECEIVED_DONE"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL: { - LOGGER_DEBUG(logger_, "Event ON_RECEIVED_FAIL"); + SDL_DEBUG("Event ON_RECEIVED_FAIL"); connections_lock_.AcquireForReading(); ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); if (connection == NULL) { - LOGGER_ERROR(logger_, - "Connection ('" << event.device_uid << ", " - << event.application_id << ") not found"); + SDL_ERROR("Connection ('" << event.device_uid << ", " + << event.application_id << ") not found"); connections_lock_.ReleaseForReading(); break; } @@ -855,11 +822,11 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { RaiseEvent(&TransportManagerListener::OnTMMessageReceiveFailed, *static_cast<DataReceiveError*>(event.event_error.get())); - LOGGER_DEBUG(logger_, "event_type = ON_RECEIVED_FAIL"); + SDL_DEBUG("event_type = ON_RECEIVED_FAIL"); break; } case TransportAdapterListenerImpl::EventTypeEnum::ON_COMMUNICATION_ERROR: { - LOGGER_DEBUG(logger_, "event_type = ON_COMMUNICATION_ERROR"); + SDL_DEBUG("event_type = ON_COMMUNICATION_ERROR"); break; } case TransportAdapterListenerImpl::EventTypeEnum:: @@ -876,15 +843,14 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { RemoveConnection(id, connection->transport_adapter); } else { connections_lock_.ReleaseForReading(); - LOGGER_ERROR(logger_, - "Connection ('" << event.device_uid << ", " - << event.application_id << ") not found"); + SDL_ERROR("Connection ('" << event.device_uid << ", " + << event.application_id << ") not found"); } - LOGGER_DEBUG(logger_, "eevent_type = ON_UNEXPECTED_DISCONNECT"); + SDL_DEBUG("eevent_type = ON_UNEXPECTED_DISCONNECT"); break; } } // switch - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } #ifdef TELEMETRY_MONITOR @@ -894,12 +860,11 @@ void TransportManagerImpl::SetTelemetryObserver(TMTelemetryObserver* observer) { #endif // TELEMETRY_MONITOR void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); sync_primitives::AutoReadLock lock(connections_lock_); ConnectionInternal* connection = GetConnection(msg->connection_key()); if (connection == NULL) { - LOGGER_WARN(logger_, - "Connection " << msg->connection_key() << " not found"); + SDL_WARN("Connection " << msg->connection_key() << " not found"); RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, DataSendTimeoutError(), msg); @@ -907,14 +872,13 @@ void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) { } TransportAdapter* transport_adapter = connection->transport_adapter; - LOGGER_DEBUG(logger_, - "Got adapter " << transport_adapter << "[" - << transport_adapter->GetDeviceType() << "]" - << " by session id " << msg->connection_key()); + SDL_DEBUG("Got adapter " << transport_adapter << "[" + << transport_adapter->GetDeviceType() << "]" + << " by session id " << msg->connection_key()); if (NULL == transport_adapter) { std::string error_text = "Transport adapter is not found"; - LOGGER_ERROR(logger_, error_text); + SDL_ERROR(error_text); RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, DataSendError(error_text), msg); @@ -922,15 +886,15 @@ void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) { if (TransportAdapter::OK == transport_adapter->SendData( connection->device, connection->application, msg)) { - LOGGER_TRACE(logger_, "Data sent to adapter"); + SDL_TRACE("Data sent to adapter"); } else { - LOGGER_ERROR(logger_, "Data sent error"); + SDL_ERROR("Data sent error"); RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, DataSendError("Send failed"), msg); } } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } TransportManagerImpl::ConnectionInternal::ConnectionInternal( @@ -957,13 +921,13 @@ TransportManagerImpl::ConnectionInternal::ConnectionInternal( } void TransportManagerImpl::ConnectionInternal::DisconnectFailedRoutine() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); transport_manager->RaiseEvent(&TransportManagerListener::OnDisconnectFailed, device_handle_, DisconnectDeviceError()); shutdown_ = false; timer->Stop(); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } } // namespace transport_manager diff --git a/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc b/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc index 77fe496e92..081b23bc91 100644 --- a/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc +++ b/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc @@ -39,7 +39,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") PlatformUsbDevice::PlatformUsbDevice( uint8_t bus_number, @@ -56,18 +56,17 @@ PlatformUsbDevice::PlatformUsbDevice( , libusb_device_(device_libusb) {} std::string PlatformUsbDevice::GetDescString(uint8_t index) const { - LOGGER_TRACE(logger_, "enter. index: " << int(index)); + SDL_TRACE("enter. index: " << int(index)); unsigned char buf[128]; const int libusb_ret = libusb_get_string_descriptor_ascii( libusb_device_handle_, index, buf, sizeof(buf)); if (libusb_ret < 0) { - LOGGER_ERROR(logger_, - "Failed to get USB string descriptor: " - << libusb_error_name(libusb_ret)); - LOGGER_TRACE(logger_, "exit with empty string"); + SDL_ERROR("Failed to get USB string descriptor: " + << libusb_error_name(libusb_ret)); + SDL_TRACE("exit with empty string"); return ""; } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); return std::string(reinterpret_cast<char*>(buf)); } diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc index 8e3e4cdd4d..3f566b92a3 100644 --- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc +++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc @@ -48,7 +48,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") UsbConnection::UsbConnection(const DeviceUID& device_uid, const ApplicationHandle& app_handle, @@ -76,11 +76,11 @@ UsbConnection::UsbConnection(const DeviceUID& device_uid, , waiting_out_transfer_cancel_(false) {} UsbConnection::~UsbConnection() { - LOGGER_TRACE(logger_, "enter with this" << this); + SDL_TRACE("enter with this" << this); Finalise(); libusb_free_transfer(in_transfer_); delete[] in_buffer_; - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } // Callback for handling income and outcome data from lib_usb @@ -93,7 +93,7 @@ void LIBUSB_CALL OutTransferCallback(libusb_transfer* transfer) { } bool UsbConnection::PostInTransfer() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); libusb_fill_bulk_transfer(in_transfer_, device_handle_, in_endpoint_, @@ -104,15 +104,13 @@ bool UsbConnection::PostInTransfer() { 0); const int libusb_ret = libusb_submit_transfer(in_transfer_); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "libusb_submit_transfer failed: " << libusb_error_name(libusb_ret)); - LOGGER_TRACE( - logger_, + SDL_TRACE( "exit with FALSE. Condition: LIBUSB_SUCCESS != libusb_submit_transfer"); return false; } - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); return true; } @@ -127,19 +125,17 @@ std::string hex_data(const unsigned char* const buffer, } void UsbConnection::OnInTransfer(libusb_transfer* transfer) { - LOGGER_TRACE(logger_, "enter with Libusb_transfer*: " << transfer); + SDL_TRACE("enter with Libusb_transfer*: " << transfer); if (transfer->status == LIBUSB_TRANSFER_COMPLETED) { - LOGGER_DEBUG(logger_, - "USB incoming transfer, size:" - << transfer->actual_length << ", data:" - << hex_data(transfer->buffer, transfer->actual_length)); + SDL_DEBUG("USB incoming transfer, size:" + << transfer->actual_length << ", data:" + << hex_data(transfer->buffer, transfer->actual_length)); ::protocol_handler::RawMessagePtr data(new protocol_handler::RawMessage( 0, 0, in_buffer_, transfer->actual_length)); controller_->DataReceiveDone(device_uid_, app_handle_, data); } else { - LOGGER_ERROR(logger_, - "USB incoming transfer failed: " - << libusb_error_name(transfer->status)); + SDL_ERROR("USB incoming transfer failed: " + << libusb_error_name(transfer->status)); controller_->DataReceiveFailed( device_uid_, app_handle_, DataReceiveError()); } @@ -147,17 +143,16 @@ void UsbConnection::OnInTransfer(libusb_transfer* transfer) { waiting_in_transfer_cancel_ = false; } else { if (!PostInTransfer()) { - LOGGER_ERROR(logger_, - "USB incoming transfer failed with " - << "LIBUSB_TRANSFER_NO_DEVICE. Abort connection."); + SDL_ERROR("USB incoming transfer failed with " + << "LIBUSB_TRANSFER_NO_DEVICE. Abort connection."); AbortConnection(); } } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void UsbConnection::PopOutMessage() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); bytes_sent_ = 0; if (out_messages_.empty()) { current_out_message_.reset(); @@ -166,15 +161,15 @@ void UsbConnection::PopOutMessage() { out_messages_.pop_front(); PostOutTransfer(); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } bool UsbConnection::PostOutTransfer() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); out_transfer_ = libusb_alloc_transfer(0); if (0 == out_transfer_) { - LOGGER_ERROR(logger_, "libusb_alloc_transfer failed"); - LOGGER_TRACE(logger_, "exit with FALSE. Condition: 0 == out_transfer_"); + SDL_ERROR("libusb_alloc_transfer failed"); + SDL_TRACE("exit with FALSE. Condition: 0 == out_transfer_"); return false; } libusb_fill_bulk_transfer(out_transfer_, @@ -187,34 +182,29 @@ bool UsbConnection::PostOutTransfer() { 0); const int libusb_ret = libusb_submit_transfer(out_transfer_); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_ERROR(logger_, - "libusb_submit_transfer failed: " - << libusb_error_name(libusb_ret) << ". Abort connection."); + SDL_ERROR("libusb_submit_transfer failed: " << libusb_error_name(libusb_ret) + << ". Abort connection."); AbortConnection(); - LOGGER_TRACE(logger_, - "exit with FALSE. Condition: " - << "LIBUSB_SUCCESS != libusb_fill_bulk_transfer"); + SDL_TRACE("exit with FALSE. Condition: " + << "LIBUSB_SUCCESS != libusb_fill_bulk_transfer"); return false; } - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); return true; } void UsbConnection::OnOutTransfer(libusb_transfer* transfer) { - LOGGER_TRACE(logger_, "enter with Libusb_transfer*: " << transfer); + SDL_TRACE("enter with Libusb_transfer*: " << transfer); sync_primitives::AutoLock locker(out_messages_mutex_); if (transfer->status == LIBUSB_TRANSFER_COMPLETED) { bytes_sent_ += transfer->actual_length; if (bytes_sent_ == current_out_message_->data_size()) { - LOGGER_DEBUG( - logger_, - "USB out transfer, data sent: " << current_out_message_.get()); + SDL_DEBUG("USB out transfer, data sent: " << current_out_message_.get()); controller_->DataSendDone(device_uid_, app_handle_, current_out_message_); PopOutMessage(); } } else { - LOGGER_ERROR( - logger_, + SDL_ERROR( "USB out transfer failed: " << libusb_error_name(transfer->status)); controller_->DataSendFailed( device_uid_, app_handle_, current_out_message_, DataSendError()); @@ -225,16 +215,15 @@ void UsbConnection::OnOutTransfer(libusb_transfer* transfer) { out_transfer_ = NULL; waiting_out_transfer_cancel_ = false; } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } TransportAdapter::Error UsbConnection::SendData( ::protocol_handler::RawMessagePtr message) { - LOGGER_TRACE(logger_, "enter with RawMessagePtr: " << message.get()); + SDL_TRACE("enter with RawMessagePtr: " << message.get()); if (disconnecting_) { - LOGGER_TRACE(logger_, - "exit with TransportAdapter::BAD_STATE. Condition: " - << "disconnecting_"); + SDL_TRACE("exit with TransportAdapter::BAD_STATE. Condition: " + << "disconnecting_"); return TransportAdapter::BAD_STATE; } sync_primitives::AutoLock locker(out_messages_mutex_); @@ -245,19 +234,18 @@ TransportAdapter::Error UsbConnection::SendData( if (!PostOutTransfer()) { controller_->DataSendFailed( device_uid_, app_handle_, message, DataSendError()); - LOGGER_TRACE( - logger_, + SDL_TRACE( "exit with TransportAdapter::FAIL. Condition: !PostOutTransfer()"); return TransportAdapter::FAIL; } } - LOGGER_TRACE(logger_, "exit with TransportAdapter::OK."); + SDL_TRACE("exit with TransportAdapter::OK."); return TransportAdapter::OK; } void UsbConnection::Finalise() { - LOGGER_TRACE(logger_, "enter"); - LOGGER_DEBUG(logger_, "Finalise USB connection " << device_uid_); + SDL_TRACE("enter"); + SDL_DEBUG("Finalise USB connection " << device_uid_); { sync_primitives::AutoLock locker(out_messages_mutex_); disconnecting_ = true; @@ -288,15 +276,15 @@ void UsbConnection::Finalise() { SwitchToThread(); #endif } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void UsbConnection::AbortConnection() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); controller_->ConnectionAborted( device_uid_, app_handle_, CommunicationError()); Disconnect(); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } TransportAdapter::Error UsbConnection::Disconnect() { @@ -306,44 +294,42 @@ TransportAdapter::Error UsbConnection::Disconnect() { } bool UsbConnection::Init() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); if (!FindEndpoints()) { - LOGGER_ERROR(logger_, "EndPoints was not found"); - LOGGER_TRACE(logger_, "exit with FALSE. Condition: !FindEndpoints()"); + SDL_ERROR("EndPoints was not found"); + SDL_TRACE("exit with FALSE. Condition: !FindEndpoints()"); return false; } in_buffer_ = new unsigned char[in_endpoint_max_packet_size_]; in_transfer_ = libusb_alloc_transfer(0); if (NULL == in_transfer_) { - LOGGER_ERROR(logger_, "libusb_alloc_transfer failed"); - LOGGER_TRACE(logger_, "exit with FALSE. Condition: NULL == in_transfer_"); + SDL_ERROR("libusb_alloc_transfer failed"); + SDL_TRACE("exit with FALSE. Condition: NULL == in_transfer_"); return false; } controller_->ConnectDone(device_uid_, app_handle_); if (!PostInTransfer()) { - LOGGER_ERROR(logger_, "PostInTransfer failed. Call ConnectionAborted"); + SDL_ERROR("PostInTransfer failed. Call ConnectionAborted"); controller_->ConnectionAborted( device_uid_, app_handle_, CommunicationError()); - LOGGER_TRACE(logger_, "exit with FALSE. Condition: !PostInTransfer()"); + SDL_TRACE("exit with FALSE. Condition: !PostInTransfer()"); return false; } - LOGGER_TRACE(logger_, "exit with TRUE"); + SDL_TRACE("exit with TRUE"); return true; } bool UsbConnection::FindEndpoints() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); struct libusb_config_descriptor* config; const int libusb_ret = libusb_get_active_config_descriptor(libusb_device_, &config); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_ERROR(logger_, - "libusb_get_active_config_descriptor failed: " - << libusb_error_name(libusb_ret)); - LOGGER_TRACE(logger_, - "exit with FALSE. Condition: LIBUSB_SUCCESS != libusb_ret"); + SDL_ERROR("libusb_get_active_config_descriptor failed: " + << libusb_error_name(libusb_ret)); + SDL_TRACE("exit with FALSE. Condition: LIBUSB_SUCCESS != libusb_ret"); return false; } @@ -375,7 +361,7 @@ bool UsbConnection::FindEndpoints() { libusb_free_config_descriptor(config); const bool result = !(find_in_endpoint || find_out_endpoint); - LOGGER_TRACE(logger_, "exit with " << (result ? "TRUE" : "FALSE")); + SDL_TRACE("exit with " << (result ? "TRUE" : "FALSE")); return result; } } // namespace transport_adapter diff --git a/src/components/transport_manager/src/usb/libusb/usb_handler.cc b/src/components/transport_manager/src/usb/libusb/usb_handler.cc index 49f92c9773..a6e7df1e17 100644 --- a/src/components/transport_manager/src/usb/libusb/usb_handler.cc +++ b/src/components/transport_manager/src/usb/libusb/usb_handler.cc @@ -46,7 +46,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") class UsbHandler::ControlTransferSequenceState { public: @@ -96,7 +96,7 @@ UsbHandler::~UsbHandler() { libusb_hotplug_deregister_callback(libusb_context_, left_callback_handle_); } thread_->stop(); - LOGGER_INFO(logger_, "UsbHandler thread finished"); + SDL_INFO("UsbHandler thread finished"); if (libusb_context_) { libusb_exit(libusb_context_); libusb_context_ = 0; @@ -107,34 +107,31 @@ UsbHandler::~UsbHandler() { } void UsbHandler::DeviceArrived(libusb_device* device_libusb) { - LOGGER_TRACE(logger_, "enter. libusb_device* " << device_libusb); + SDL_TRACE("enter. libusb_device* " << device_libusb); const uint8_t bus_number = libusb_get_bus_number(device_libusb); const uint8_t device_address = libusb_get_device_address(device_libusb); libusb_device_descriptor descriptor; int libusb_ret = libusb_get_device_descriptor(device_libusb, &descriptor); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_ERROR(logger_, - "libusb_get_device_descriptor failed: " << libusb_ret); - LOGGER_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret"); + SDL_ERROR("libusb_get_device_descriptor failed: " << libusb_ret); + SDL_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret"); return; } libusb_device_handle* device_handle_libusb; libusb_ret = libusb_open(device_libusb, &device_handle_libusb); if (libusb_ret != LIBUSB_SUCCESS) { - LOGGER_ERROR(logger_, - "libusb_open failed: " << libusb_error_name(libusb_ret)); - LOGGER_TRACE(logger_, "exit. Condition: libusb_ret != LIBUSB_SUCCESS"); + SDL_ERROR("libusb_open failed: " << libusb_error_name(libusb_ret)); + SDL_TRACE("exit. Condition: libusb_ret != LIBUSB_SUCCESS"); return; } int configuration; libusb_ret = libusb_get_configuration(device_handle_libusb, &configuration); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_INFO( - logger_, + SDL_INFO( "libusb_get_configuration failed: " << libusb_error_name(libusb_ret)); - LOGGER_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret"); + SDL_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret"); return; } @@ -142,21 +139,19 @@ void UsbHandler::DeviceArrived(libusb_device* device_libusb) { libusb_ret = libusb_set_configuration(device_handle_libusb, kUsbConfiguration); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_INFO( - logger_, + SDL_INFO( "libusb_set_configuration failed: " << libusb_error_name(libusb_ret)); - LOGGER_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret"); + SDL_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret"); return; } } libusb_ret = libusb_claim_interface(device_handle_libusb, 0); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_INFO( - logger_, + SDL_INFO( "libusb_claim_interface failed: " << libusb_error_name(libusb_ret)); CloseDeviceHandle(device_handle_libusb); - LOGGER_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret"); + SDL_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret"); return; } @@ -173,11 +168,11 @@ void UsbHandler::DeviceArrived(libusb_device* device_libusb) { ++it) { (*it)->OnDeviceArrived(device); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void UsbHandler::DeviceLeft(libusb_device* device_libusb) { - LOGGER_TRACE(logger_, "enter. libusb_device* " << device_libusb); + SDL_TRACE("enter. libusb_device* " << device_libusb); PlatformUsbDevice* device = NULL; for (Devices::iterator it = devices_.begin(); it != devices_.end(); ++it) { if ((*it)->GetLibusbDevice() == device_libusb) { @@ -186,7 +181,7 @@ void UsbHandler::DeviceLeft(libusb_device* device_libusb) { } } if (NULL == device) { - LOGGER_TRACE(logger_, "enter. Condition: NULL == device"); + SDL_TRACE("enter. Condition: NULL == device"); return; } @@ -209,19 +204,18 @@ void UsbHandler::DeviceLeft(libusb_device* device_libusb) { CloseDeviceHandle(device->GetLibusbHandle()); } delete device; - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void UsbHandler::StartControlTransferSequence( UsbControlTransferSequence* sequence, PlatformUsbDevice* device) { - LOGGER_TRACE(logger_, - "enter. UsbControlTransferSequence* " - << sequence << "PlatformUsbDevice* " << device); + SDL_TRACE("enter. UsbControlTransferSequence* " + << sequence << "PlatformUsbDevice* " << device); TransferSequences::iterator it = transfer_sequences_.insert( transfer_sequences_.end(), new ControlTransferSequenceState(this, sequence, device)); SubmitControlTransfer(*it); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void UsbHandler::CloseDeviceHandle(libusb_device_handle* device_handle) { @@ -232,15 +226,13 @@ int LIBUSB_CALL ArrivedCallback(libusb_context* context, libusb_device* device, libusb_hotplug_event event, void* data) { - LOGGER_TRACE(logger_, - "enter. libusb device arrived (bus number " - << static_cast<int>(libusb_get_bus_number(device)) - << ", device address " - << static_cast<int>(libusb_get_device_address(device)) - << ")"); + SDL_TRACE("enter. libusb device arrived (bus number " + << static_cast<int>(libusb_get_bus_number(device)) + << ", device address " + << static_cast<int>(libusb_get_device_address(device)) << ")"); UsbHandler* usb_handler = static_cast<UsbHandler*>(data); usb_handler->DeviceArrived(device); - LOGGER_TRACE(logger_, "exit with 0"); + SDL_TRACE("exit with 0"); return 0; } @@ -248,35 +240,33 @@ int LIBUSB_CALL LeftCallback(libusb_context* context, libusb_device* device, libusb_hotplug_event event, void* data) { - LOGGER_TRACE(logger_, - "enter libusb device left (bus number " - << static_cast<int>(libusb_get_bus_number(device)) - << ", device address " - << static_cast<int>(libusb_get_device_address(device)) - << ")"); + SDL_TRACE("enter libusb device left (bus number " + << static_cast<int>(libusb_get_bus_number(device)) + << ", device address " + << static_cast<int>(libusb_get_device_address(device)) << ")"); UsbHandler* usb_handler = static_cast<UsbHandler*>(data); usb_handler->DeviceLeft(device); - LOGGER_TRACE(logger_, "exit with 0"); + SDL_TRACE("exit with 0"); return 0; } TransportAdapter::Error UsbHandler::Init() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); int libusb_ret = libusb_init(&libusb_context_); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_ERROR(logger_, "libusb_init failed: " << libusb_ret); - LOGGER_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: " - "LIBUSB_SUCCESS != libusb_ret"); + SDL_ERROR("libusb_init failed: " << libusb_ret); + SDL_TRACE( + "exit with TransportAdapter::FAIL. Condition: " + "LIBUSB_SUCCESS != libusb_ret"); return TransportAdapter::FAIL; } if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) { - LOGGER_ERROR(logger_, "LIBUSB_CAP_HAS_HOTPLUG not supported"); - LOGGER_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: " - "!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)"); + SDL_ERROR("LIBUSB_CAP_HAS_HOTPLUG not supported"); + SDL_TRACE( + "exit with TransportAdapter::FAIL. Condition: " + "!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)"); return TransportAdapter::FAIL; } @@ -292,11 +282,10 @@ TransportAdapter::Error UsbHandler::Init() { &arrived_callback_handle_); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_ERROR(logger_, - "libusb_hotplug_register_callback failed: " << libusb_ret); - LOGGER_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: " - "LIBUSB_SUCCESS != libusb_ret"); + SDL_ERROR("libusb_hotplug_register_callback failed: " << libusb_ret); + SDL_TRACE( + "exit with TransportAdapter::FAIL. Condition: " + "LIBUSB_SUCCESS != libusb_ret"); return TransportAdapter::FAIL; } @@ -312,24 +301,23 @@ TransportAdapter::Error UsbHandler::Init() { &left_callback_handle_); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_ERROR(logger_, - "libusb_hotplug_register_callback failed: " << libusb_ret); - LOGGER_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: " - "LIBUSB_SUCCESS != libusb_ret"); + SDL_ERROR("libusb_hotplug_register_callback failed: " << libusb_ret); + SDL_TRACE( + "exit with TransportAdapter::FAIL. Condition: " + "LIBUSB_SUCCESS != libusb_ret"); return TransportAdapter::FAIL; } if (!thread_->start()) { - LOGGER_ERROR(logger_, "USB device scanner thread start failed, error code"); - LOGGER_TRACE(logger_, "exit with TransportAdapter::FAIL."); + SDL_ERROR("USB device scanner thread start failed, error code"); + SDL_TRACE("exit with TransportAdapter::FAIL."); return TransportAdapter::FAIL; } return TransportAdapter::OK; } void UsbHandler::Thread() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); int completed = 0; while (!shutdown_requested_) { libusb_handle_events_completed(libusb_context_, &completed); @@ -352,33 +340,32 @@ void UsbHandler::Thread() { libusb_close(*it); } } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void LIBUSB_CALL UsbTransferSequenceCallback(libusb_transfer* transfer) { - LOGGER_TRACE(logger_, "enter. libusb_transfer* " << transfer); + SDL_TRACE("enter. libusb_transfer* " << transfer); UsbHandler::ControlTransferSequenceState* sequence_state = static_cast<UsbHandler::ControlTransferSequenceState*>( transfer->user_data); sequence_state->usb_handler()->ControlTransferCallback(transfer); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void UsbHandler::SubmitControlTransfer( ControlTransferSequenceState* sequence_state) { - LOGGER_TRACE(logger_, - "enter. ControlTransferSequenceState* " << sequence_state); + SDL_TRACE("enter. ControlTransferSequenceState* " << sequence_state); UsbControlTransfer* transfer = sequence_state->CurrentTransfer(); if (NULL == transfer) { - LOGGER_TRACE(logger_, "exit. Condition: NULL == transfer"); + SDL_TRACE("exit. Condition: NULL == transfer"); return; } libusb_transfer* libusb_transfer = libusb_alloc_transfer(0); if (0 == libusb_transfer) { - LOGGER_ERROR(logger_, "libusb_alloc_transfer failed"); + SDL_ERROR("libusb_alloc_transfer failed"); sequence_state->Finish(); - LOGGER_TRACE(logger_, "exit. Condition: 0 == libusb_transfer"); + SDL_TRACE("exit. Condition: 0 == libusb_transfer"); return; } @@ -401,10 +388,10 @@ void UsbHandler::SubmitControlTransfer( unsigned char* buffer = static_cast<unsigned char*>(malloc(length + LIBUSB_CONTROL_SETUP_SIZE)); if (NULL == buffer) { - LOGGER_ERROR(logger_, "buffer allocation failed"); + SDL_ERROR("buffer allocation failed"); libusb_free_transfer(libusb_transfer); sequence_state->Finish(); - LOGGER_TRACE(logger_, "exit. Condition: NULL == buffer"); + SDL_TRACE("exit. Condition: NULL == buffer"); return; } @@ -425,21 +412,20 @@ void UsbHandler::SubmitControlTransfer( const int libusb_ret = libusb_submit_transfer(libusb_transfer); if (LIBUSB_SUCCESS != libusb_ret) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "libusb_submit_transfer failed: " << libusb_error_name(libusb_ret)); libusb_free_transfer(libusb_transfer); sequence_state->Finish(); } - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } void UsbHandler::ControlTransferCallback(libusb_transfer* transfer) { - LOGGER_TRACE(logger_, "enter. libusb_transfer* " << transfer); + SDL_TRACE("enter. libusb_transfer* " << transfer); ControlTransferSequenceState* sequence_state = static_cast<ControlTransferSequenceState*>(transfer->user_data); if (transfer->status == LIBUSB_TRANSFER_COMPLETED) { - LOGGER_INFO(logger_, "USB control transfer completed"); + SDL_INFO("USB control transfer completed"); UsbControlTransfer* current_transfer = sequence_state->CurrentTransfer(); bool submit_next = true; if (current_transfer && @@ -456,11 +442,11 @@ void UsbHandler::ControlTransferCallback(libusb_transfer* transfer) { sequence_state->Finish(); } } else { - LOGGER_ERROR(logger_, "USB control transfer failed: " << transfer->status); + SDL_ERROR("USB control transfer failed: " << transfer->status); sequence_state->Finish(); } libusb_free_transfer(transfer); - LOGGER_TRACE(logger_, "exit"); + SDL_TRACE("exit"); } UsbHandler::ControlTransferSequenceState::ControlTransferSequenceState( @@ -478,23 +464,21 @@ UsbHandler::ControlTransferSequenceState::~ControlTransferSequenceState() { } UsbControlTransfer* UsbHandler::ControlTransferSequenceState::Next() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); if (finished_) { - LOGGER_TRACE(logger_, "exit with NULL. Condition: finished_"); + SDL_TRACE("exit with NULL. Condition: finished_"); return NULL; } if (++current_transfer_ == sequence_->transfers().end()) { Finish(); - LOGGER_TRACE(logger_, - "exit with NULL. Condition: ++current_transfer_ == " - "sequence_->transfers().end()"); + SDL_TRACE( + "exit with NULL. Condition: ++current_transfer_ == " + "sequence_->transfers().end()"); return NULL; } else { - LOGGER_TRACE(logger_, - "exit with UsbControlTransfer* " - << *current_transfer_ - << ".Condition: ++current_transfer_ !== " - "sequence_->transfers().end()"); + SDL_TRACE("exit with UsbControlTransfer* " + << *current_transfer_ << ".Condition: ++current_transfer_ !== " + "sequence_->transfers().end()"); return *current_transfer_; } } @@ -512,7 +496,7 @@ UsbHandler::UsbHandlerDelegate::UsbHandlerDelegate(UsbHandler* handler) : handler_(handler) {} void UsbHandler::UsbHandlerDelegate::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(handler_); handler_->Thread(); } diff --git a/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc b/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc index 28ae779565..6e8c1683dc 100644 --- a/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc +++ b/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc @@ -41,7 +41,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") PlatformUsbDevice::PlatformUsbDevice( usbd_device_instance_t* instance, @@ -58,7 +58,7 @@ PlatformUsbDevice::PlatformUsbDevice( std::string PlatformUsbDevice::GetDescString(uint8_t index) const { char* str = usbd_string(usbd_device_, index, 0); if (NULL == str) { - LOGGER_INFO(logger_, "Failed to get USB string descriptor"); + SDL_INFO("Failed to get USB string descriptor"); return ""; } return std::string(str); diff --git a/src/components/transport_manager/src/usb/qnx/usb_connection.cc b/src/components/transport_manager/src/usb/qnx/usb_connection.cc index 3f3725ea65..5c532d2051 100644 --- a/src/components/transport_manager/src/usb/qnx/usb_connection.cc +++ b/src/components/transport_manager/src/usb/qnx/usb_connection.cc @@ -45,7 +45,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") UsbConnection::UsbConnection(const DeviceUID& device_uid, const ApplicationHandle& app_handle, @@ -81,13 +81,13 @@ UsbConnection::~UsbConnection() { if (in_pipe_) { const int close_pipe_rc = usbd_close_pipe(in_pipe_); if (EOK != close_pipe_rc) { - LOGGER_ERROR(logger_, "Failed to close pipe: " << close_pipe_rc); + SDL_ERROR("Failed to close pipe: " << close_pipe_rc); } } if (out_pipe_) { const int close_pipe_rc = usbd_close_pipe(out_pipe_); if (EOK != close_pipe_rc) { - LOGGER_ERROR(logger_, "Failed to close pipe: " << close_pipe_rc); + SDL_ERROR("Failed to close pipe: " << close_pipe_rc); } } } @@ -107,7 +107,7 @@ bool UsbConnection::PostInTransfer() { usbd_io(in_urb_, in_pipe_, InTransferCallback, this, USBD_TIME_INFINITY); if (EOK != io_rc) { pending_in_transfer_ = false; - LOGGER_ERROR(logger_, "Failed to post in transfer: " << io_rc); + SDL_ERROR("Failed to post in transfer: " << io_rc); return false; } return true; @@ -119,12 +119,11 @@ void UsbConnection::OnInTransfer(usbd_urb* urb) { bool error = false; const int urb_status_rc = usbd_urb_status(urb, &status, &len); if (EOK != urb_status_rc && EIO != urb_status_rc) { // EIO is OK - LOGGER_ERROR(logger_, "Get in urb status failed: " << urb_status_rc); + SDL_ERROR("Get in urb status failed: " << urb_status_rc); error = true; } - LOGGER_INFO(logger_, - "USB in transfer, status " << std::hex << status << ", length " - << std::dec << len); + SDL_INFO("USB in transfer, status " << std::hex << status << ", length " + << std::dec << len); if (!error) { switch (status) { @@ -139,7 +138,7 @@ void UsbConnection::OnInTransfer(usbd_urb* urb) { } if (error) { - LOGGER_ERROR(logger_, "USB in transfer failed"); + SDL_ERROR("USB in transfer failed"); controller_->DataReceiveFailed( device_uid_, app_handle_, DataReceiveError()); } else { @@ -173,14 +172,14 @@ bool UsbConnection::PostOutTransfer() { out_buffer_ = usbd_alloc(len); memmove(out_buffer_, current_out_message_->data() + bytes_sent_, len); usbd_setup_bulk(out_urb_, URB_DIR_OUT, out_buffer_, len); - LOGGER_INFO(logger_, "out transfer :" << len); + SDL_INFO("out transfer :" << len); pending_out_transfer_ = true; const int io_rc = usbd_io( out_urb_, out_pipe_, OutTransferCallback, this, USBD_TIME_INFINITY); if (EOK != io_rc) { pending_out_transfer_ = false; usbd_free(out_buffer_); - LOGGER_ERROR(logger_, "Failed to post out transfer: " << io_rc); + SDL_ERROR("Failed to post out transfer: " << io_rc); return false; } return true; @@ -193,12 +192,11 @@ void UsbConnection::OnOutTransfer(usbd_urb* urb) { bool error = false; const int urb_status_rc = usbd_urb_status(urb, &status, &len); if (EOK != urb_status_rc && EIO != urb_status_rc) { // EIO is OK - LOGGER_ERROR(logger_, "Get out urb status failed: " << urb_status_rc); + SDL_ERROR("Get out urb status failed: " << urb_status_rc); error = true; } - LOGGER_INFO(logger_, - "USB out transfer, status " << std::hex << status << ", length " - << std::dec << len); + SDL_INFO("USB out transfer, status " << std::hex << status << ", length " + << std::dec << len); if (!error) { switch (status) { @@ -215,16 +213,14 @@ void UsbConnection::OnOutTransfer(usbd_urb* urb) { sync_primitives::AutoLock locker(out_messages_mutex_); if (error) { - LOGGER_ERROR(logger_, "USB out transfer failed"); + SDL_ERROR("USB out transfer failed"); controller_->DataSendFailed( device_uid_, app_handle_, current_out_message_, DataSendError()); PopOutMessage(); } else { bytes_sent_ += len; if (bytes_sent_ == current_out_message_->data_size()) { - LOGGER_INFO( - logger_, - "USB out transfer, data sent: " << current_out_message_.get()); + SDL_INFO("USB out transfer, data sent: " << current_out_message_.get()); controller_->DataSendDone(device_uid_, app_handle_, current_out_message_); PopOutMessage(); } @@ -256,7 +252,7 @@ TransportAdapter::Error UsbConnection::SendData( } void UsbConnection::Finalise() { - LOGGER_INFO(logger_, "Finalising"); + SDL_INFO("Finalising"); sync_primitives::AutoLock locker(out_messages_mutex_); disconnecting_ = true; usbd_abort_pipe(in_pipe_); @@ -272,7 +268,7 @@ void UsbConnection::Finalise() { } TransportAdapter::Error UsbConnection::Disconnect() { - LOGGER_INFO(logger_, "Disconnecting"); + SDL_INFO("Disconnecting"); Finalise(); controller_->DisconnectDone(device_uid_, app_handle_); return TransportAdapter::OK; @@ -285,13 +281,13 @@ bool UsbConnection::Init() { in_urb_ = usbd_alloc_urb(NULL); out_urb_ = usbd_alloc_urb(NULL); if (NULL == in_urb_ || NULL == out_urb_) { - LOGGER_ERROR(logger_, "usbd_alloc_urb failed"); + SDL_ERROR("usbd_alloc_urb failed"); return false; } in_buffer_ = static_cast<unsigned char*>(usbd_alloc(kInBufferSize)); if (NULL == in_buffer_) { - LOGGER_ERROR(logger_, "usbd_alloc failed"); + SDL_ERROR("usbd_alloc failed"); return false; } @@ -314,7 +310,7 @@ bool UsbConnection::OpenEndpoints() { usbd_device_descriptor_t* device_desc = usbd_device_descriptor(usbd_device_, &device_desc_node); if (0 == device_desc) { - LOGGER_ERROR(logger_, "Device descriptor not found"); + SDL_ERROR("Device descriptor not found"); return false; } usbd_desc_node* cfg_desc_node = NULL; @@ -331,9 +327,8 @@ bool UsbConnection::OpenEndpoints() { if (config_desc == NULL) { break; } - LOGGER_INFO(logger_, - "USB configuration " << static_cast<int>( - config_desc->configuration.bConfigurationValue)); + SDL_INFO("USB configuration " << static_cast<int>( + config_desc->configuration.bConfigurationValue)); int iface = 0; usbd_desc_node* iface_desc_node; while (!found) { @@ -350,11 +345,9 @@ bool UsbConnection::OpenEndpoints() { #endif const uint8_t interface_subclass = iface_desc->interface.bInterfaceSubClass; - LOGGER_INFO(logger_, - "USB interface number " - << static_cast<int>(interface_number) << ", subclass " - << std::hex << static_cast<int>(interface_subclass) - << std::dec); + SDL_INFO("USB interface number " + << static_cast<int>(interface_number) << ", subclass " + << std::hex << static_cast<int>(interface_subclass) << std::dec); if (interface_subclass != 0xff) { continue; } @@ -370,10 +363,9 @@ bool UsbConnection::OpenEndpoints() { if ((attributes & 0x03) == USB_ATTRIB_BULK) { const uint8_t endpoint_address = endpoint_desc->endpoint.bEndpointAddress; - LOGGER_INFO(logger_, - "Endpoint with address " - << std::hex << static_cast<int>(endpoint_address) - << std::dec << " found"); + SDL_INFO("Endpoint with address " + << std::hex << static_cast<int>(endpoint_address) << std::dec + << " found"); if (endpoint_address & USB_ENDPOINT_IN) { if (NULL == in_endpoint_desc) { in_endpoint_desc = endpoint_desc; @@ -396,13 +388,13 @@ bool UsbConnection::OpenEndpoints() { int open_pipe_rc = usbd_open_pipe(usbd_device_, in_endpoint_desc, &in_pipe_); if (EOK != open_pipe_rc) { - LOGGER_ERROR(logger_, "Cannot open input pipe, error " << open_pipe_rc); + SDL_ERROR("Cannot open input pipe, error " << open_pipe_rc); return false; } open_pipe_rc = usbd_open_pipe(usbd_device_, out_endpoint_desc, &out_pipe_); if (EOK != open_pipe_rc) { - LOGGER_ERROR(logger_, "Cannot open output pipe, error " << open_pipe_rc); + SDL_ERROR("Cannot open output pipe, error " << open_pipe_rc); return false; } diff --git a/src/components/transport_manager/src/usb/qnx/usb_handler.cc b/src/components/transport_manager/src/usb/qnx/usb_handler.cc index f36a55bdd9..b2a0ee1699 100644 --- a/src/components/transport_manager/src/usb/qnx/usb_handler.cc +++ b/src/components/transport_manager/src/usb/qnx/usb_handler.cc @@ -46,7 +46,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") namespace { UsbHandler* usb_handler; @@ -65,15 +65,13 @@ UsbHandler::~UsbHandler() { if (usbd_general_connection_) { const int disconnect_rc = usbd_disconnect(usbd_general_connection_); if (EOK != disconnect_rc) { - LOGGER_ERROR(logger_, - "usbd_disconnect failed, error code " << disconnect_rc); + SDL_ERROR("usbd_disconnect failed, error code " << disconnect_rc); } } if (usbd_aoa_connection_) { const int disconnect_rc = usbd_disconnect(usbd_aoa_connection_); if (EOK != disconnect_rc) { - LOGGER_ERROR(logger_, - "usbd_disconnect failed, error code " << disconnect_rc); + SDL_ERROR("usbd_disconnect failed, error code " << disconnect_rc); } } } @@ -93,7 +91,7 @@ void UsbHandler::DeviceArrived(usbd_connection* connection, usbd_device* device_usbd = 0; const int attach_rc = usbd_attach(connection, instance, 0, &device_usbd); if (EOK != attach_rc) { - LOGGER_ERROR(logger_, "usbd_attach failed: " << attach_rc); + SDL_ERROR("usbd_attach failed: " << attach_rc); return; } @@ -101,7 +99,7 @@ void UsbHandler::DeviceArrived(usbd_connection* connection, usbd_device_descriptor_t* descriptor = usbd_device_descriptor(device_usbd, &node); if (NULL == descriptor) { - LOGGER_ERROR(logger_, "usbd_device_descriptor failed"); + SDL_ERROR("usbd_device_descriptor failed"); return; } @@ -139,7 +137,7 @@ void UsbHandler::DeviceLeft(usbd_device_instance_t* instance) { if ((*it)->GetDeviceInstance() == *instance) { const int detach_rc = usbd_detach((*it)->GetUsbdDevice()); if (EOK != detach_rc) - LOGGER_ERROR(logger_, "usbd_detach failed: " << detach_rc); + SDL_ERROR("usbd_detach failed: " << detach_rc); devices_.erase(it); break; } @@ -153,14 +151,14 @@ void UsbHandler::StartControlTransferSequence( usbd_descriptors_t* descriptor = usbd_parse_descriptors( device->GetUsbdDevice(), NULL, USB_DESC_DEVICE, 0, NULL); if (NULL == descriptor) { - LOGGER_ERROR(logger_, "usbd_parse_descriptors failed"); + SDL_ERROR("usbd_parse_descriptors failed"); } usbd_pipe* usb_pipe = 0; const int open_pipe_rc = usbd_open_pipe(device->GetUsbdDevice(), descriptor, &usb_pipe); if (EOK != open_pipe_rc) { - LOGGER_ERROR(logger_, "usbd_open_pipe failed, error " << open_pipe_rc); + SDL_ERROR("usbd_open_pipe failed, error " << open_pipe_rc); return; } @@ -172,14 +170,14 @@ void UsbHandler::StartControlTransferSequence( usbd_urb* urb = usbd_alloc_urb(NULL); if (NULL == urb) { - LOGGER_ERROR(logger_, "usbd_alloc_urb failed"); + SDL_ERROR("usbd_alloc_urb failed"); break; } unsigned char* buf = static_cast<unsigned char*>(usbd_alloc(transfer->Length())); if (NULL == buf) { - LOGGER_ERROR(logger_, "usbd_alloc failed"); + SDL_ERROR("usbd_alloc failed"); break; } @@ -216,7 +214,7 @@ void UsbHandler::StartControlTransferSequence( static_cast<UsbControlInTransfer*>(transfer)->OnCompleted(buf); } } else { - LOGGER_ERROR(logger_, "usbd_io failed, error " << io_rc); + SDL_ERROR("usbd_io failed, error " << io_rc); submit_next = false; } usbd_free(buf); @@ -233,12 +231,11 @@ void ArrivedCallback(usbd_connection* connection, usbd_device_instance_t* instance) { if (kAoaVid == instance->ident.vendor) return; - LOGGER_INFO(logger_, - "USB device arrived (path " - << static_cast<int>(instance->path) << ", devno " - << static_cast<int>(instance->devno) << ", config " - << static_cast<int>(instance->config) << ", iface " - << static_cast<int>(instance->iface) << ")"); + SDL_INFO("USB device arrived (path " + << static_cast<int>(instance->path) << ", devno " + << static_cast<int>(instance->devno) << ", config " + << static_cast<int>(instance->config) << ", iface " + << static_cast<int>(instance->iface) << ")"); usb_handler->DeviceArrived(connection, instance); } @@ -246,12 +243,11 @@ void ArrivedAoaCallback(usbd_connection* connection, usbd_device_instance_t* instance) { if (kAoaVid != instance->ident.vendor) return; - LOGGER_INFO(logger_, - "USB AOA device arrived (path " - << static_cast<int>(instance->path) << ", devno " - << static_cast<int>(instance->devno) << ", config " - << static_cast<int>(instance->config) << ", iface " - << static_cast<int>(instance->iface) << ")"); + SDL_INFO("USB AOA device arrived (path " + << static_cast<int>(instance->path) << ", devno " + << static_cast<int>(instance->devno) << ", config " + << static_cast<int>(instance->config) << ", iface " + << static_cast<int>(instance->iface) << ")"); usb_handler->DeviceArrived(connection, instance); } @@ -259,12 +255,11 @@ void LeftCallback(usbd_connection* connection, usbd_device_instance_t* instance) { if (kAoaVid == instance->ident.vendor) return; - LOGGER_INFO(logger_, - "USB device left (path " - << static_cast<int>(instance->path) << ", devno " - << static_cast<int>(instance->devno) << ", config " - << static_cast<int>(instance->config) << ", iface " - << static_cast<int>(instance->iface) << ")"); + SDL_INFO("USB device left (path " + << static_cast<int>(instance->path) << ", devno " + << static_cast<int>(instance->devno) << ", config " + << static_cast<int>(instance->config) << ", iface " + << static_cast<int>(instance->iface) << ")"); usb_handler->DeviceLeft(instance); } @@ -272,12 +267,11 @@ void LeftAoaCallback(usbd_connection* connection, usbd_device_instance_t* instance) { if (kAoaVid != instance->ident.vendor) return; - LOGGER_INFO(logger_, - "USB AOA device left (path " - << static_cast<int>(instance->path) << ", devno " - << static_cast<int>(instance->devno) << ", config " - << static_cast<int>(instance->config) << ", iface " - << static_cast<int>(instance->iface) << ")"); + SDL_INFO("USB AOA device left (path " + << static_cast<int>(instance->path) << ", devno " + << static_cast<int>(instance->devno) << ", config " + << static_cast<int>(instance->config) << ", iface " + << static_cast<int>(instance->iface) << ")"); usb_handler->DeviceLeft(instance); } @@ -295,7 +289,7 @@ TransportAdapter::Error UsbHandler::Init() { const int connect_rc = usbd_connect(&cparms, &usbd_general_connection_); if (EOK != connect_rc) { - LOGGER_ERROR(logger_, "usbd_connect failed, error code " << connect_rc); + SDL_ERROR("usbd_connect failed, error code " << connect_rc); return TransportAdapter::FAIL; } } @@ -313,7 +307,7 @@ TransportAdapter::Error UsbHandler::Init() { const int connect_rc = usbd_connect(&cparms, &usbd_aoa_connection_); if (EOK != connect_rc) { - LOGGER_ERROR(logger_, "usbd_connect failed, error code " << connect_rc); + SDL_ERROR("usbd_connect failed, error code " << connect_rc); return TransportAdapter::FAIL; } } diff --git a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc index ed65894094..b05563b58a 100644 --- a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc +++ b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc @@ -42,7 +42,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOGGER("TransportManager") UsbAoaAdapter::UsbAoaAdapter(resumption::LastState& last_state, const TransportManagerSettings& settings) : TransportAdapterImpl(new UsbDeviceScanner(this), @@ -68,23 +68,21 @@ bool UsbAoaAdapter::IsInitialised() const { } TransportAdapter::Error UsbAoaAdapter::Init() { - LOGGER_TRACE(logger_, "enter"); + SDL_TRACE("enter"); TransportAdapter::Error error = usb_handler_->Init(); if (error != TransportAdapter::OK) { - LOGGER_TRACE(logger_, - "exit with error " - << error << ". Condition: error != TransportAdapter::OK"); + SDL_TRACE("exit with error " + << error << ". Condition: error != TransportAdapter::OK"); return error; } error = TransportAdapterImpl::Init(); if (error != TransportAdapter::OK) { - LOGGER_TRACE(logger_, - "exit with error " - << error << ". Condition: error != TransportAdapter::OK"); + SDL_TRACE("exit with error " + << error << ". Condition: error != TransportAdapter::OK"); return error; } is_initialised_ = true; - LOGGER_TRACE(logger_, "exit with TransportAdapter::OK"); + SDL_TRACE("exit with TransportAdapter::OK"); return TransportAdapter::OK; } diff --git a/src/components/transport_manager/src/usb/usb_connection_factory.cc b/src/components/transport_manager/src/usb/usb_connection_factory.cc index de35d23ddc..3cc79aa93b 100644 --- a/src/components/transport_manager/src/usb/usb_connection_factory.cc +++ b/src/components/transport_manager/src/usb/usb_connection_factory.cc @@ -44,7 +44,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "UsbConnectionFactory") +SDL_CREATE_LOGGER("UsbConnectionFactory") UsbConnectionFactory::UsbConnectionFactory( TransportAdapterController* controller) @@ -60,14 +60,12 @@ void UsbConnectionFactory::SetUsbHandler(const UsbHandlerSptr usb_handler) { TransportAdapter::Error UsbConnectionFactory::CreateConnection( const DeviceUID& device_uid, const ApplicationHandle& app_handle) { - LOGGER_TRACE(logger_, - "enter DeviceUID: " << &device_uid - << ", ApplicationHandle: " << &app_handle); + SDL_TRACE("enter DeviceUID: " << &device_uid + << ", ApplicationHandle: " << &app_handle); DeviceSptr device = controller_->FindDevice(device_uid); if (!device.valid()) { - LOGGER_ERROR(logger_, "device " << device_uid << " not found"); - LOGGER_TRACE( - logger_, + SDL_ERROR("device " << device_uid << " not found"); + SDL_TRACE( "exit with TransportAdapter::BAD_PARAM. Condition: !device.valid()"); return TransportAdapter::BAD_PARAM; } @@ -82,15 +80,15 @@ TransportAdapter::Error UsbConnectionFactory::CreateConnection( controller_->ConnectionCreated(usb_connection, device_uid, app_handle); if (usb_connection->Init()) { - LOGGER_INFO(logger_, "USB connection initialised"); - LOGGER_TRACE(logger_, - "exit with TransportAdapter::OK. Condition: USB connection " - "initialised"); + SDL_INFO("USB connection initialised"); + SDL_TRACE( + "exit with TransportAdapter::OK. Condition: USB connection " + "initialised"); return TransportAdapter::OK; } else { - LOGGER_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: USB connection " - "NOT initialised"); + SDL_TRACE( + "exit with TransportAdapter::FAIL. Condition: USB connection " + "NOT initialised"); return TransportAdapter::FAIL; } } diff --git a/src/components/transport_manager/src/usb/usb_device_scanner.cc b/src/components/transport_manager/src/usb/usb_device_scanner.cc index 6a6200ecaf..79f2ce684e 100644 --- a/src/components/transport_manager/src/usb/usb_device_scanner.cc +++ b/src/components/transport_manager/src/usb/usb_device_scanner.cc @@ -42,7 +42,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "UsbDeviceScanner") +SDL_CREATE_LOGGER("UsbDeviceScanner") class AoaInitSequence : public UsbControlTransferSequence { public: @@ -56,7 +56,7 @@ class AoaInitSequence : public UsbControlTransferSequence { }; void UsbDeviceScanner::OnDeviceArrived(PlatformUsbDevice* device) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (IsAppleDevice(device)) { SupportedDeviceFound(device); } else { @@ -69,8 +69,8 @@ void UsbDeviceScanner::OnDeviceArrived(PlatformUsbDevice* device) { } void UsbDeviceScanner::OnDeviceLeft(PlatformUsbDevice* device) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "PlatformUsbDevice " << device); + SDL_AUTO_TRACE(); + SDL_DEBUG("PlatformUsbDevice " << device); bool list_changed = false; devices_mutex_.Acquire(); for (Devices::iterator it = devices_.begin(); it != devices_.end(); ++it) { @@ -110,7 +110,7 @@ class AoaInitSequence::AoaGetProtocolRequest : public UsbControlInTransfer { } virtual bool OnCompleted(unsigned char* data) const { const int protocol_version = data[1] << 8 | data[0]; - LOGGER_DEBUG(logger_, "AOA protocol version " << protocol_version); + SDL_DEBUG("AOA protocol version " << protocol_version); if (protocol_version == 0) { // AOA protocol not supported return false; @@ -190,25 +190,23 @@ AoaInitSequence::AoaInitSequence() : UsbControlTransferSequence() { } void UsbDeviceScanner::TurnIntoAccessoryMode(PlatformUsbDevice* device) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "PlatformUsbDevice: " << device); + SDL_AUTO_TRACE(); + SDL_DEBUG("PlatformUsbDevice: " << device); GetUsbHandler()->StartControlTransferSequence(new AoaInitSequence, device); } void UsbDeviceScanner::SupportedDeviceFound(PlatformUsbDevice* device) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_TRACE(logger_, "PlatformUsbDevice: " << device); + SDL_AUTO_TRACE(); + SDL_TRACE("PlatformUsbDevice: " << device); devices_mutex_.Acquire(); devices_.push_back(device); devices_mutex_.Release(); - LOGGER_DEBUG(logger_, - "USB device (bus number " - << static_cast<int>(device->bus_number()) << ", address " - << static_cast<int>(device->address()) - << ") identified as: " << device->GetManufacturer() << ", " - << device->GetProductName() - << ", serial: " << device->GetSerialNumber()); + SDL_DEBUG("USB device (bus number " + << static_cast<int>(device->bus_number()) << ", address " + << static_cast<int>(device->address()) << ") identified as: " + << device->GetManufacturer() << ", " << device->GetProductName() + << ", serial: " << device->GetSerialNumber()); UpdateList(); } @@ -221,7 +219,7 @@ TransportAdapter::Error UsbDeviceScanner::Scan() { } void UsbDeviceScanner::UpdateList() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DeviceVector device_vector; devices_mutex_.Acquire(); for (Devices::const_iterator it = devices_.begin(); it != devices_.end(); @@ -237,7 +235,7 @@ void UsbDeviceScanner::UpdateList() { } devices_mutex_.Release(); - LOGGER_DEBUG(logger_, "USB search done " << device_vector.size()); + SDL_DEBUG("USB search done " << device_vector.size()); controller_->SearchDeviceDone(device_vector); } diff --git a/src/components/utils/src/conditional_variable_posix.cc b/src/components/utils/src/conditional_variable_posix.cc index f048861d38..38b1815844 100644 --- a/src/components/utils/src/conditional_variable_posix.cc +++ b/src/components/utils/src/conditional_variable_posix.cc @@ -46,26 +46,26 @@ const uint64_t kNanosecondsPerMillisecond = 1000000; namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") ConditionalVariable::ConditionalVariable() { pthread_condattr_t attrs; int initialized = pthread_condattr_init(&attrs); if (initialized != 0) - LOGGER_ERROR(logger_, - "Failed to initialize " - "conditional variable attributes"); + SDL_ERROR( + "Failed to initialize " + "conditional variable attributes"); pthread_condattr_setclock(&attrs, CLOCK_MONOTONIC); initialized = pthread_cond_init(&cond_var_, &attrs); if (initialized != 0) - LOGGER_ERROR(logger_, - "Failed to initialize " - "conditional variable"); + SDL_ERROR( + "Failed to initialize " + "conditional variable"); int rv = pthread_condattr_destroy(&attrs); if (rv != 0) - LOGGER_ERROR(logger_, - "Failed to destroy " - "conditional variable attributes"); + SDL_ERROR( + "Failed to destroy " + "conditional variable attributes"); } ConditionalVariable::~ConditionalVariable() { @@ -75,14 +75,14 @@ ConditionalVariable::~ConditionalVariable() { void ConditionalVariable::NotifyOne() { int signaled = pthread_cond_signal(&cond_var_); if (signaled != 0) { - LOGGER_ERROR(logger_, "Failed to signal conditional variable"); + SDL_ERROR("Failed to signal conditional variable"); } } void ConditionalVariable::Broadcast() { int signaled = pthread_cond_broadcast(&cond_var_); if (signaled != 0) - LOGGER_ERROR(logger_, "Failed to broadcast conditional variable"); + SDL_ERROR("Failed to broadcast conditional variable"); } bool ConditionalVariable::Wait(Lock& lock) { @@ -95,7 +95,7 @@ bool ConditionalVariable::Wait(Lock& lock) { int wait_status = pthread_cond_wait(&cond_var_, &lock.mutex_); lock.AssertFreeAndMarkTaken(); if (wait_status != 0) { - LOGGER_ERROR(logger_, "Failed to wait for conditional variable"); + SDL_ERROR("Failed to wait for conditional variable"); return false; } return true; @@ -141,10 +141,8 @@ ConditionalVariable::WaitStatus ConditionalVariable::WaitFor( break; } default: { - LOGGER_ERROR( - logger_, - "Failed to timewait for conditional variable timedwait_status: " - << timedwait_status); + SDL_ERROR("Failed to timewait for conditional variable timedwait_status: " + << timedwait_status); } } return wait_status; diff --git a/src/components/utils/src/conditional_variable_qt.cc b/src/components/utils/src/conditional_variable_qt.cc index e0bf281a2b..109430aa21 100644 --- a/src/components/utils/src/conditional_variable_qt.cc +++ b/src/components/utils/src/conditional_variable_qt.cc @@ -37,7 +37,7 @@ namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") ConditionalVariable::ConditionalVariable() : cond_var_() {} @@ -61,7 +61,7 @@ bool ConditionalVariable::Wait(Lock& lock) { const bool wait_status = cond_var_.wait(lock.mutex_); lock.AssertFreeAndMarkTaken(); if (!wait_status) { - LOGGER_ERROR(logger_, "Failed to wait for conditional variable"); + SDL_ERROR("Failed to wait for conditional variable"); return false; } return true; diff --git a/src/components/utils/src/conditional_variable_win.cc b/src/components/utils/src/conditional_variable_win.cc index 23ce16c9d5..9e399c1db6 100644 --- a/src/components/utils/src/conditional_variable_win.cc +++ b/src/components/utils/src/conditional_variable_win.cc @@ -38,7 +38,7 @@ namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") ConditionalVariable::ConditionalVariable() { InitializeConditionVariable(&cond_var_); @@ -65,7 +65,7 @@ bool ConditionalVariable::Wait(Lock& lock) { SleepConditionVariableCS(&cond_var_, &lock.mutex_, INFINITE); lock.AssertFreeAndMarkTaken(); if (wait_status == 0) { - LOGGER_ERROR(logger_, "Failed to wait for conditional variable"); + SDL_ERROR("Failed to wait for conditional variable"); return false; } return true; diff --git a/src/components/utils/src/lock_posix.cc b/src/components/utils/src/lock_posix.cc index cd414495fc..ef6ad2a9aa 100644 --- a/src/components/utils/src/lock_posix.cc +++ b/src/components/utils/src/lock_posix.cc @@ -39,7 +39,7 @@ namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") Lock::Lock() #ifndef NDEBUG @@ -62,23 +62,21 @@ Lock::Lock(bool is_recursive) Lock::~Lock() { #ifndef NDEBUG if (lock_taken_ > 0) { - LOGGER_ERROR(logger_, "Destroying non-released mutex " << &mutex_); + SDL_ERROR("Destroying non-released mutex " << &mutex_); } #endif int32_t status = pthread_mutex_destroy(&mutex_); if (status != 0) { - LOGGER_ERROR(logger_, - "Failed to destroy mutex " << &mutex_ << ": " - << strerror(status)); + SDL_ERROR("Failed to destroy mutex " << &mutex_ << ": " + << strerror(status)); } } void Lock::Acquire() { const int32_t status = pthread_mutex_lock(&mutex_); if (status != 0) { - LOGGER_FATAL(logger_, - "Failed to acquire mutex " << &mutex_ << ": " - << strerror(status)); + SDL_FATAL("Failed to acquire mutex " << &mutex_ << ": " + << strerror(status)); DCHECK(status != 0); } else { AssertFreeAndMarkTaken(); @@ -89,9 +87,7 @@ void Lock::Release() { AssertTakenAndMarkFree(); const int32_t status = pthread_mutex_unlock(&mutex_); if (status != 0) { - LOGGER_ERROR(logger_, - "Failed to unlock mutex" << &mutex_ << ": " - << strerror(status)); + SDL_ERROR("Failed to unlock mutex" << &mutex_ << ": " << strerror(status)); } } @@ -111,14 +107,14 @@ bool Lock::Try() { #ifndef NDEBUG void Lock::AssertFreeAndMarkTaken() { if ((lock_taken_ > 0) && !is_mutex_recursive_) { - LOGGER_ERROR(logger_, "Locking already taken not recursive mutex"); + SDL_ERROR("Locking already taken not recursive mutex"); NOTREACHED(); } lock_taken_++; } void Lock::AssertTakenAndMarkFree() { if (lock_taken_ == 0) { - LOGGER_ERROR(logger_, "Unlocking a mutex that is not taken"); + SDL_ERROR("Unlocking a mutex that is not taken"); NOTREACHED(); } lock_taken_--; @@ -138,8 +134,7 @@ void Lock::Init(bool is_recursive) { pthread_mutexattr_destroy(&attr); if (status != 0) { - LOGGER_FATAL(logger_, - "Failed to initialize mutex. " << std::strerror(status)); + SDL_FATAL("Failed to initialize mutex. " << std::strerror(status)); DCHECK(status != 0); } } diff --git a/src/components/utils/src/lock_qt.cc b/src/components/utils/src/lock_qt.cc index 5f82f8d52d..8501fad55a 100644 --- a/src/components/utils/src/lock_qt.cc +++ b/src/components/utils/src/lock_qt.cc @@ -35,7 +35,7 @@ namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") Lock::Lock() #ifndef NDEBUG @@ -58,7 +58,7 @@ Lock::Lock(bool is_recursive) Lock::~Lock() { #ifndef NDEBUG if (0 < lock_taken_) { - LOGGER_ERROR(logger_, "Destroying non-released mutex " << &mutex_); + SDL_ERROR("Destroying non-released mutex " << &mutex_); } #endif delete mutex_; diff --git a/src/components/utils/src/lock_win.cc b/src/components/utils/src/lock_win.cc index 811a89abf1..d006437906 100644 --- a/src/components/utils/src/lock_win.cc +++ b/src/components/utils/src/lock_win.cc @@ -36,7 +36,7 @@ namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") Lock::Lock() #ifndef NDEBUG @@ -59,7 +59,7 @@ Lock::Lock(bool is_recursive) Lock::~Lock() { #ifndef NDEBUG if (lock_taken_ > 0) { - LOGGER_ERROR(logger_, "Destroying non-released mutex " << &mutex_); + SDL_ERROR("Destroying non-released mutex " << &mutex_); } #endif DeleteCriticalSection(&mutex_); @@ -91,14 +91,14 @@ bool Lock::Try() { #ifndef NDEBUG void Lock::AssertFreeAndMarkTaken() { if ((lock_taken_ > 0) && !is_mutex_recursive_) { - LOGGER_ERROR(logger_, "Locking already taken not recursive mutex"); + SDL_ERROR("Locking already taken not recursive mutex"); NOTREACHED(); } lock_taken_++; } void Lock::AssertTakenAndMarkFree() { if (lock_taken_ == 0) { - LOGGER_ERROR(logger_, "Unlocking a mutex that is not taken"); + SDL_ERROR("Unlocking a mutex that is not taken"); NOTREACHED(); } lock_taken_--; diff --git a/src/components/utils/src/logger_posix.cc b/src/components/utils/src/logger_posix.cc index bd675cc087..32b7adec51 100644 --- a/src/components/utils/src/logger_posix.cc +++ b/src/components/utils/src/logger_posix.cc @@ -101,8 +101,8 @@ bool logger::Logger::Impl::InitLogger(const bool logs_enabled, } void logger::Logger::Impl::DeinitLogger() { - CREATE_LOGGERPTR_LOCAL(logger_, "Logger"); - LOGGER_DEBUG(logger_, "Logger deinitialization"); + SDL_CREATE_LOGGER("Logger"); + SDL_DEBUG("Logger deinitialization"); set_logs_enabled(false); set_log_level(LogLevel::LL_TRACE); diff --git a/src/components/utils/src/logger_qt.cc b/src/components/utils/src/logger_qt.cc index b2bcba40c6..add35c5685 100644 --- a/src/components/utils/src/logger_qt.cc +++ b/src/components/utils/src/logger_qt.cc @@ -133,8 +133,8 @@ bool logger::Logger::Impl::InitLogger(const bool logs_enabled, } void logger::Logger::Impl::DeinitLogger() { - CREATE_LOGGERPTR_LOCAL(logger_, "Logger"); - LOGGER_DEBUG(logger_, "Logger deinitialization"); + SDL_CREATE_LOGGER("Logger"); + SDL_DEBUG("Logger deinitialization"); set_logs_enabled(false); set_log_level(LogLevel::LL_TRACE); diff --git a/src/components/utils/src/logger_win.cc b/src/components/utils/src/logger_win.cc index f75113bcd6..5266809202 100644 --- a/src/components/utils/src/logger_win.cc +++ b/src/components/utils/src/logger_win.cc @@ -36,6 +36,7 @@ #include <stdio.h> logger::Logger::Pimpl logger::Logger::impl_; +logger::LoggerType logger::Logger::logger_; //////////////////////////////////////////////////////////////////////////////// /// logger::Logger::Impl @@ -108,8 +109,8 @@ bool logger::Logger::Impl::InitLogger(const bool logs_enabled, } void logger::Logger::Impl::DeinitLogger() { - CREATE_LOGGERPTR_LOCAL(logger_, "Logger"); - LOGGER_DEBUG(logger_, "Logger deinitialization"); + SDL_CREATE_LOGGER("Logger"); + SDL_DEBUG("Logger deinitialization"); set_logs_enabled(false); set_log_level(LogLevel::LL_TRACE); diff --git a/src/components/utils/src/pipe_posix.cc b/src/components/utils/src/pipe_posix.cc index 522a8aa550..f55fbcb013 100644 --- a/src/components/utils/src/pipe_posix.cc +++ b/src/components/utils/src/pipe_posix.cc @@ -41,7 +41,7 @@ #include "utils/pimpl_impl.h" #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_ptr, "Utils") +SDL_CREATE_LOGGER("Utils") namespace utils { @@ -79,19 +79,19 @@ utils::Pipe::Impl::~Impl() { bool utils::Pipe::Impl::Open() { if (IsOpen()) { - LOGGER_WARN(logger_ptr, "Named pipe: " << name_ << " is already opened"); + SDL_WARN("Named pipe: " << name_ << " is already opened"); return true; } handle_ = mkfifo(name_.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (-1 == handle_) { handle_ = 0; - LOGGER_ERROR(logger_ptr, "Cannot create named pipe: " << name_); + SDL_ERROR("Cannot create named pipe: " << name_); return false; } if (-1 == open(name_.c_str(), O_RDWR, 0)) { unlink(name_.c_str()); handle_ = 0; - LOGGER_ERROR(logger_ptr, "Cannot connect to named pipe: " << name_); + SDL_ERROR("Cannot connect to named pipe: " << name_); return false; } return true; @@ -99,14 +99,14 @@ bool utils::Pipe::Impl::Open() { void utils::Pipe::Impl::Close() { if (!IsOpen()) { - LOGGER_WARN(logger_ptr, "Named pipe: " << name_ << " is not opened"); + SDL_WARN("Named pipe: " << name_ << " is not opened"); return; } if (-1 == close(handle_)) { - LOGGER_WARN(logger_ptr, "Cannot disconnect from named pipe: " << name_); + SDL_WARN("Cannot disconnect from named pipe: " << name_); } if (-1 == unlink(name_.c_str())) { - LOGGER_WARN(logger_ptr, "Cannot delete named pipe: " << name_); + SDL_WARN("Cannot delete named pipe: " << name_); } handle_ = 0; } @@ -120,17 +120,17 @@ bool utils::Pipe::Impl::Write(const uint8_t* buffer, size_t& bytes_written) { bytes_written = 0; if (!IsOpen()) { - LOGGER_ERROR(logger_ptr, "Named pipe: " << name_ << " is not opened"); + SDL_ERROR("Named pipe: " << name_ << " is not opened"); return false; } if (bytes_to_write == 0) { - LOGGER_WARN(logger_ptr, "Trying to write 0 bytes"); + SDL_WARN("Trying to write 0 bytes"); return true; } const ssize_t written = write(handle_, static_cast<const void*>(buffer), bytes_to_write); if (-1 == written) { - LOGGER_ERROR(logger_ptr, "Cannot write to named pipe: " << name_); + SDL_ERROR("Cannot write to named pipe: " << name_); return false; } bytes_written = static_cast<size_t>(written); diff --git a/src/components/utils/src/pipe_qt.cc b/src/components/utils/src/pipe_qt.cc index 58ea83aaab..1975c11652 100644 --- a/src/components/utils/src/pipe_qt.cc +++ b/src/components/utils/src/pipe_qt.cc @@ -40,7 +40,7 @@ #include "utils/logger.h" #include "utils/file_system.h" -CREATE_LOGGERPTR_GLOBAL(logger_ptr, "Utils") +SDL_CREATE_LOGGER("Utils") namespace { const std::string kPlatformPipePrefix = "\\\\.\\pipe\\"; @@ -84,8 +84,7 @@ utils::Pipe::Impl::~Impl() { bool utils::Pipe::Impl::Open() { if (IsOpen()) { - LOGGER_WARN(logger_ptr, - "Named pipe: " << name_.toStdString() << " is already opened"); + SDL_WARN("Named pipe: " << name_.toStdString() << " is already opened"); return true; } server_socket_ = new QLocalServer(); @@ -93,8 +92,7 @@ bool utils::Pipe::Impl::Open() { if (!server_socket_->listen(name_)) { delete server_socket_; server_socket_ = NULL; - LOGGER_ERROR(logger_ptr, - "Cannot create named pipe: " << name_.toStdString()); + SDL_ERROR("Cannot create named pipe: " << name_.toStdString()); return false; } if (server_socket_->waitForNewConnection(-1)) { @@ -103,8 +101,7 @@ bool utils::Pipe::Impl::Open() { if (!client_socket_) { delete server_socket_; server_socket_ = NULL; - LOGGER_ERROR(logger_ptr, - "Cannot connect to named pipe: " << name_.toStdString()); + SDL_ERROR("Cannot connect to named pipe: " << name_.toStdString()); return false; } return true; @@ -112,8 +109,7 @@ bool utils::Pipe::Impl::Open() { void utils::Pipe::Impl::Close() { if (!IsOpen()) { - LOGGER_WARN(logger_ptr, - "Named pipe: " << name_.toStdString() << " is not opened"); + SDL_WARN("Named pipe: " << name_.toStdString() << " is not opened"); return; } if (server_socket_) { @@ -134,19 +130,17 @@ bool utils::Pipe::Impl::Write(const uint8_t* buffer, size_t& bytes_written) { bytes_written = 0; if (!IsOpen()) { - LOGGER_ERROR(logger_ptr, - "Named pipe: " << name_.toStdString() << " is not opened"); + SDL_ERROR("Named pipe: " << name_.toStdString() << " is not opened"); return false; } if (bytes_to_write == 0) { - LOGGER_WARN(logger_ptr, "Trying to write 0 bytes"); + SDL_WARN("Trying to write 0 bytes"); return true; } qint64 written = client_socket_->write(reinterpret_cast<const char*>(buffer), static_cast<qint64>(bytes_to_write)); if (-1 == written) { - LOGGER_ERROR(logger_ptr, - "Cannot write to named pipe: " << name_.toStdString()); + SDL_ERROR("Cannot write to named pipe: " << name_.toStdString()); return false; } client_socket_->waitForBytesWritten(); diff --git a/src/components/utils/src/pipe_win.cc b/src/components/utils/src/pipe_win.cc index b651106848..bbef6b75f9 100644 --- a/src/components/utils/src/pipe_win.cc +++ b/src/components/utils/src/pipe_win.cc @@ -39,7 +39,7 @@ #include "utils/logger.h" #include "utils/file_system.h" -CREATE_LOGGERPTR_GLOBAL(logger_ptr, "Utils") +SDL_CREATE_LOGGER("Utils") namespace { const std::string kPlatformPipePrefix = "\\\\.\\pipe\\"; @@ -83,7 +83,7 @@ utils::Pipe::Impl::~Impl() { bool utils::Pipe::Impl::Open() { if (IsOpen()) { - LOGGER_WARN(logger_ptr, "Named pipe: " << name_ << " is already opened"); + SDL_WARN("Named pipe: " << name_ << " is already opened"); return true; } handle_ = CreateNamedPipe(TEXT(name_.c_str()), @@ -96,13 +96,13 @@ bool utils::Pipe::Impl::Open() { NULL); if (INVALID_HANDLE_VALUE == handle_) { handle_ = NULL; - LOGGER_ERROR(logger_ptr, "Cannot create named pipe: " << name_); + SDL_ERROR("Cannot create named pipe: " << name_); return false; } if (0 == ConnectNamedPipe(handle_, NULL)) { CloseHandle(handle_); handle_ = NULL; - LOGGER_ERROR(logger_ptr, "Cannot connect to named pipe: " << name_); + SDL_ERROR("Cannot connect to named pipe: " << name_); return false; } return true; @@ -110,14 +110,14 @@ bool utils::Pipe::Impl::Open() { void utils::Pipe::Impl::Close() { if (!IsOpen()) { - LOGGER_WARN(logger_ptr, "Named pipe: " << name_ << " is not opened"); + SDL_WARN("Named pipe: " << name_ << " is not opened"); return; } if (0 == DisconnectNamedPipe(handle_)) { - LOGGER_WARN(logger_ptr, "Cannot disconnect from named pipe: " << name_); + SDL_WARN("Cannot disconnect from named pipe: " << name_); } if (0 == CloseHandle(handle_)) { - LOGGER_WARN(logger_ptr, "Cannot delete named pipe: " << name_); + SDL_WARN("Cannot delete named pipe: " << name_); } handle_ = NULL; } @@ -131,11 +131,11 @@ bool utils::Pipe::Impl::Write(const uint8_t* buffer, size_t& bytes_written) { bytes_written = 0; if (!IsOpen()) { - LOGGER_ERROR(logger_ptr, "Named pipe: " << name_ << " is not opened"); + SDL_ERROR("Named pipe: " << name_ << " is not opened"); return false; } if (bytes_to_write == 0) { - LOGGER_WARN(logger_ptr, "Trying to write 0 bytes"); + SDL_WARN("Trying to write 0 bytes"); return true; } DWORD written = 0; @@ -145,7 +145,7 @@ bool utils::Pipe::Impl::Write(const uint8_t* buffer, &written, NULL); if (0 == result) { - LOGGER_ERROR(logger_ptr, "Cannot write to named pipe: " << name_); + SDL_ERROR("Cannot write to named pipe: " << name_); return false; } bytes_written = static_cast<size_t>(written); diff --git a/src/components/utils/src/push_log.cc b/src/components/utils/src/push_log.cc index d6ae75ac43..7887030ba4 100644 --- a/src/components/utils/src/push_log.cc +++ b/src/components/utils/src/push_log.cc @@ -91,7 +91,7 @@ void delete_log_message_loop_thread() { log_message_loop_thread = NULL; } -void flush_logger() { +void FLUSH_SDL_LOGGER() { logger::LoggerStatus old_status = logger::logger_status; // Stop pushing new messages to the log queue logger::logger_status = logger::DeletingLoggerThread; diff --git a/src/components/utils/src/qdb_wrapper/sql_database.cc b/src/components/utils/src/qdb_wrapper/sql_database.cc index f1c6b6d498..32db4e4469 100644 --- a/src/components/utils/src/qdb_wrapper/sql_database.cc +++ b/src/components/utils/src/qdb_wrapper/sql_database.cc @@ -37,7 +37,7 @@ namespace utils { namespace dbms { -CREATE_LOGGERPTR_GLOBAL(logger_, "SQLDatabase") +SDL_CREATE_LOGGER("SQLDatabase") SQLDatabase::SQLDatabase(const std::string& db_name) : conn_(NULL), db_name_(db_name), error_(Error::OK) {} @@ -105,10 +105,10 @@ qdb_hdl_t* SQLDatabase::conn() const { bool SQLDatabase::Backup() { if (qdb_backup(conn_, QDB_ATTACH_DEFAULT) == -1) { error_ = Error::ERROR; - LOGGER_ERROR(logger_, "Backup returned error: " << std::strerror(errno)); + SDL_ERROR("Backup returned error: " << std::strerror(errno)); return false; } - LOGGER_INFO(logger_, "Backup was successful."); + SDL_INFO("Backup was successful."); return true; } diff --git a/src/components/utils/src/qdb_wrapper/sql_query.cc b/src/components/utils/src/qdb_wrapper/sql_query.cc index caecdacfff..3ce193c756 100644 --- a/src/components/utils/src/qdb_wrapper/sql_query.cc +++ b/src/components/utils/src/qdb_wrapper/sql_query.cc @@ -41,7 +41,7 @@ namespace utils { namespace dbms { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") class SetBindInteger { public: @@ -111,7 +111,7 @@ bool SQLQuery::Prepare(const std::string& query) { query_ = query; statement_ = qdb_stmt_init(db_->conn(), query.c_str(), query.length() + 1); if (statement_ == -1) { - LOGGER_DEBUG(logger_, "Prepare error: " << strerror(errno)); + SDL_DEBUG("Prepare error: " << strerror(errno)); error_ = Error::ERROR; return false; } diff --git a/src/components/utils/src/resource_usage.cc b/src/components/utils/src/resource_usage.cc index 583f9a7ce3..fb069ca895 100644 --- a/src/components/utils/src/resource_usage.cc +++ b/src/components/utils/src/resource_usage.cc @@ -20,19 +20,19 @@ namespace utils { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") const char* Resources::proc = "/proc/"; ResourseUsage* Resources::getCurrentResourseUsage() { PidStats pid_stats; if (false == GetProcInfo(pid_stats)) { - LOGGER_ERROR(logger_, "Failed to get cpu proc info"); + SDL_ERROR("Failed to get cpu proc info"); return NULL; } MemInfo mem_info; if (false == GetMemInfo(mem_info)) { - LOGGER_ERROR(logger_, "Failed to get memory info"); + SDL_ERROR("Failed to get memory info"); return NULL; } ResourseUsage* usage = new ResourseUsage(); @@ -149,16 +149,15 @@ bool Resources::GetProcInfo(Resources::PidStats& output) { &(output.guest_time), &(output.cguest_time)); if (num_succes != 43) { // 43 is number of iteams in Resources::PidStats - LOGGER_ERROR(logger_, "Couldn't parse all iteams in /proc/PID/stat file"); + SDL_ERROR("Couldn't parse all iteams in /proc/PID/stat file"); return false; } return true; #elif defined(__QNXNTO__) int fd = open(GetProcPath().c_str(), O_RDONLY); if (0 >= fd) { - LOGGER_ERROR(logger_, - "Failed open process proc file : " - << GetProcPath() << "; error no : " << strerror(errno)); + SDL_ERROR("Failed open process proc file : " + << GetProcPath() << "; error no : " << strerror(errno)); close(fd); return false; @@ -174,7 +173,7 @@ bool Resources::GetMemInfo(Resources::MemInfo& output) { #if defined(OS_LINUX) Resources::PidStats pid_stat; if (false == GetProcInfo(pid_stat)) { - LOGGER_ERROR(logger_, "Failed to get proc info"); + SDL_ERROR("Failed to get proc info"); result = false; } else { output = pid_stat.vsize; @@ -186,19 +185,19 @@ bool Resources::GetMemInfo(Resources::MemInfo& output) { struct stat st; struct _dir* proc_dir = 0; if (0 == (proc_dir = opendir(proc))) { - LOGGER_ERROR(logger_, "Unable to access to " << proc); + SDL_ERROR("Unable to access to " << proc); result = false; return result; } if (0 == readdir(proc_dir)) { - LOGGER_ERROR(logger_, "Unable to read : " << proc_dir); + SDL_ERROR("Unable to read : " << proc_dir); closedir(proc_dir); result = false; return result; } closedir(proc_dir); if (-1 == stat(as_path.c_str(), &st) || 0 == st.st_size) { - LOGGER_ERROR(logger_, "Unable to stat : " << as_path.c_str()); + SDL_ERROR("Unable to stat : " << as_path.c_str()); result = false; return result; } diff --git a/src/components/utils/src/rwlock_posix.cc b/src/components/utils/src/rwlock_posix.cc index 7c14db3be3..087fc73a79 100644 --- a/src/components/utils/src/rwlock_posix.cc +++ b/src/components/utils/src/rwlock_posix.cc @@ -35,7 +35,7 @@ #include "utils/logger.h" #include "utils/pimpl_impl.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") namespace sync_primitives { @@ -87,25 +87,25 @@ void sync_primitives::RWLock::ReleaseForWriting() { sync_primitives::RWLock::Impl::Impl() { if (pthread_rwlock_init(&rwlock_, 0) != 0) { - LOGGER_ERROR(logger_, "Failed to initialize rwlock"); + SDL_ERROR("Failed to initialize rwlock"); } } sync_primitives::RWLock::Impl::~Impl() { if (pthread_rwlock_destroy(&rwlock_) != 0) { - LOGGER_ERROR(logger_, "Failed to destroy rwlock"); + SDL_ERROR("Failed to destroy rwlock"); } } void sync_primitives::RWLock::Impl::AcquireForReading() { if (pthread_rwlock_rdlock(&rwlock_) != 0) { - LOGGER_ERROR(logger_, "Failed to acquire rwlock for reading"); + SDL_ERROR("Failed to acquire rwlock for reading"); } } bool sync_primitives::RWLock::Impl::TryAcquireForReading() { if (pthread_rwlock_tryrdlock(&rwlock_) != 0) { - LOGGER_DEBUG(logger_, "Cannot acquire rwlock for reading"); + SDL_DEBUG("Cannot acquire rwlock for reading"); return false; } return true; @@ -113,13 +113,13 @@ bool sync_primitives::RWLock::Impl::TryAcquireForReading() { void sync_primitives::RWLock::Impl::AcquireForWriting() { if (pthread_rwlock_wrlock(&rwlock_) != 0) { - LOGGER_ERROR(logger_, "Failed to acquire rwlock for writing"); + SDL_ERROR("Failed to acquire rwlock for writing"); } } bool sync_primitives::RWLock::Impl::TryAcquireForWriting() { if (pthread_rwlock_trywrlock(&rwlock_) != 0) { - LOGGER_DEBUG(logger_, "Cannot acquire rwlock for writing"); + SDL_DEBUG("Cannot acquire rwlock for writing"); return false; } return true; @@ -127,12 +127,12 @@ bool sync_primitives::RWLock::Impl::TryAcquireForWriting() { void sync_primitives::RWLock::Impl::ReleaseForReading() { if (pthread_rwlock_unlock(&rwlock_) != 0) { - LOGGER_ERROR(logger_, "Failed to release rwlock for reading"); + SDL_ERROR("Failed to release rwlock for reading"); } } void sync_primitives::RWLock::Impl::ReleaseForWriting() { if (pthread_rwlock_unlock(&rwlock_) != 0) { - LOGGER_ERROR(logger_, "Failed to release rwlock for writing"); + SDL_ERROR("Failed to release rwlock for writing"); } } diff --git a/src/components/utils/src/rwlock_qt.cc b/src/components/utils/src/rwlock_qt.cc index 9000aed79d..3c541e75bd 100644 --- a/src/components/utils/src/rwlock_qt.cc +++ b/src/components/utils/src/rwlock_qt.cc @@ -37,7 +37,7 @@ namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") class RWLock::Impl { public: @@ -100,7 +100,7 @@ void sync_primitives::RWLock::Impl::AcquireForReading() { bool sync_primitives::RWLock::Impl::TryAcquireForReading() { if (!rwlock_->tryLockForRead()) { - LOGGER_DEBUG(logger_, "Cannot acquire rwlock for reading"); + SDL_DEBUG("Cannot acquire rwlock for reading"); return false; } return true; @@ -112,7 +112,7 @@ void sync_primitives::RWLock::Impl::AcquireForWriting() { bool sync_primitives::RWLock::Impl::TryAcquireForWriting() { if (!rwlock_->tryLockForWrite()) { - LOGGER_DEBUG(logger_, "Cannot acquire rwlock for writing"); + SDL_DEBUG("Cannot acquire rwlock for writing"); return false; } return true; diff --git a/src/components/utils/src/rwlock_win.cc b/src/components/utils/src/rwlock_win.cc index fc14c6192c..b9a4ef309a 100644 --- a/src/components/utils/src/rwlock_win.cc +++ b/src/components/utils/src/rwlock_win.cc @@ -34,7 +34,7 @@ #include "utils/logger.h" #include "utils/pimpl_impl.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") namespace sync_primitives { @@ -96,7 +96,7 @@ void sync_primitives::RWLock::Impl::AcquireForReading() { bool sync_primitives::RWLock::Impl::TryAcquireForReading() { if (!TryAcquireSRWLockShared(&rwlock_)) { - LOGGER_DEBUG(logger_, "Cannot acquire rwlock for reading"); + SDL_DEBUG("Cannot acquire rwlock for reading"); return false; } return true; @@ -108,7 +108,7 @@ void sync_primitives::RWLock::Impl::AcquireForWriting() { bool sync_primitives::RWLock::Impl::TryAcquireForWriting() { if (!TryAcquireSRWLockExclusive(&rwlock_)) { - LOGGER_DEBUG(logger_, "Cannot acquire rwlock for writing"); + SDL_DEBUG("Cannot acquire rwlock for writing"); return false; } return true; diff --git a/src/components/utils/src/signals_linux.cc b/src/components/utils/src/signals_linux.cc index ab15158fe3..3932546d0b 100644 --- a/src/components/utils/src/signals_linux.cc +++ b/src/components/utils/src/signals_linux.cc @@ -37,23 +37,23 @@ #include "utils/signals.h" #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") namespace { void SigHandler(int sig) { switch (sig) { case SIGINT: - LOGGER_INFO(logger_, "SIGINT signal has been caught"); + SDL_INFO("SIGINT signal has been caught"); break; case SIGTERM: - LOGGER_INFO(logger_, "SIGTERM signal has been caught"); + SDL_INFO("SIGTERM signal has been caught"); break; case SIGSEGV: - LOGGER_INFO(logger_, "SIGSEGV signal has been caught"); + SDL_INFO("SIGSEGV signal has been caught"); break; default: - LOGGER_INFO(logger_, "Unexpected signal has been caught"); + SDL_INFO("Unexpected signal has been caught"); break; } } @@ -81,7 +81,7 @@ void WaitForSdlExecute() { sigaddset(&signal_set, SIGTERM); if (!CatchSIGSEGV(&SigHandler) || 0 != sigwait(&signal_set, &sig)) { - LOGGER_FATAL(logger_, "Subscribe to system signals error"); + SDL_FATAL("Subscribe to system signals error"); } SigHandler(sig); diff --git a/src/components/utils/src/signals_qt.cc b/src/components/utils/src/signals_qt.cc index 2475ef66e9..0e82e63bae 100644 --- a/src/components/utils/src/signals_qt.cc +++ b/src/components/utils/src/signals_qt.cc @@ -34,15 +34,15 @@ #include "utils/logger.h" #include <QCoreApplication> -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") namespace { void HandleSignals(const char* log_name) { - LOGGER_INFO(logger_, log_name); + SDL_INFO(log_name); QCoreApplication* const app = QCoreApplication::instance(); if (!app) { - LOGGER_FATAL(logger_, "No QCoreApplication instance already"); + SDL_FATAL("No QCoreApplication instance already"); } app->quit(); } @@ -78,7 +78,7 @@ void SubscribeToTerminationSignals() { if ((signal(SIGINT, &SigHandler) == SIG_ERR) || (signal(SIGTERM, &SigHandler) == SIG_ERR) || (signal(SIGSEGV, &SigHandler) == SIG_ERR)) { - LOGGER_FATAL(logger_, "SDL is not subscribed to signal events"); + SDL_FATAL("SDL is not subscribed to signal events"); } } } // namespace utils diff --git a/src/components/utils/src/signals_win.cc b/src/components/utils/src/signals_win.cc index c38797103f..cffae4c46e 100644 --- a/src/components/utils/src/signals_win.cc +++ b/src/components/utils/src/signals_win.cc @@ -33,13 +33,13 @@ #include "utils/signals.h" #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") namespace { HANDLE signal_handle = NULL; void HandleSignals(HANDLE& signal_handle, const char* log_name) { - LOGGER_INFO(logger_, log_name); + SDL_INFO(log_name); SetEvent(signal_handle); } @@ -67,7 +67,7 @@ void WaitForSdlExecute() { if (signal_handle) { WaitForSingleObject(signal_handle, INFINITE); } else { - LOGGER_FATAL(logger_, "SDL is not subscribed to signal events"); + SDL_FATAL("SDL is not subscribed to signal events"); } } @@ -79,7 +79,7 @@ void SubscribeToTerminationSignals() { if ((signal(SIGINT, &SigHandler) == SIG_ERR) || (signal(SIGTERM, &SigHandler) == SIG_ERR) || (signal(SIGSEGV, &SigHandler) == SIG_ERR)) { - LOGGER_FATAL(logger_, "Subscribe to system signals error"); + SDL_FATAL("Subscribe to system signals error"); } } } // namespace utils diff --git a/src/components/utils/src/socket_posix.cc b/src/components/utils/src/socket_posix.cc index 927f4fab00..32dcab6ec9 100644 --- a/src/components/utils/src/socket_posix.cc +++ b/src/components/utils/src/socket_posix.cc @@ -44,19 +44,18 @@ #include "utils/pimpl_impl.h" #include "utils/socket_utils.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") namespace { bool CloseSocket(int& socket) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (0 == socket) { - LOGGER_DEBUG(logger_, - "Socket " << socket << " is not valid. Skip closing."); + SDL_DEBUG("Socket " << socket << " is not valid. Skip closing."); return true; } if (-1 != close(socket)) { - LOGGER_WARN(logger_, "Failed to close socket " << socket << ": " << errno); + SDL_WARN("Failed to close socket " << socket << ": " << errno); return false; } socket = 0; @@ -158,18 +157,18 @@ bool utils::TcpSocketConnection::Impl::CreateNotifictionPipes() { const int result = pipe(fds); if (0 != result) { - LOGGER_ERROR(logger_, "pipe creation failed: " << errno); + SDL_ERROR("pipe creation failed: " << errno); return false; } - LOGGER_DEBUG(logger_, "pipe created"); + SDL_DEBUG("pipe created"); read_fd_ = fds[0]; write_fd_ = fds[1]; const int fcntl_ret = fcntl(read_fd_, F_SETFL, fcntl(read_fd_, F_GETFL) | O_NONBLOCK); if (0 != fcntl_ret) { - LOGGER_ERROR(logger_, "fcntl failed: " << errno); + SDL_ERROR("fcntl failed: " << errno); return false; } return true; @@ -180,7 +179,7 @@ bool utils::TcpSocketConnection::Impl::Send(const char* buffer, std::size_t& bytes_written) { bytes_written = 0u; if (!IsValid()) { - LOGGER_ERROR(logger_, "Failed to send data socket is not valid"); + SDL_ERROR("Failed to send data socket is not valid"); return false; } const int flags = MSG_NOSIGNAL; @@ -188,7 +187,7 @@ bool utils::TcpSocketConnection::Impl::Send(const char* buffer, int socket_error = errno; if (-1 == written) { if (EAGAIN != socket_error && EWOULDBLOCK != socket_error) { - LOGGER_ERROR(logger_, "Failed to send data: " << socket_error); + SDL_ERROR("Failed to send data: " << socket_error); return false; } else { return true; @@ -197,18 +196,16 @@ bool utils::TcpSocketConnection::Impl::Send(const char* buffer, // Lets double chek written because we have signed to unsigned conversion DCHECK(written >= 0); bytes_written = static_cast<std::size_t>(written); - LOGGER_DEBUG(logger_, - "Sent " << written << " bytes to socket " << tcp_socket_); + SDL_DEBUG("Sent " << written << " bytes to socket " << tcp_socket_); return true; } bool utils::TcpSocketConnection::Impl::Close() { if (!IsValid()) { - LOGGER_DEBUG(logger_, "Connection is not valid. Nothing to close."); + SDL_DEBUG("Connection is not valid. Nothing to close."); return true; } - LOGGER_DEBUG(logger_, - "Closing connection " << address_.ToString() << ":" << port_); + SDL_DEBUG("Closing connection " << address_.ToString() << ":" << port_); // Possibly we're waiting on Wait. We have to interrupt this. Notify(); @@ -247,13 +244,13 @@ uint16_t utils::TcpSocketConnection::Impl::GetPort() const { bool utils::TcpSocketConnection::Impl::Connect(const HostAddress& address, const uint16_t port) { if (IsValid()) { - LOGGER_ERROR(logger_, "Already connected. Closing existing connection."); + SDL_ERROR("Already connected. Closing existing connection."); Close(); return false; } int client_socket = socket(AF_INET, SOCK_STREAM, 0); if (-1 == client_socket) { - LOGGER_ERROR(logger_, "Failed to create client socket. Error: " << errno); + SDL_ERROR("Failed to create client socket. Error: " << errno); return false; } sockaddr_in server_address = {0}; @@ -263,10 +260,8 @@ bool utils::TcpSocketConnection::Impl::Connect(const HostAddress& address, if (!connect(client_socket, reinterpret_cast<sockaddr*>(&server_address), sizeof(server_address)) == 0) { - LOGGER_ERROR(logger_, - "Failed to connect to the server " << address.ToString() << ":" - << port - << ". Error: " << errno); + SDL_ERROR("Failed to connect to the server " + << address.ToString() << ":" << port << ". Error: " << errno); CloseSocket(client_socket); return false; } @@ -282,16 +277,14 @@ bool utils::TcpSocketConnection::Impl::Connect(const HostAddress& address, bool utils::TcpSocketConnection::Impl::Notify() { if (-1 == write_fd_) { - LOGGER_ERROR(logger_, - "Failed to wake up connection thread for connection " - << this << ". Error: " << errno); + SDL_ERROR("Failed to wake up connection thread for connection " + << this << ". Error: " << errno); return false; } uint8_t buffer = 0; if (1 != write(write_fd_, &buffer, 1)) { - LOGGER_ERROR(logger_, - "Failed to wake up connection thread for connection " - << this << ". Error: " << errno); + SDL_ERROR("Failed to wake up connection thread for connection " + << this << ". Error: " << errno); return false; } return true; @@ -299,7 +292,7 @@ bool utils::TcpSocketConnection::Impl::Notify() { void utils::TcpSocketConnection::Impl::SetEventHandler( TcpConnectionEventHandler* event_handler) { - LOGGER_DEBUG(logger_, "Setting event handle to " << event_handler); + SDL_DEBUG("Setting event handle to " << event_handler); event_handler_ = event_handler; } @@ -311,7 +304,7 @@ void utils::TcpSocketConnection::Impl::OnError(int error) { } void utils::TcpSocketConnection::Impl::OnRead() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!event_handler_) { return; } @@ -322,23 +315,20 @@ void utils::TcpSocketConnection::Impl::OnRead() { do { bytes_read = recv(tcp_socket_, buffer, sizeof(buffer), MSG_DONTWAIT); if (bytes_read > 0) { - LOGGER_DEBUG(logger_, - "Received " << bytes_read << " bytes from socket " - << tcp_socket_); + SDL_DEBUG("Received " << bytes_read << " bytes from socket " + << tcp_socket_); uint8_t* casted_buffer = reinterpret_cast<uint8_t*>(buffer); event_handler_->OnData(casted_buffer, bytes_read); } else if (bytes_read < 0) { int socket_error = errno; if (EAGAIN != socket_error && EWOULDBLOCK != socket_error) { - LOGGER_ERROR(logger_, - "recv() failed for connection " - << tcp_socket_ << ". Error: " << socket_error); + SDL_ERROR("recv() failed for connection " + << tcp_socket_ << ". Error: " << socket_error); OnError(socket_error); return; } } else { - LOGGER_WARN(logger_, - "Socket " << tcp_socket_ << " closed by remote peer"); + SDL_WARN("Socket " << tcp_socket_ << " closed by remote peer"); OnError(errno); return; } @@ -361,7 +351,7 @@ void utils::TcpSocketConnection::Impl::OnClose() { void utils::TcpSocketConnection::Impl::Wait() { if (!IsValid()) { - LOGGER_ERROR(logger_, "Cannot wait. Not connected."); + SDL_ERROR("Cannot wait. Not connected."); Close(); return; } @@ -374,27 +364,23 @@ void utils::TcpSocketConnection::Impl::Wait() { poll_fds[1].fd = read_fd_; poll_fds[1].events = POLLIN | POLLPRI; if (-1 == poll(poll_fds, kPollFdsSize, -1)) { - LOGGER_ERROR(logger_, - "poll failed for the socket " << tcp_socket_ - << ". Error: " << errno); + SDL_ERROR("poll failed for the socket " << tcp_socket_ + << ". Error: " << errno); OnError(errno); return; } - LOGGER_DEBUG(logger_, - "poll is ok for the socket " - << tcp_socket_ << " revents0: " << std::hex - << poll_fds[0].revents << " revents1:" << std::hex - << poll_fds[1].revents); + SDL_DEBUG("poll is ok for the socket " + << tcp_socket_ << " revents0: " << std::hex << poll_fds[0].revents + << " revents1:" << std::hex << poll_fds[1].revents); // error check if (0 != (poll_fds[1].revents & (POLLERR | POLLHUP | POLLNVAL))) { - LOGGER_ERROR(logger_, - "Notification pipe for socket " - << tcp_socket_ << " terminated. Error: " << errno); + SDL_ERROR("Notification pipe for socket " + << tcp_socket_ << " terminated. Error: " << errno); OnError(errno); return; } if (poll_fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) { - LOGGER_DEBUG(logger_, "Socket " << tcp_socket_ << " has terminated"); + SDL_DEBUG("Socket " << tcp_socket_ << " has terminated"); OnClose(); return; } @@ -406,9 +392,8 @@ void utils::TcpSocketConnection::Impl::Wait() { bytes_read = read(read_fd_, buffer, sizeof(buffer)); } while (bytes_read > 0); if ((bytes_read < 0) && (EAGAIN != errno)) { - LOGGER_ERROR(logger_, - "Failed to clear notification pipe. Poll failed for socket " - << tcp_socket_ << ". Error: " << errno); + SDL_ERROR("Failed to clear notification pipe. Poll failed for socket " + << tcp_socket_ << ". Error: " << errno); OnError(errno); return; } @@ -544,15 +529,15 @@ bool utils::TcpServerSocket::Impl::Close() { bool utils::TcpServerSocket::Impl::Listen(const HostAddress& address, const uint16_t port, const int backlog) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (IsListening()) { - LOGGER_ERROR(logger_, "Cannot listen. Already listeneing."); + SDL_ERROR("Cannot listen. Already listeneing."); return false; } int server_socket = socket(AF_INET, SOCK_STREAM, 0); if (-1 == server_socket) { - LOGGER_ERROR(logger_, "Failed to create server socket: " << errno); + SDL_ERROR("Failed to create server socket: " << errno); return false; } @@ -560,7 +545,7 @@ bool utils::TcpServerSocket::Impl::Listen(const HostAddress& address, if (-1 == setsockopt( server_socket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval))) { - LOGGER_ERROR(logger_, "Unable to set sockopt: " << errno); + SDL_ERROR("Unable to set sockopt: " << errno); return false; } @@ -572,17 +557,15 @@ bool utils::TcpServerSocket::Impl::Listen(const HostAddress& address, if (-1 == bind(server_socket, reinterpret_cast<struct sockaddr*>(&server_address), sizeof(server_address))) { - LOGGER_ERROR(logger_, "Unable to bind: " << errno); + SDL_ERROR("Unable to bind: " << errno); return false; } - LOGGER_DEBUG(logger_, - "Start listening on " << address.ToString() << ":" << port); + SDL_DEBUG("Start listening on " << address.ToString() << ":" << port); if (-1 == listen(server_socket, backlog)) { - LOGGER_ERROR(logger_, - "Failed to listen on " << address.ToString() << ":" << port - << ". Error: " << errno); + SDL_ERROR("Failed to listen on " << address.ToString() << ":" << port + << ". Error: " << errno); return false; } @@ -592,7 +575,7 @@ bool utils::TcpServerSocket::Impl::Listen(const HostAddress& address, } utils::TcpSocketConnection utils::TcpServerSocket::Impl::Accept() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); struct sockaddr_in client_address = {0}; int client_address_length = sizeof(client_address); @@ -601,20 +584,18 @@ utils::TcpSocketConnection utils::TcpServerSocket::Impl::Accept() { reinterpret_cast<sockaddr*>(&client_address), reinterpret_cast<socklen_t*>(&client_address_length)); if (-1 == client_socket) { - LOGGER_ERROR(logger_, "Failed to accept client socket: " << errno); + SDL_ERROR("Failed to accept client socket: " << errno); return utils::TcpSocketConnection(); } if (AF_INET != client_address.sin_family) { - LOGGER_DEBUG(logger_, - "Address of the connected client is invalid. Not AF_INET."); + SDL_DEBUG("Address of the connected client is invalid. Not AF_INET."); CloseSocket(client_socket); return utils::TcpSocketConnection(); } const HostAddress accepted_client_address(inet_ntoa(client_address.sin_addr)); - LOGGER_DEBUG(logger_, - "Accepted new client connection " - << accepted_client_address.ToString() << ":" - << client_address.sin_port); + SDL_DEBUG("Accepted new client connection " + << accepted_client_address.ToString() << ":" + << client_address.sin_port); return TcpSocketConnection(new TcpSocketConnection::Impl( client_socket, accepted_client_address, client_address.sin_port)); } diff --git a/src/components/utils/src/socket_qt.cc b/src/components/utils/src/socket_qt.cc index 847ff4bfbc..aba3c182f3 100644 --- a/src/components/utils/src/socket_qt.cc +++ b/src/components/utils/src/socket_qt.cc @@ -37,7 +37,7 @@ #include "utils/pimpl_impl.h" #include "utils/socket_utils.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") namespace { @@ -164,10 +164,10 @@ void utils::TcpSocketConnection::Impl::Copy(TcpSocketConnection& rhs) { bool utils::TcpSocketConnection::Impl::Send(const char* buffer, const std::size_t size, std::size_t& bytes_written) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bytes_written = 0; if (!IsValid()) { - LOGGER_WARN(logger_, "Cannot send. Socket is not valid."); + SDL_WARN("Cannot send. Socket is not valid."); return false; } if (!tcp_socket_) { @@ -183,17 +183,16 @@ bool utils::TcpSocketConnection::Impl::Send(const char* buffer, DCHECK(written >= 0) bytes_written = static_cast<std::size_t>(written); } else { - LOGGER_WARN(logger_, - "Failed to send: " << tcp_socket_->errorString().toStdString()); + SDL_WARN("Failed to send: " << tcp_socket_->errorString().toStdString()); return false; } return true; } bool utils::TcpSocketConnection::Impl::Close() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!IsValid()) { - LOGGER_DEBUG(logger_, "Not valid. Exit Close"); + SDL_DEBUG("Not valid. Exit Close"); return true; } if (tcp_socket_) { @@ -270,9 +269,8 @@ void utils::TcpSocketConnection::Impl::OnRead() { buffer = tcp_socket_->readAll(); bytes_read = buffer.size(); if (bytes_read > 0) { - LOGGER_DEBUG(logger_, - "Received " << bytes_read << " bytes from socket " - << socket_descriptor_); + SDL_DEBUG("Received " << bytes_read << " bytes from socket " + << socket_descriptor_); emit DataReceivedSignal(buffer, bytes_read); } } @@ -307,9 +305,9 @@ void utils::TcpSocketConnection::Impl::InitSocketSignals() { } void utils::TcpSocketConnection::Impl::Wait() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!IsValid()) { - LOGGER_ERROR(logger_, "Cannot wait. Not connected."); + SDL_ERROR("Cannot wait. Not connected."); return; } if (!is_initiated_) { @@ -326,10 +324,9 @@ void utils::TcpSocketConnection::Impl::Wait() { } void utils::TcpSocketConnection::Impl::OnErrorSlot() { - LOGGER_DEBUG(logger_, - "Socket error code:#[" - << tcp_socket_->error() << "]. " - << tcp_socket_->errorString().toStdString().c_str()); + SDL_DEBUG("Socket error code:#[" + << tcp_socket_->error() << "]. " + << tcp_socket_->errorString().toStdString().c_str()); if (tcp_socket_->error() != QAbstractSocket::RemoteHostClosedError) { OnError(tcp_socket_->error()); } @@ -348,14 +345,14 @@ void utils::TcpSocketConnection::Impl::OnDataReceivedSlot(QByteArray buffer, } bool utils::TcpSocketConnection::Impl::Notify() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); emit NotifySignal(); return true; } void utils::TcpSocketConnection::Impl::SetEventHandler( TcpConnectionEventHandler* event_handler) { - LOGGER_DEBUG(logger_, "Setting event handle to " << event_handler); + SDL_DEBUG("Setting event handle to " << event_handler); event_handler_ = event_handler; } @@ -448,7 +445,7 @@ class utils::TcpServerSocket::Impl { utils::TcpServerSocket::Impl::Impl() : server_socket_(NULL) {} utils::TcpServerSocket::Impl::~Impl() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Close(); } @@ -468,12 +465,11 @@ bool utils::TcpServerSocket::Impl::Close() { bool utils::TcpServerSocket::Impl::Listen(const HostAddress& address, const uint16_t port, const int backlog) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "Start listening on " << address.ToString() << ":" << port); + SDL_AUTO_TRACE(); + SDL_DEBUG("Start listening on " << address.ToString() << ":" << port); if (server_socket_) { - LOGGER_WARN(logger_, "Cannot listen. server_socket_ is null"); + SDL_WARN("Cannot listen. server_socket_ is null"); return false; } @@ -481,42 +477,37 @@ bool utils::TcpServerSocket::Impl::Listen(const HostAddress& address, server_socket_->setMaxPendingConnections(backlog); - LOGGER_DEBUG(logger_, - "Start listening on " << address.ToString() << ":" << port); + SDL_DEBUG("Start listening on " << address.ToString() << ":" << port); if (!server_socket_->listen(FromHostAddress(address), port)) { - LOGGER_WARN(logger_, - "Failed to listen on " - << address.ToString() << ":" << port << ". Error: " - << server_socket_->errorString().toStdString()); + SDL_WARN("Failed to listen on " + << address.ToString() << ":" << port + << ". Error: " << server_socket_->errorString().toStdString()); return false; } - LOGGER_DEBUG(logger_, "Listening on " << address.ToString() << ":" << port); + SDL_DEBUG("Listening on " << address.ToString() << ":" << port); return true; } utils::TcpSocketConnection utils::TcpServerSocket::Impl::Accept() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); bool waited = server_socket_->waitForNewConnection(-1); if (!waited) { - LOGGER_WARN(logger_, - "Failed to wait for the new connection: " - << server_socket_->errorString().toStdString()); + SDL_WARN("Failed to wait for the new connection: " + << server_socket_->errorString().toStdString()); return utils::TcpSocketConnection(); } QTcpSocket* client_connection = server_socket_->nextPendingConnection(); if (!client_connection) { - LOGGER_WARN(logger_, - "Failed to get new connection: " - << server_socket_->errorString().toStdString()); + SDL_WARN("Failed to get new connection: " + << server_socket_->errorString().toStdString()); return utils::TcpSocketConnection(); } - LOGGER_DEBUG(logger_, - "Accepted new client connection " - << client_connection->peerAddress().toString().toStdString() - << ":" << client_connection->peerPort()); + SDL_DEBUG("Accepted new client connection " + << client_connection->peerAddress().toString().toStdString() << ":" + << client_connection->peerPort()); const HostAddress host_address = ToHostAddress(client_connection->peerAddress()); const uint16_t port = static_cast<uint16_t>(client_connection->peerPort()); diff --git a/src/components/utils/src/socket_win.cc b/src/components/utils/src/socket_win.cc index 79c61ee56f..78f027adeb 100644 --- a/src/components/utils/src/socket_win.cc +++ b/src/components/utils/src/socket_win.cc @@ -35,22 +35,19 @@ #include "utils/pimpl_impl.h" #include "utils/socket_utils.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") namespace { bool CloseSocket(SOCKET& socket) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, "Closing socket " << socket); + SDL_AUTO_TRACE(); + SDL_DEBUG("Closing socket " << socket); if (NULL == socket) { - LOGGER_DEBUG(logger_, - "Socket " << socket << " is not valid. Skip closing."); + SDL_DEBUG("Socket " << socket << " is not valid. Skip closing."); return true; } if (SOCKET_ERROR == closesocket(socket)) { - LOGGER_WARN(logger_, - "Failed to close socket " << socket << ": " - << WSAGetLastError()); + SDL_WARN("Failed to close socket " << socket << ": " << WSAGetLastError()); return false; } socket = NULL; @@ -58,7 +55,7 @@ bool CloseSocket(SOCKET& socket) { } HANDLE CreateNotifyEvent() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); HANDLE result = CreateEvent(NULL, // no security attribute true, // is manual-reset event false, // initial state = non-signaled @@ -143,9 +140,8 @@ utils::TcpSocketConnection::Impl::Impl(const SOCKET tcp_socket, // Set socket to non-block mode unsigned long socket_mode = 1; if (!ioctlsocket(tcp_socket_, FIONBIO, &socket_mode) == 0) { - LOGGER_ERROR(logger_, - "Failed to set socket to non blocking mode. Error: " - << WSAGetLastError()); + SDL_ERROR("Failed to set socket to non blocking mode. Error: " + << WSAGetLastError()); CloseSocket(tcp_socket_); } } @@ -159,7 +155,7 @@ bool utils::TcpSocketConnection::Impl::Send(const char* const buffer, std::size_t& bytes_written) { bytes_written = 0u; if (!IsValid()) { - LOGGER_ERROR(logger_, "Failed to send data socket is not valid"); + SDL_ERROR("Failed to send data socket is not valid"); return false; } const int flags = 0; @@ -167,7 +163,7 @@ bool utils::TcpSocketConnection::Impl::Send(const char* const buffer, int socket_error = WSAGetLastError(); if (SOCKET_ERROR == written) { if (WSAEWOULDBLOCK != socket_error) { - LOGGER_ERROR(logger_, "Failed to send data: " << socket_error); + SDL_ERROR("Failed to send data: " << socket_error); return false; } else { return true; @@ -176,30 +172,28 @@ bool utils::TcpSocketConnection::Impl::Send(const char* const buffer, // Lets double chek written because we have signed to unsigned conversion DCHECK(written >= 0); bytes_written = static_cast<size_t>(written); - LOGGER_DEBUG(logger_, - "Sent " << written << " bytes to socket " << tcp_socket_); + SDL_DEBUG("Sent " << written << " bytes to socket " << tcp_socket_); return true; } bool utils::TcpSocketConnection::Impl::Close() { if (!IsValid()) { - LOGGER_DEBUG(logger_, "Connection is not valid. Nothing to close."); + SDL_DEBUG("Connection is not valid. Nothing to close."); return true; } - LOGGER_DEBUG(logger_, - "Closing connection " << address_.ToString() << ":" << port_); + SDL_DEBUG("Closing connection " << address_.ToString() << ":" << port_); // Possibly we're waiting on Wait. We have to interrupt this. Notify(); const BOOL event_closed = CloseHandle(notify_event_); if (!event_closed) { - LOGGER_WARN(logger_, "Failed to close event handler"); + SDL_WARN("Failed to close event handler"); } const bool socket_closed = CloseSocket(tcp_socket_); if (!socket_closed) { - LOGGER_WARN(logger_, "Failed to close socket handler"); + SDL_WARN("Failed to close socket handler"); } return event_closed && socket_closed; @@ -229,15 +223,13 @@ uint16_t utils::TcpSocketConnection::Impl::GetPort() const { bool utils::TcpSocketConnection::Impl::Connect(const HostAddress& address, const uint16_t port) { if (IsValid()) { - LOGGER_ERROR(logger_, "Already connected. Closing existing connection."); + SDL_ERROR("Already connected. Closing existing connection."); Close(); return false; } SOCKET client_socket = socket(AF_INET, SOCK_STREAM, 0); if (INVALID_SOCKET == client_socket) { - LOGGER_ERROR( - logger_, - "Failed to create client socket. Error: " << WSAGetLastError()); + SDL_ERROR("Failed to create client socket. Error: " << WSAGetLastError()); return false; } sockaddr_in server_address = {0}; @@ -247,10 +239,9 @@ bool utils::TcpSocketConnection::Impl::Connect(const HostAddress& address, if (!connect(client_socket, reinterpret_cast<sockaddr*>(&server_address), sizeof(server_address)) == 0) { - LOGGER_ERROR(logger_, - "Failed to connect to the server " - << address.ToString() << ":" << port - << ". Error: " << WSAGetLastError()); + SDL_ERROR("Failed to connect to the server " + << address.ToString() << ":" << port + << ". Error: " << WSAGetLastError()); CloseSocket(client_socket); return false; } @@ -269,7 +260,7 @@ void utils::TcpSocketConnection::Impl::OnError(int error) { } void utils::TcpSocketConnection::Impl::OnRead() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); if (!event_handler_) { return; } @@ -280,23 +271,20 @@ void utils::TcpSocketConnection::Impl::OnRead() { do { bytes_read = recv(tcp_socket_, buffer, sizeof(buffer), 0); if (bytes_read > 0) { - LOGGER_DEBUG(logger_, - "Received " << bytes_read << " bytes from socket " - << tcp_socket_); + SDL_DEBUG("Received " << bytes_read << " bytes from socket " + << tcp_socket_); uint8_t* casted_buffer = reinterpret_cast<uint8_t*>(buffer); event_handler_->OnData(casted_buffer, bytes_read); } else if (bytes_read < 0) { int socket_error = WSAGetLastError(); if (bytes_read == SOCKET_ERROR && WSAEWOULDBLOCK != socket_error) { - LOGGER_ERROR(logger_, - "recv() failed for connection " - << tcp_socket_ << ". Error: " << socket_error); + SDL_ERROR("recv() failed for connection " + << tcp_socket_ << ". Error: " << socket_error); OnError(socket_error); return; } } else { - LOGGER_WARN(logger_, - "Socket " << tcp_socket_ << " closed by remote peer"); + SDL_WARN("Socket " << tcp_socket_ << " closed by remote peer"); OnError(WSAGetLastError()); return; } @@ -319,7 +307,7 @@ void utils::TcpSocketConnection::Impl::OnClose() { void utils::TcpSocketConnection::Impl::Wait() { if (!IsValid()) { - LOGGER_ERROR(logger_, "Cannot wait. Not connected."); + SDL_ERROR("Cannot wait. Not connected."); Close(); return; } @@ -343,14 +331,12 @@ void utils::TcpSocketConnection::Impl::Wait() { const bool is_notify_event = (waited_index == WAIT_OBJECT_0 + 1); if (is_socket_event || is_notify_event) { - LOGGER_DEBUG(logger_, - "Waited event for the connection " - << tcp_socket_ << ". Socket event: " << is_socket_event - << ". Notify event: " << is_notify_event); + SDL_DEBUG("Waited event for the connection " + << tcp_socket_ << ". Socket event: " << is_socket_event + << ". Notify event: " << is_notify_event); } else { - LOGGER_ERROR(logger_, - "Wait for socket or notification has failed with error: " - << WSAGetLastError()); + SDL_ERROR("Wait for socket or notification has failed with error: " + << WSAGetLastError()); OnError(WSAGetLastError()); return; } @@ -359,24 +345,22 @@ void utils::TcpSocketConnection::Impl::Wait() { if (WSAEnumNetworkEvents(tcp_socket_, events_to_wait[waited_index - WAIT_OBJECT_0], &net_events) == SOCKET_ERROR) { - LOGGER_ERROR(logger_, - "Failed to enum socket events: " << WSAGetLastError()); + SDL_ERROR("Failed to enum socket events: " << WSAGetLastError()); OnError(WSAGetLastError()); return; } if (net_events.lNetworkEvents & FD_READ) { - LOGGER_DEBUG(logger_, "Network event: FD_READ"); + SDL_DEBUG("Network event: FD_READ"); OnRead(); return; } if (net_events.lNetworkEvents & FD_WRITE) { - LOGGER_DEBUG(logger_, "Network event: FD_WRITE"); + SDL_DEBUG("Network event: FD_WRITE"); is_can_write = true; } if (net_events.lNetworkEvents & FD_CLOSE) { - LOGGER_DEBUG(logger_, - "Network event: FD_CLOSE. " - << "Connection " << this << " terminated"); + SDL_DEBUG("Network event: FD_CLOSE. " + << "Connection " << this << " terminated"); OnClose(); return; } @@ -397,7 +381,7 @@ bool utils::TcpSocketConnection::Impl::Notify() { void utils::TcpSocketConnection::Impl::SetEventHandler( TcpConnectionEventHandler* event_handler) { - LOGGER_DEBUG(logger_, "Setting event handle to " << event_handler); + SDL_DEBUG("Setting event handle to " << event_handler); event_handler_ = event_handler; } @@ -520,32 +504,28 @@ bool utils::TcpServerSocket::Impl::Close() { bool utils::TcpServerSocket::Impl::Listen(const HostAddress& address, const uint16_t port, const int backlog) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, - "Start listening on " << address.ToString() << ":" << port); + SDL_AUTO_TRACE(); + SDL_DEBUG("Start listening on " << address.ToString() << ":" << port); if (IsListening()) { - LOGGER_ERROR(logger_, - "Cannot listen " << address.ToString() << ":" << port - << ". Already listeneing."); + SDL_ERROR("Cannot listen " << address.ToString() << ":" << port + << ". Already listeneing."); return false; } SOCKET server_socket = socket(AF_INET, SOCK_STREAM, 0); if (INVALID_SOCKET == server_socket) { - LOGGER_ERROR(logger_, - "Failed to create server socket: " << WSAGetLastError()); + SDL_ERROR("Failed to create server socket: " << WSAGetLastError()); return false; } - LOGGER_DEBUG(logger_, "Created server socket " << socket); + SDL_DEBUG("Created server socket " << socket); char optval = 1; if (SOCKET_ERROR == setsockopt( server_socket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval))) { - LOGGER_ERROR( - logger_, + SDL_ERROR( "Failed to to set sockopt SO_REUSEADDR. Error: " << WSAGetLastError()); return false; } @@ -558,20 +538,18 @@ bool utils::TcpServerSocket::Impl::Listen(const HostAddress& address, if (SOCKET_ERROR == bind(server_socket, reinterpret_cast<struct sockaddr*>(&server_address), sizeof(server_address))) { - LOGGER_ERROR(logger_, - "Failed to bind to " << address.ToString() << ":" << port - << ". Error: " << WSAGetLastError()); + SDL_ERROR("Failed to bind to " << address.ToString() << ":" << port + << ". Error: " << WSAGetLastError()); return false; } if (SOCKET_ERROR == listen(server_socket, backlog)) { - LOGGER_WARN(logger_, - "Failed to listen on " << address.ToString() << ":" << port - << ". Error: " << WSAGetLastError()); + SDL_WARN("Failed to listen on " << address.ToString() << ":" << port + << ". Error: " << WSAGetLastError()); return false; } - LOGGER_DEBUG(logger_, "Listening on " << address.ToString() << ":" << port); + SDL_DEBUG("Listening on " << address.ToString() << ":" << port); server_socket_ = server_socket; is_listening_ = true; @@ -579,7 +557,7 @@ bool utils::TcpServerSocket::Impl::Listen(const HostAddress& address, } utils::TcpSocketConnection utils::TcpServerSocket::Impl::Accept() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); struct sockaddr_in client_address = {0}; int client_address_length = sizeof(client_address); @@ -587,22 +565,19 @@ utils::TcpSocketConnection utils::TcpServerSocket::Impl::Accept() { reinterpret_cast<sockaddr*>(&client_address), &client_address_length); if (SOCKET_ERROR == client_socket) { - LOGGER_ERROR(logger_, - "Failed to accept client socket: " << WSAGetLastError()); + SDL_ERROR("Failed to accept client socket: " << WSAGetLastError()); return utils::TcpSocketConnection(); } if (AF_INET != client_address.sin_family) { - LOGGER_ERROR(logger_, - "Address of the connected client is invalid. Not AF_INET."); + SDL_ERROR("Address of the connected client is invalid. Not AF_INET."); CloseSocket(client_socket); return utils::TcpSocketConnection(); } const HostAddress accepted_client_address(client_address.sin_addr.s_addr, false); - LOGGER_DEBUG(logger_, - "Accepted new client connection " - << client_socket << " " << accepted_client_address.ToString() - << ":" << client_address.sin_port); + SDL_DEBUG("Accepted new client connection " + << client_socket << " " << accepted_client_address.ToString() << ":" + << client_address.sin_port); return TcpSocketConnection(new TcpSocketConnection::Impl( client_socket, accepted_client_address, client_address.sin_port)); } diff --git a/src/components/utils/src/system.cc b/src/components/utils/src/system.cc index c51647760e..8559d546bf 100644 --- a/src/components/utils/src/system.cc +++ b/src/components/utils/src/system.cc @@ -51,7 +51,7 @@ namespace utils { -CREATE_LOGGERPTR_LOCAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") struct GetCString { char* operator()(const std::string& string) { @@ -98,9 +98,8 @@ bool System::Execute(bool wait) { delete[] argv; if (ret == -1) { - LOGGER_ERROR(logger_, - "Can't execute command: " << command_ << " Errno is: " - << std::strerror(errno)); + SDL_ERROR("Can't execute command: " << command_ << " Errno is: " + << std::strerror(errno)); return false; } @@ -123,13 +122,13 @@ bool System::Execute(bool wait) { switch (pid_command) { case -1: { // Error - LOGGER_FATAL(logger_, "fork() failed!"); + SDL_FATAL("fork() failed!"); return false; } case 0: { // Child process int32_t fd_dev0 = open("/dev/null", O_RDWR, S_IWRITE); if (0 > fd_dev0) { - LOGGER_FATAL(logger_, "Open dev0 failed!"); + SDL_FATAL("Open dev0 failed!"); return false; } // close input/output file descriptors. @@ -149,7 +148,7 @@ bool System::Execute(bool wait) { // Execute the program. if (execvp(command_.c_str(), argv) == -1) { - LOGGER_ERROR(logger_, "Can't execute command: " << command_); + SDL_ERROR("Can't execute command: " << command_); _exit(EXIT_FAILURE); } delete[] argv; @@ -157,14 +156,14 @@ bool System::Execute(bool wait) { return true; } default: { /* Parent process */ - LOGGER_INFO(logger_, "Process created with pid " << pid_command); + SDL_INFO("Process created with pid " << pid_command); if (wait) { int status; pid_t wait_pid; do { wait_pid = waitpid(pid_command, &status, WUNTRACED | WCONTINUED); if (wait_pid == -1) { - LOGGER_ERROR_WITH_ERRNO(logger_, "Can't wait"); + SDL_ERROR_WITH_ERRNO("Can't wait"); _exit(EXIT_FAILURE); return false; } diff --git a/src/components/utils/src/threads/async_runner.cc b/src/components/utils/src/threads/async_runner.cc index 69c392b863..1568443217 100644 --- a/src/components/utils/src/threads/async_runner.cc +++ b/src/components/utils/src/threads/async_runner.cc @@ -38,27 +38,27 @@ namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "AsyncRunner"); +SDL_CREATE_LOGGER("AsyncRunner"); AsyncRunner::AsyncRunner(const std::string& thread_name) : executor_(new AsyncRunnerDelegate) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); thread_ = threads::CreateThread(thread_name.c_str(), executor_); thread_->start(); } void AsyncRunner::AsyncRun(ThreadDelegate* delegate) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); executor_->runDelegate(delegate); } void AsyncRunner::Stop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); thread_->join(); } AsyncRunner::~AsyncRunner() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); thread_->join(); delete executor_; threads::DeleteThread(thread_); @@ -81,7 +81,7 @@ void AsyncRunner::AsyncRunnerDelegate::processDelegate() { } void AsyncRunner::AsyncRunnerDelegate::waitForDelegate() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(delegates_queue_lock_); if (!stop_flag_ && delegates_queue_.empty()) { delegate_notifier_.Wait(lock); @@ -89,7 +89,7 @@ void AsyncRunner::AsyncRunnerDelegate::waitForDelegate() { } void AsyncRunner::AsyncRunnerDelegate::threadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); while (!stop_flag_) { processDelegate(); waitForDelegate(); @@ -97,14 +97,14 @@ void AsyncRunner::AsyncRunnerDelegate::threadMain() { } void AsyncRunner::AsyncRunnerDelegate::exitThreadMain() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(delegates_queue_lock_); stop_flag_ = true; delegate_notifier_.NotifyOne(); } void AsyncRunner::AsyncRunnerDelegate::runDelegate(ThreadDelegate* delegate) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock lock(delegates_queue_lock_); delegates_queue_.push(delegate); delegate_notifier_.NotifyOne(); diff --git a/src/components/utils/src/threads/posix_thread.cc b/src/components/utils/src/threads/posix_thread.cc index cfb12cc499..ed4befa281 100644 --- a/src/components/utils/src/threads/posix_thread.cc +++ b/src/components/utils/src/threads/posix_thread.cc @@ -57,7 +57,7 @@ const size_t THREAD_NAME_SIZE = 15; namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") void sleep(uint32_t ms) { #if defined(SDL_CPP11) @@ -72,7 +72,7 @@ size_t Thread::kMinStackSize = PTHREAD_STACK_MIN; /* Ubuntu : 16384 ; QNX : 256; */ void Thread::cleanup(void* arg) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Thread* thread = static_cast<Thread*>(arg); sync_primitives::AutoLock auto_lock(thread->state_lock_); thread->isThreadRunning_ = false; @@ -103,12 +103,11 @@ void* Thread::threadFunc(void* arg) { thread->state_cond_.Broadcast(); while (!thread->finalized_) { - LOGGER_DEBUG(logger_, "Thread #" << pthread_self() << " iteration"); + SDL_DEBUG("Thread #" << pthread_self() << " iteration"); thread->run_cond_.Wait(thread->state_lock_); - LOGGER_DEBUG(logger_, - "Thread #" << pthread_self() << " execute. " - << "stopped_ = " << thread->stopped_ - << "; finalized_ = " << thread->finalized_); + SDL_DEBUG("Thread #" << pthread_self() << " execute. " + << "stopped_ = " << thread->stopped_ + << "; finalized_ = " << thread->finalized_); if (!thread->stopped_ && !thread->finalized_) { thread->isThreadRunning_ = true; pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); @@ -122,14 +121,13 @@ void* Thread::threadFunc(void* arg) { thread->isThreadRunning_ = false; } thread->state_cond_.Broadcast(); - LOGGER_DEBUG(logger_, - "Thread #" << pthread_self() << " finished iteration"); + SDL_DEBUG("Thread #" << pthread_self() << " finished iteration"); } thread->state_lock_.Release(); pthread_cleanup_pop(1); - LOGGER_DEBUG(logger_, "Thread #" << pthread_self() << " exited successfully"); + SDL_DEBUG("Thread #" << pthread_self() << " exited successfully"); return NULL; } @@ -139,10 +137,8 @@ void Thread::SetNameForId(uint64_t thread_id, std::string name) { const int rc = pthread_setname_np(static_cast<pthread_t>(thread_id), name.c_str()); if (rc != EOK) { - LOGGER_WARN(logger_, - "Couldn't set pthread name \"" << name << "\", error code " - << rc << " (" << strerror(rc) - << ")"); + SDL_WARN("Couldn't set pthread name \"" << name << "\", error code " << rc + << " (" << strerror(rc) << ")"); } } @@ -169,7 +165,7 @@ bool Thread::IsCurrentThread() const { } bool Thread::start(const ThreadOptions& options) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); // 1 - state_lock locked @@ -177,16 +173,14 @@ bool Thread::start(const ThreadOptions& options) { // running = 0 if (!delegate_) { - LOGGER_ERROR(logger_, - "Cannot start thread " << name_ << ": delegate is NULL"); + SDL_ERROR("Cannot start thread " << name_ << ": delegate is NULL"); // 0 - state_lock unlocked return false; } if (isThreadRunning_) { - LOGGER_TRACE(logger_, - "EXIT thread " << name_ << " #" << handle_ - << " is already running"); + SDL_TRACE("EXIT thread " << name_ << " #" << handle_ + << " is already running"); return true; } @@ -195,20 +189,17 @@ bool Thread::start(const ThreadOptions& options) { pthread_attr_t attributes; int pthread_result = pthread_attr_init(&attributes); if (pthread_result != EOK) { - LOGGER_WARN(logger_, - "Couldn't init pthread attributes. Error code = " - << pthread_result << " (\"" << strerror(pthread_result) - << "\")"); + SDL_WARN("Couldn't init pthread attributes. Error code = " + << pthread_result << " (\"" << strerror(pthread_result) << "\")"); } if (!thread_options_.is_joinable()) { pthread_result = pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED); if (pthread_result != EOK) { - LOGGER_WARN(logger_, - "Couldn't set detach state attribute. Error code = " - << pthread_result << " (\"" << strerror(pthread_result) - << "\")"); + SDL_WARN("Couldn't set detach state attribute. Error code = " + << pthread_result << " (\"" << strerror(pthread_result) + << "\")"); thread_options_.is_joinable(false); } } @@ -217,10 +208,9 @@ bool Thread::start(const ThreadOptions& options) { if (stack_size >= Thread::kMinStackSize) { pthread_result = pthread_attr_setstacksize(&attributes, stack_size); if (pthread_result != EOK) { - LOGGER_WARN(logger_, - "Couldn't set stacksize = " - << stack_size << ". Error code = " << pthread_result - << " (\"" << strerror(pthread_result) << "\")"); + SDL_WARN("Couldn't set stacksize = " + << stack_size << ". Error code = " << pthread_result << " (\"" + << strerror(pthread_result) << "\")"); } } else { ThreadOptions thread_options_temp(Thread::kMinStackSize, @@ -232,24 +222,22 @@ bool Thread::start(const ThreadOptions& options) { // state_lock 1 pthread_result = pthread_create(&handle_, &attributes, threadFunc, this); if (pthread_result == EOK) { - LOGGER_DEBUG(logger_, "Created thread: " << name_); + SDL_DEBUG("Created thread: " << name_); SetNameForId(handle_, name_); // state_lock 0 // possible concurrencies: stop and threadFunc state_cond_.Wait(auto_lock); thread_created_ = true; } else { - LOGGER_ERROR(logger_, - "Couldn't create thread " - << name_ << ". Error code = " << pthread_result << " (\"" - << strerror(pthread_result) << "\")"); + SDL_ERROR("Couldn't create thread " + << name_ << ". Error code = " << pthread_result << " (\"" + << strerror(pthread_result) << "\")"); } } stopped_ = false; run_cond_.NotifyOne(); - LOGGER_DEBUG(logger_, - "Thread " << name_ << " #" << handle_ - << " started. pthread_result = " << pthread_result); + SDL_DEBUG("Thread " << name_ << " #" << handle_ + << " started. pthread_result = " << pthread_result); pthread_attr_destroy(&attributes); return pthread_result == EOK; } @@ -259,24 +247,22 @@ void Thread::yield() { } void Thread::stop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); stopped_ = true; - LOGGER_DEBUG(logger_, - "Stopping thread #" << handle_ << " \"" << name_ << " \""); + SDL_DEBUG("Stopping thread #" << handle_ << " \"" << name_ << " \""); if (delegate_ && isThreadRunning_) { delegate_->exitThreadMain(); } - LOGGER_DEBUG(logger_, - "Stopped thread #" << handle_ << " \"" << name_ << " \""); + SDL_DEBUG("Stopped thread #" << handle_ << " \"" << name_ << " \""); } void Thread::join() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(!IsCurrentThread()); stop(); diff --git a/src/components/utils/src/threads/pulse_thread_delegate.cc b/src/components/utils/src/threads/pulse_thread_delegate.cc index cadafd5a60..6061908530 100644 --- a/src/components/utils/src/threads/pulse_thread_delegate.cc +++ b/src/components/utils/src/threads/pulse_thread_delegate.cc @@ -37,32 +37,31 @@ namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") PulseThreadDelegate::PulseThreadDelegate() : run_(false) { - LOGGER_TRACE(logger_, "Creating QNX channel"); + SDL_TRACE("Creating QNX channel"); chid_ = ChannelCreate(0); if (chid_ == -1) { - LOGGER_ERROR(logger_, "Failed to create QNX channel"); + SDL_ERROR("Failed to create QNX channel"); return; } - LOGGER_DEBUG(logger_, "Created QNX channel " << chid_); + SDL_DEBUG("Created QNX channel " << chid_); - LOGGER_TRACE(logger_, "Connecting to QNX channel " << chid_); + SDL_TRACE("Connecting to QNX channel " << chid_); coid_ = ConnectAttach(ND_LOCAL_NODE, 0, chid_, _NTO_SIDE_CHANNEL, 0); if (coid_ == -1) { - LOGGER_ERROR(logger_, "Failed to connect to QNX channel " << chid_); + SDL_ERROR("Failed to connect to QNX channel " << chid_); return; } - LOGGER_DEBUG(logger_, "Connected to QNX channel " << chid_); + SDL_DEBUG("Connected to QNX channel " << chid_); run_ = true; } void PulseThreadDelegate::threadMain() { if (!Init()) { - LOGGER_ERROR(logger_, - "Failed to initialize thread for QNX channel " << chid_); + SDL_ERROR("Failed to initialize thread for QNX channel " << chid_); return; } while (run_) { @@ -70,9 +69,9 @@ void PulseThreadDelegate::threadMain() { SIGEV_PULSE_INIT(&event, coid_, SIGEV_PULSE_PRIO_INHERIT, PULSE_CODE, 0); if (ArmEvent(&event)) { struct _pulse pulse; - LOGGER_INFO(logger_, "Waiting for pulse on QNX channel " << chid_); + SDL_INFO("Waiting for pulse on QNX channel " << chid_); if (MsgReceivePulse(chid_, &pulse, sizeof(pulse), 0) != -1) { - LOGGER_INFO(logger_, "Received pulse on QNX channel " << chid_); + SDL_INFO("Received pulse on QNX channel " << chid_); switch (pulse.code) { case PULSE_CODE: OnPulse(); @@ -80,12 +79,10 @@ void PulseThreadDelegate::threadMain() { } } else { if (run_) { - LOGGER_WARN(logger_, - "Error occurred while waiting for pulse on QNX channel " - << chid_); + SDL_WARN("Error occurred while waiting for pulse on QNX channel " + << chid_); } else { - LOGGER_INFO(logger_, - "QNX channel " << chid_ << " is apparently destroyed"); + SDL_INFO("QNX channel " << chid_ << " is apparently destroyed"); } } } @@ -96,18 +93,18 @@ void PulseThreadDelegate::threadMain() { void PulseThreadDelegate::exitThreadMain() { run_ = false; - LOGGER_TRACE(logger_, "Disconnecting from QNX channel " << chid_); + SDL_TRACE("Disconnecting from QNX channel " << chid_); if (ConnectDetach(coid_) != -1) { - LOGGER_DEBUG(logger_, "Disconnected from QNX channel " << chid_); + SDL_DEBUG("Disconnected from QNX channel " << chid_); } else { - LOGGER_WARN(logger_, "Failed to disconnect from QNX channel " << chid_); + SDL_WARN("Failed to disconnect from QNX channel " << chid_); } - LOGGER_TRACE(logger_, "Destroying QNX channel " << chid_); + SDL_TRACE("Destroying QNX channel " << chid_); if (ChannelDestroy(chid_) != -1) { // unblocks MsgReceivePulse() - LOGGER_DEBUG(logger_, "QNX channel " << chid_ << " destroyed"); + SDL_DEBUG("QNX channel " << chid_ << " destroyed"); } else { - LOGGER_WARN(logger_, "Failed to destroy QNX channel " << chid_); + SDL_WARN("Failed to destroy QNX channel " << chid_); } } diff --git a/src/components/utils/src/threads/thread_manager.cc b/src/components/utils/src/threads/thread_manager.cc index 2959a86cb7..c27698ed85 100644 --- a/src/components/utils/src/threads/thread_manager.cc +++ b/src/components/utils/src/threads/thread_manager.cc @@ -49,6 +49,6 @@ namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") } // namespace threads diff --git a/src/components/utils/src/threads/thread_qt.cc b/src/components/utils/src/threads/thread_qt.cc index 8ba490bdd0..236933ef1a 100644 --- a/src/components/utils/src/threads/thread_qt.cc +++ b/src/components/utils/src/threads/thread_qt.cc @@ -38,7 +38,7 @@ namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") void sleep(uint32_t ms) { QThread::msleep(ms); @@ -47,16 +47,15 @@ void sleep(uint32_t ms) { size_t Thread::kMinStackSize = 0; void Thread::cleanup(void* arg) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Thread* thread = static_cast<Thread*>(arg); thread->isThreadRunning_ = false; thread->state_cond_.Broadcast(); } void* Thread::threadFunc(void* arg) { - LOGGER_DEBUG(logger_, - "Thread #" << QThread::currentThreadId() - << " started successfully"); + SDL_DEBUG("Thread #" << QThread::currentThreadId() + << " started successfully"); threads::Thread* thread = static_cast<Thread*>(arg); DCHECK(thread); @@ -69,13 +68,11 @@ void* Thread::threadFunc(void* arg) { thread->state_cond_.Broadcast(); while (!thread->finalized_) { - LOGGER_DEBUG(logger_, - "Thread #" << QThread::currentThreadId() << " iteration"); + SDL_DEBUG("Thread #" << QThread::currentThreadId() << " iteration"); thread->run_cond_.Wait(thread->state_lock_); - LOGGER_DEBUG(logger_, - "Thread #" << QThread::currentThreadId() << " execute. " - << "stopped_ = " << thread->stopped_ - << "; finalized_ = " << thread->finalized_); + SDL_DEBUG("Thread #" << QThread::currentThreadId() << " execute. " + << "stopped_ = " << thread->stopped_ + << "; finalized_ = " << thread->finalized_); if (!thread->stopped_ && !thread->finalized_) { thread->isThreadRunning_ = true; thread->state_lock_.Release(); @@ -84,15 +81,12 @@ void* Thread::threadFunc(void* arg) { thread->isThreadRunning_ = false; } thread->state_cond_.Broadcast(); - LOGGER_DEBUG(logger_, - "Thread #" << QThread::currentThreadId() - << " finished iteration"); + SDL_DEBUG("Thread #" << QThread::currentThreadId() + << " finished iteration"); } thread->state_lock_.Release(); - LOGGER_DEBUG(logger_, - "Thread #" << QThread::currentThreadId() - << " exited successfully"); + SDL_DEBUG("Thread #" << QThread::currentThreadId() << " exited successfully"); return NULL; } @@ -132,22 +126,20 @@ void Thread::ThreadCancelledExit() { } bool Thread::start(const ThreadOptions& options) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); // 1 - state_lock locked // stopped = 0 // running = 0 if (!delegate_) { - LOGGER_ERROR(logger_, - "Cannot start thread " << name_ << ": delegate is NULL"); + SDL_ERROR("Cannot start thread " << name_ << ": delegate is NULL"); // 0 - state_lock unlocked } if (isThreadRunning_) { - LOGGER_TRACE(logger_, - "EXIT thread " << name_ << " #" << handle_ - << " is already running"); + SDL_TRACE("EXIT thread " << name_ << " #" << handle_ + << " is already running"); } thread_options_ = options; @@ -157,13 +149,13 @@ bool Thread::start(const ThreadOptions& options) { // QtConcurrent::run starts execution in QThreadPool and does not return // any thread id, so thread id will be set from delegate on its start. future_ = QtConcurrent::run(threadFunc, this); - LOGGER_DEBUG(logger_, "Created thread: " << name_); + SDL_DEBUG("Created thread: " << name_); state_cond_.Wait(auto_lock); thread_created_ = true; } stopped_ = false; run_cond_.NotifyOne(); - LOGGER_DEBUG(logger_, "Thread " << name_ << " #" << handle_ << " started"); + SDL_DEBUG("Thread " << name_ << " #" << handle_ << " started"); return NULL != handle_; } @@ -172,13 +164,12 @@ void Thread::yield() { } void Thread::stop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); stopped_ = true; - LOGGER_DEBUG(logger_, - "Stopping thread #" << handle_ << " \"" << name_ << " \""); + SDL_DEBUG("Stopping thread #" << handle_ << " \"" << name_ << " \""); if (future_.isCanceled()) { cleanup(static_cast<void*>(this)); } @@ -187,12 +178,11 @@ void Thread::stop() { delegate_->exitThreadMain(); } - LOGGER_DEBUG(logger_, - "Stopped thread #" << handle_ << " \"" << name_ << " \""); + SDL_DEBUG("Stopped thread #" << handle_ << " \"" << name_ << " \""); } void Thread::join() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(!IsCurrentThread()); stop(); diff --git a/src/components/utils/src/threads/thread_validator.cc b/src/components/utils/src/threads/thread_validator.cc index ba5d1390dc..e81d5aa035 100644 --- a/src/components/utils/src/threads/thread_validator.cc +++ b/src/components/utils/src/threads/thread_validator.cc @@ -36,7 +36,7 @@ namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") SingleThreadSimpleValidator::SingleThreadSimpleValidator() : creation_thread_id_(Thread::CurrentId()) {} @@ -46,10 +46,9 @@ SingleThreadSimpleValidator::~SingleThreadSimpleValidator() {} void SingleThreadSimpleValidator::AssertRunningOnCreationThread() const { uint64_t current_id = Thread::CurrentId(); if (creation_thread_id_ != current_id) { - LOGGER_ERROR(logger_, - "Single-threaded object created at thread " - << creation_thread_id_ << " is accessed from thread " - << current_id); + SDL_ERROR("Single-threaded object created at thread " + << creation_thread_id_ << " is accessed from thread " + << current_id); } } @@ -69,10 +68,9 @@ void SingleThreadValidator::PassToThread(uint64_t thread_id) const { void SingleThreadValidator::AssertRunningOnValidThread() const { uint64_t current_id = Thread::CurrentId(); if (owning_thread_id_ != current_id) { - LOGGER_ERROR(logger_, - "Single-threaded object owned by thread " - << owning_thread_id_ << " is accessed from thread " - << current_id << "\n"); + SDL_ERROR("Single-threaded object owned by thread " + << owning_thread_id_ << " is accessed from thread " << current_id + << "\n"); } } diff --git a/src/components/utils/src/threads/win_thread.cc b/src/components/utils/src/threads/win_thread.cc index 8afc50e814..ea7d2d418c 100644 --- a/src/components/utils/src/threads/win_thread.cc +++ b/src/components/utils/src/threads/win_thread.cc @@ -44,7 +44,7 @@ const size_t THREAD_NAME_SIZE = 15; namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") void sleep(uint32_t ms) { #ifdef SDL_CPP11 @@ -59,7 +59,7 @@ void sleep(uint32_t ms) { size_t Thread::kMinStackSize = 0; void Thread::cleanup(void* arg) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); Thread* thread = static_cast<Thread*>(arg); thread->isThreadRunning_ = false; thread->state_cond_.Broadcast(); @@ -78,8 +78,7 @@ void* Thread::threadFunc(void* arg) { // stopped = 1 // running = 1 // finalized = 1 - LOGGER_DEBUG(logger_, - "Thread #" << GetCurrentThreadId() << " started successfully"); + SDL_DEBUG("Thread #" << GetCurrentThreadId() << " started successfully"); threads::Thread* thread = static_cast<Thread*>(arg); DCHECK(thread); @@ -88,12 +87,11 @@ void* Thread::threadFunc(void* arg) { thread->state_cond_.Broadcast(); while (!thread->finalized_) { - LOGGER_DEBUG(logger_, "Thread #" << GetCurrentThreadId() << " iteration"); + SDL_DEBUG("Thread #" << GetCurrentThreadId() << " iteration"); thread->run_cond_.Wait(thread->state_lock_); - LOGGER_DEBUG(logger_, - "Thread #" << GetCurrentThreadId() << " execute. " - << "stopped_ = " << thread->stopped_ - << "; finalized_ = " << thread->finalized_); + SDL_DEBUG("Thread #" << GetCurrentThreadId() << " execute. " + << "stopped_ = " << thread->stopped_ + << "; finalized_ = " << thread->finalized_); if (!thread->stopped_ && !thread->finalized_) { thread->isThreadRunning_ = true; @@ -104,14 +102,12 @@ void* Thread::threadFunc(void* arg) { thread->isThreadRunning_ = false; } thread->state_cond_.Broadcast(); - LOGGER_DEBUG(logger_, - "Thread #" << GetCurrentThreadId() << " finished iteration"); + SDL_DEBUG("Thread #" << GetCurrentThreadId() << " finished iteration"); } thread->state_lock_.Release(); - LOGGER_DEBUG(logger_, - "Thread #" << GetCurrentThreadId() << " exited successfully"); + SDL_DEBUG("Thread #" << GetCurrentThreadId() << " exited successfully"); return NULL; } @@ -140,7 +136,7 @@ bool Thread::IsCurrentThread() const { } bool Thread::start(const ThreadOptions& options) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); // 1 - state_lock locked @@ -148,16 +144,14 @@ bool Thread::start(const ThreadOptions& options) { // running = 0 if (!delegate_) { - LOGGER_ERROR(logger_, - "Cannot start thread " << name_ << ": delegate is NULL"); + SDL_ERROR("Cannot start thread " << name_ << ": delegate is NULL"); // 0 - state_lock unlocked return false; } if (isThreadRunning_) { - LOGGER_TRACE(logger_, - "EXIT thread " << name_ << " #" << handle_ - << " is already running"); + SDL_TRACE("EXIT thread " << name_ << " #" << handle_ + << " is already running"); return true; } @@ -168,18 +162,18 @@ bool Thread::start(const ThreadOptions& options) { handle_ = ::CreateThread( NULL, stack_size(), (LPTHREAD_START_ROUTINE)&threadFunc, this, 0, NULL); if (NULL != handle_) { - LOGGER_DEBUG(logger_, "Created thread: " << name_); + SDL_DEBUG("Created thread: " << name_); // state_lock 0 // possible concurrencies: stop and threadFunc state_cond_.Wait(auto_lock); thread_created_ = true; } else { - LOGGER_ERROR(logger_, "Couldn't create thread " << name_); + SDL_ERROR("Couldn't create thread " << name_); } } stopped_ = false; run_cond_.NotifyOne(); - LOGGER_DEBUG(logger_, "Thread " << name_ << " #" << handle_ << " started"); + SDL_DEBUG("Thread " << name_ << " #" << handle_ << " started"); return NULL != handle_; } @@ -188,7 +182,7 @@ void Thread::yield() { } void Thread::stop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); // We should check thread exit code for kThreadCancelledExitCode @@ -202,19 +196,17 @@ void Thread::stop() { } stopped_ = true; - LOGGER_DEBUG(logger_, - "Stopping thread #" << handle_ << " \"" << name_ << " \""); + SDL_DEBUG("Stopping thread #" << handle_ << " \"" << name_ << " \""); if (delegate_ && isThreadRunning_) { delegate_->exitThreadMain(); } - LOGGER_DEBUG(logger_, - "Stopped thread #" << handle_ << " \"" << name_ << " \""); + SDL_DEBUG("Stopped thread #" << handle_ << " \"" << name_ << " \""); } void Thread::join() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(!IsCurrentThread()); stop(); diff --git a/src/components/utils/src/timer.cc b/src/components/utils/src/timer.cc index d61200f36b..f82b491e39 100644 --- a/src/components/utils/src/timer.cc +++ b/src/components/utils/src/timer.cc @@ -41,7 +41,7 @@ #include "utils/threads/thread.h" #include "utils/threads/thread_delegate.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOGGER("Utils") timer::Timer::Timer(const std::string& name, TimerTask* task) : name_(name) @@ -50,15 +50,15 @@ timer::Timer::Timer(const std::string& name, TimerTask* task) , delegate_(this, state_lock_) , thread_(threads::CreateThread(name_.c_str(), &delegate_)) , single_shot_(true) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); DCHECK(!name_.empty()); DCHECK(task_); DCHECK(thread_); - LOGGER_DEBUG(logger_, "Timer " << name_ << " has been created"); + SDL_DEBUG("Timer " << name_ << " has been created"); } timer::Timer::~Timer() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); StopThread(); StopDelegate(); @@ -67,12 +67,12 @@ timer::Timer::~Timer() { DeleteThread(thread_); DCHECK(task_); delete task_; - LOGGER_DEBUG(logger_, "Timer " << name_ << " has been destroyed"); + SDL_DEBUG("Timer " << name_ << " has been destroyed"); } void timer::Timer::Start(const Milliseconds timeout, const TimerType timer_type) { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); StopThread(); switch (timer_type) { @@ -88,16 +88,16 @@ void timer::Timer::Start(const Milliseconds timeout, }; StartDelegate(timeout); StartThread(); - LOGGER_DEBUG(logger_, "Timer " << name_ << " has been started"); + SDL_DEBUG("Timer " << name_ << " has been started"); } void timer::Timer::Stop() { - LOGGER_AUTO_TRACE(logger_); + SDL_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); StopThread(); StopDelegate(); single_shot_ = true; - LOGGER_DEBUG(logger_, "Timer " << name_ << " has been stopped"); + SDL_DEBUG("Timer " << name_ << " has been stopped"); } bool timer::Timer::is_running() const { @@ -197,17 +197,16 @@ bool timer::Timer::TimerDelegate::finalized_flag() const { void timer::Timer::TimerDelegate::threadMain() { sync_primitives::AutoLock auto_lock(state_lock_ref_); while (!stop_flag_ && !finalized_flag_) { - LOGGER_DEBUG(logger_, "Milliseconds left to wait: " << timeout_); + SDL_DEBUG("Milliseconds left to wait: " << timeout_); if (sync_primitives::ConditionalVariable::kTimeout == state_condition_.WaitFor(auto_lock, timeout_)) { - LOGGER_DEBUG(logger_, - "Timer has finished counting. Timeout (ms): " << timeout_); + SDL_DEBUG("Timer has finished counting. Timeout (ms): " << timeout_); if (timer_) { sync_primitives::AutoUnlock auto_unlock(auto_lock); timer_->OnTimeout(); } } else { - LOGGER_DEBUG(logger_, "Timer has been force reset"); + SDL_DEBUG("Timer has been force reset"); } } } diff --git a/src/components/utils/test/auto_trace_test.cc b/src/components/utils/test/auto_trace_test.cc index 3125445261..193ee6164c 100644 --- a/src/components/utils/test/auto_trace_test.cc +++ b/src/components/utils/test/auto_trace_test.cc @@ -50,7 +50,7 @@ namespace utils_test { using namespace ::logger; -CREATE_LOGGERPTR_GLOBAL(logger_, "AutoTraceTestLog") +SDL_CREATE_LOGGER("AutoTraceTestLog") namespace { const std::string kFileName = @@ -61,7 +61,6 @@ void Preconditions() { // Delete file with previous logs if (file_system::FileExists(kFileName)) { // If logger is active now deleting log file cause undefined befaviour. - DEINIT_LOGGER(); ASSERT_TRUE(file_system::DeleteFile(kFileName)) << "Can't delete AutoTraceTestLogFile.log"; } @@ -69,13 +68,13 @@ void Preconditions() { void InitLogger() { // Set enabled logs - INIT_LOGGER(true); + logger::LoggerAutoPtr logger_(true); // DEINIT_LOGGER will be called in test_main.cc } void CreateDebugAndAutoTrace(const std::string& debug_message) { - LOGGER_AUTO_TRACE(logger_); - LOGGER_DEBUG(logger_, debug_message); + SDL_AUTO_TRACE(); + SDL_DEBUG(debug_message); } /** @@ -132,7 +131,7 @@ TEST(AutoTraceTest, DISABLED_AutoTrace_WriteToFile_ReadCorrectString) { InitLogger(); CreateDebugAndAutoTrace(debug_message); - FLUSH_LOGGER(); + SDL_FLUSH_LOGGER(); std::ifstream file_log(kFileName); ASSERT_TRUE(file_log.is_open()) << "Unable to open log file"; |