From d9a1194e6f203247ebcef4b03f8ce5ebccc7c778 Mon Sep 17 00:00:00 2001 From: Lukasz Mastalerz Date: Tue, 10 Oct 2023 08:47:37 +0200 Subject: [PATCH] [BH-1688] Create a standard for logs * Adding document describing how to use logger * Adjusting logs to follow a new guide * Change order in log header: line number is now before function name --- doc/logging_guide.md | 58 +++++++++++++++++++ .../models/AlarmsRepository.cpp | 2 - .../widgets/AlarmMusicOptionsItem.cpp | 2 +- .../widgets/AlarmTimeItem.cpp | 4 +- .../windows/ScanModesWindow.cpp | 6 +- .../application-calendar/widgets/DayLabel.cpp | 4 +- .../application-call/model/CallModel.cpp | 4 +- .../windows/EnterNumberWindow.cpp | 2 +- .../ApplicationCallLog.cpp | 5 +- .../ApplicationMessages.cpp | 4 +- .../models/SMSTemplateModel.cpp | 1 - .../models/SMSThreadModel.cpp | 2 +- .../models/ThreadsModel.cpp | 3 +- .../widgets/SMSOutputWidget.cpp | 3 +- .../windows/MessagesMainWindow.cpp | 3 +- .../windows/NewMessage.cpp | 2 +- .../windows/SMSThreadViewWindow.cpp | 4 +- .../ApplicationMusicPlayer.cpp | 2 - .../windows/MusicPlayerMainWindow.cpp | 2 +- .../windows/PhonebookContactDetails.cpp | 2 +- .../windows/PhonebookContactOptions.cpp | 4 +- .../windows/PhonebookMainWindow.cpp | 4 +- .../windows/PhonebookNamecardOptions.cpp | 4 +- .../windows/PhonebookNewContact.cpp | 8 +-- .../ApplicationSettings.cpp | 8 +-- .../bluetooth/BluetoothSettingsModel.cpp | 4 +- .../windows/SettingsMainWindow.cpp | 4 +- .../advanced/AdvancedOptionsWindow.cpp | 4 +- .../windows/apps/AlarmClockWindow.cpp | 4 +- .../windows/apps/AppsWindow.cpp | 4 +- .../windows/apps/MessagesWindow.cpp | 4 +- .../windows/apps/SoundSelectWindow.cpp | 2 +- .../display-keypad/DisplayAndKeypadWindow.cpp | 2 +- .../windows/network/NetworkWindow.cpp | 4 +- .../windows/system/DateAndTimeMainWindow.cpp | 4 +- .../windows/system/SystemMainWindow.cpp | 4 +- .../widgets/SpecialInputTableWidget.cpp | 2 +- .../application-test/ApplicationTest.cpp | 8 +-- .../application-test/windows/TestPopup.cpp | 4 +- module-apps/apps-common/ApplicationCommon.cpp | 46 +++++++-------- .../ApplicationCommonPopupBlueprints.cpp | 2 +- module-apps/apps-common/AsyncTask.cpp | 4 +- .../locks/handlers/SimLockHandler.cpp | 4 +- .../notifications/NotificationsModel.cpp | 2 +- .../options/type/OptionContact.cpp | 4 +- .../popups/lock-popups/SimSwitchingWindow.cpp | 4 +- .../popups/presenter/AlarmPresenter.cpp | 4 +- .../apps-common/widgets/ButtonTriState.cpp | 2 +- .../apps-common/widgets/TimeWidget.cpp | 14 ++--- module-apps/apps-common/windows/AppWindow.cpp | 2 +- .../Audio/Profiles/ProfileConfigUtils.cpp | 8 +-- .../Bluetooth/BluetoothWorker.cpp | 8 +-- module-bluetooth/Bluetooth/BtKeysStorage.cpp | 19 +++--- .../Bluetooth/glucode/BluetoothRunLoop.cpp | 6 +- .../glucode/btstack_uart_block_rt1051.cpp | 7 +-- .../interface/BluetoothDriverImpl.cpp | 14 +++-- .../interface/profiles/A2DP/A2DP.cpp | 4 +- .../Bluetooth/interface/profiles/SCO/SCO.cpp | 4 +- module-bsp/board/linux/usb_cdc/usb_cdc.cpp | 8 +-- module-bsp/board/linux/vibrator/vibrator.cpp | 6 +- .../linux/watchdog/software_watchdog.cpp | 4 +- module-cellular/at/src/ATFactory.cpp | 4 +- module-cellular/at/src/UrcCusd.cpp | 4 +- module-cellular/at/src/UrcQind.cpp | 4 +- module-cellular/modem/ATCommon.cpp | 4 +- module-cellular/modem/ATParser.cpp | 4 +- module-cellular/modem/ATStream.cpp | 6 +- module-cellular/modem/mux/CellularMux.cpp | 2 +- module-cellular/modem/mux/DLCChannel.cpp | 6 +- module-db/Common/Query.cpp | 4 +- module-db/Database/Database.cpp | 12 ++-- module-db/Interface/SMSRecord.cpp | 4 +- module-db/Interface/ThreadRecord.cpp | 4 +- module-db/Tables/ContactsTable.cpp | 2 +- module-gui/gui/core/DrawCommand.cpp | 2 +- module-gui/gui/core/FontManager.cpp | 2 +- module-gui/gui/core/ImageManager.cpp | 4 +- module-gui/gui/core/RawFont.cpp | 4 +- module-gui/gui/input/Profile.cpp | 4 +- .../widgets/status-bar/SignalStrengthBar.cpp | 4 +- .../text/core/cursors/TextBlockCursor.cpp | 8 +-- .../gui/widgets/text/modes/InputMode.cpp | 2 +- .../widgets/text/parsers/RichTextParser.cpp | 6 +- .../service-antenna/ServiceAntenna.cpp | 27 ++++----- .../service-audio/AudioServiceAPI.cpp | 16 ++--- .../service-audio/ServiceAudio.cpp | 11 ++-- .../service-bluetooth/ServiceBluetooth.cpp | 6 +- .../BluetoothDevicesModel.cpp | 4 +- .../service-bluetooth/SettingsHolder.cpp | 4 +- .../service-cellular/CellularServiceAPI.cpp | 10 ++-- .../service-cellular/CellularUrcHandler.cpp | 10 ++-- .../service-cellular/PacketData.cpp | 12 ++-- .../service-cellular/ServiceCellular.cpp | 18 +++--- .../service-cellular/call/CellularCall.cpp | 4 +- .../call/api/ModemCallApi.cpp | 6 +- .../service-cellular/checkSmsCenter.cpp | 4 +- .../service-cellular/src/SimCard.cpp | 4 +- .../service-cellular/src/VolteHandler.hpp | 4 +- .../service-cellular/src/VolteHandlerImpl.cpp | 6 +- .../service-cellular/src/ussd/USSDHandler.cpp | 6 +- .../src/volte/VolteCapabilityHandler.cpp | 4 +- .../volte/VolteCapabilityHandlerCellular.cpp | 4 +- .../service-db/ServiceDBCommon.cpp | 6 +- .../service-db/agents/quotes/QuotesAgent.cpp | 2 +- .../agents/quotes/RandomizedQuoteModel.cpp | 4 +- .../agents/settings/SettingsAgent.cpp | 6 +- .../service-desktop/ServiceDesktop.cpp | 9 +-- module-services/service-desktop/Sync.cpp | 35 +++++------ .../service-desktop/WorkerDesktop.cpp | 20 +++---- .../service-desktop/endpoints/Endpoint.cpp | 4 +- .../endpoints/bluetooth/BluetoothHelper.cpp | 6 +- .../developerMode/DeveloperModeHelper.cpp | 4 +- .../developerMode/Mode/UI_Helper.cpp | 2 +- .../deviceInfo/DeviceInfoEndpointCommon.cpp | 2 +- .../endpoints/filesystem/FS_Helper.cpp | 14 +---- .../endpoints/filesystem/FileContext.cpp | 4 +- .../endpoints/filesystem/FileOperations.cpp | 6 +- .../endpoints/update/UpdateHelper.cpp | 4 +- .../service-desktop/parser/MessageHandler.cpp | 4 +- .../service-desktop/parser/ParserFSM.cpp | 5 +- module-services/service-eink/ServiceEink.cpp | 5 +- .../service-fileindexer/InotifyHandler.cpp | 32 +++++----- .../ServiceFileIndexer.cpp | 5 +- .../service-fileindexer/StartupIndexer.cpp | 6 +- .../service-fileindexer/InotifyHandler.hpp | 4 +- module-services/service-gui/ServiceGUI.cpp | 5 +- module-services/service-test/ServiceTest.cpp | 6 +- .../service-time/AlarmHandlerFactory.cpp | 4 +- module-services/service-time/ServiceTime.cpp | 7 ++- module-sys/Service/Service.cpp | 2 +- module-sys/SystemManager/PowerManager.cpp | 2 +- .../SystemManager/SystemManagerCommon.cpp | 21 ++++--- module-sys/SystemWatchdog/SystemWatchdog.cpp | 4 +- module-utils/log/Logger.cpp | 4 +- module-utils/time/time/time_conversion.cpp | 2 +- .../time/time/time_date_validation.cpp | 4 +- module-utils/unicode/utf8/utf8/UTF8.cpp | 16 ++--- module-utils/utility/Utils.hpp | 4 +- .../drivers/src/thirdparty/fatfs/ff_glue.cpp | 6 +- module-vfs/src/purefs/blkdev/disk_handle.cpp | 4 +- .../src/purefs/blkdev/partition_parser.cpp | 6 +- products/BellHybrid/BellHybridMain.cpp | 4 +- products/BellHybrid/apps/Application.cpp | 2 +- .../presenters/HomeScreenPresenter.cpp | 2 +- .../windows/BellMainSetHour.cpp | 3 +- .../BellHybrid/apps/common/src/AudioModel.cpp | 4 +- .../services/audio/ServiceAudio.cpp | 5 +- .../desktop/endpoints/EndpointFactoryBell.cpp | 3 +- .../services/time/AlarmOperations.cpp | 2 +- products/PurePhone/PurePhoneMain.cpp | 6 +- .../alarms/src/actions/PlayAudioActions.cpp | 4 +- .../services/appmgr/ApplicationManager.cpp | 2 +- products/PurePhone/services/db/ServiceDB.cpp | 2 +- .../desktop/endpoints/EndpointFactoryPure.cpp | 3 +- .../endpoints/contacts/ContactHelper.cpp | 2 +- .../endpoints/messages/MessageHelper.cpp | 8 +-- .../PurePhone/services/evtmgr/WorkerEvent.cpp | 2 +- 157 files changed, 506 insertions(+), 463 deletions(-) create mode 100644 doc/logging_guide.md diff --git a/doc/logging_guide.md b/doc/logging_guide.md new file mode 100644 index 000000000..5da38b85e --- /dev/null +++ b/doc/logging_guide.md @@ -0,0 +1,58 @@ +MuditaOS Logging Guide +====================== + +This document describes how and when we should use logs and different levels of logging. +The main goal is to keep our log files as simple as possible, with only the most important data. +Following these rules should make log files shorter, easier to read and give a better understanding of what is happening +in the software. + +### Logging principles + +- Do not add any information to the log that is already included in the log prefix, such as: parent service name, file, + line number or function name. +- Do not add additional tags to the log, e.g. \[DB\], \[Desktop\], etc. +- Use magic_enum or other functions to log an enum name instead of logging an int value, unless the underlying value is + important in the particular case. +- Start logs with a capital letter. +- Logs should be statements that are easy to read and understand out of context. +- Before adding a new log line, think about whether it is important, or whether it might be useful for debugging. +- Try to keep the log message to a single line. + +### Log level description + +- INFO — This is the default level. + It should be used to inform about various actions and states that are taking place in software. + It shows the current state and helps to navigate to understand what the user has done. + It should be used to log information important from the software point of view. + +- DEBUG — This level should be used to log anything that may be important for debugging or locating the error after it + has occurred. + Note that our official release builds also have this level available. + +- WARNING — This level should be used to log anything that could potentially become an error. + +- ERROR — This level should be used to log all errors. + +- FATAL — This level should only be used to log fatal errors that could prevent the system from working properly. + Normally, logging at this level means the end of the program. + +- SENSITIVE — This level should be used to log sensitive data. + This level is behind an additional flag, and we can control whether we want to add these logs to the package or not. + By default, this level is enabled. + +- TRACE — Generally not used in MuditaOS. + +- PRINTF — This level is used to log raw information from the system. + It does not include a log header. + It should be used rarely and only when really necessary. + +### Reminder + +If you find a log in the code that does not follow the rules, try to adapt it. +This will help keep our logs in good order and prevent them from rotting. + +#### Development and Debugging + +When developing new features or debugging, feel free to use log levels without restriction. Also log all data +you may need to find solutions faster. +Before creating a PR, remember to check the logs and make sure they comply with our logging rules. \ No newline at end of file diff --git a/module-apps/application-alarm-clock/models/AlarmsRepository.cpp b/module-apps/application-alarm-clock/models/AlarmsRepository.cpp index 44015a1a8..6b89f4672 100644 --- a/module-apps/application-alarm-clock/models/AlarmsRepository.cpp +++ b/module-apps/application-alarm-clock/models/AlarmsRepository.cpp @@ -23,7 +23,6 @@ namespace app::alarmClock auto cb = [callback](auto response) { auto result = dynamic_cast(response); if (result == nullptr) { - LOG_ERROR("BAD RESULT"); return false; } if (callback) { @@ -41,7 +40,6 @@ namespace app::alarmClock auto cb = [callback](auto response) { auto result = dynamic_cast(response); if (result == nullptr) { - LOG_ERROR("BAD RESULT"); return false; } if (callback) { diff --git a/module-apps/application-alarm-clock/widgets/AlarmMusicOptionsItem.cpp b/module-apps/application-alarm-clock/widgets/AlarmMusicOptionsItem.cpp index 774d1a14f..95e723ef5 100644 --- a/module-apps/application-alarm-clock/widgets/AlarmMusicOptionsItem.cpp +++ b/module-apps/application-alarm-clock/widgets/AlarmMusicOptionsItem.cpp @@ -102,7 +102,7 @@ namespace gui const auto filePath = std::string(musicFolder) + "/" + ent.path().filename().c_str(); auto fileTags = tags::fetcher::fetchTags(filePath); musicFiles.push_back(fileTags); - LOG_DEBUG("file: %s found", ent.path().filename().c_str()); + LOG_DEBUG("File '%s' found", ent.path().filename().c_str()); } } LOG_INFO("Total number of music files found: %u", static_cast(musicFiles.size())); diff --git a/module-apps/application-alarm-clock/widgets/AlarmTimeItem.cpp b/module-apps/application-alarm-clock/widgets/AlarmTimeItem.cpp index f42999856..7793707f9 100644 --- a/module-apps/application-alarm-clock/widgets/AlarmTimeItem.cpp +++ b/module-apps/application-alarm-clock/widgets/AlarmTimeItem.cpp @@ -97,7 +97,7 @@ namespace gui hours = std::stoi(hourInput->getText().c_str()); } catch (const std::exception &e) { - LOG_INFO("AlarmTimeItem hours not valid: %s", e.what()); + LOG_ERROR("Hours not valid: %s", e.what()); hours = 0; } if ((mode24H && hours > utils::time::hoursInday - 1) || @@ -110,7 +110,7 @@ namespace gui minutes = std::stoi(minuteInput->getText().c_str()); } catch (const std::exception &e) { - LOG_INFO("AlarmTimeItem minutes not valid: %s", e.what()); + LOG_ERROR("Minutes not valid: %s", e.what()); minutes = 0; } if (minutes > utils::time::minutesInHour - 1) { diff --git a/module-apps/application-antenna/windows/ScanModesWindow.cpp b/module-apps/application-antenna/windows/ScanModesWindow.cpp index e96920637..7d65d3697 100644 --- a/module-apps/application-antenna/windows/ScanModesWindow.cpp +++ b/module-apps/application-antenna/windows/ScanModesWindow.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ScanModesWindow.hpp" @@ -64,7 +64,7 @@ namespace gui mode = std::to_string(el.first); } catch (const std::exception &e) { - LOG_ERROR("ServiceCellular::std::to_string exception %s", e.what()); + LOG_ERROR("Parse mode to string exception: %s", e.what()); } auto result = CellularServiceAPI::SetScanMode(this->application, mode); if (result) { @@ -144,7 +144,7 @@ namespace gui mode = std::stoi(data); } catch (const std::exception &e) { - LOG_ERROR("ScanModesWindow::updateCurrentMode exception %s", e.what()); + LOG_ERROR("Update mode failed: %s", e.what()); return; } if (mode < modeButtonParams.size()) { diff --git a/module-apps/application-calendar/widgets/DayLabel.cpp b/module-apps/application-calendar/widgets/DayLabel.cpp index c4e50ea4c..3d23323ec 100644 --- a/module-apps/application-calendar/widgets/DayLabel.cpp +++ b/module-apps/application-calendar/widgets/DayLabel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "DayLabel.hpp" @@ -95,7 +95,7 @@ namespace gui return result; } catch (std::exception &e) { - LOG_ERROR("DayLabel::getDayNumber: %s", e.what()); + LOG_ERROR("Exception: %s", e.what()); return 0; } } diff --git a/module-apps/application-call/model/CallModel.cpp b/module-apps/application-call/model/CallModel.cpp index 0a9c9aac5..ffab04619 100644 --- a/module-apps/application-call/model/CallModel.cpp +++ b/module-apps/application-call/model/CallModel.cpp @@ -180,11 +180,11 @@ namespace app::call auto contact = DBServiceAPI::MatchContactByPhoneNumber(application, phoneNumber.getView()); if (contact && !contact->isTemporary()) { - LOG_INFO("number recognized as contact id = %" PRIu32, contact->ID); + LOG_INFO("Number recognized as contact id = %" PRIu32, contact->ID); callerId = contact->getFormattedName(); } else { - LOG_INFO("number was not recognized as any valid contact"); + LOG_INFO("Number was not recognized as any valid contact"); callerId = UTF8(phoneNumber.getFormatted()); } diff --git a/module-apps/application-call/windows/EnterNumberWindow.cpp b/module-apps/application-call/windows/EnterNumberWindow.cpp index 7fa1b58d1..e33059619 100644 --- a/module-apps/application-call/windows/EnterNumberWindow.cpp +++ b/module-apps/application-call/windows/EnterNumberWindow.cpp @@ -57,7 +57,7 @@ namespace gui bool EnterNumberWindow::handleSwitchData(SwitchData *data) { if (data == nullptr) { - LOG_ERROR("Received null pointer"); + LOG_ERROR("No data received"); return false; } diff --git a/module-apps/application-calllog/ApplicationCallLog.cpp b/module-apps/application-calllog/ApplicationCallLog.cpp index 8bfb84a1b..2154a0a79 100644 --- a/module-apps/application-calllog/ApplicationCallLog.cpp +++ b/module-apps/application-calllog/ApplicationCallLog.cpp @@ -44,7 +44,6 @@ namespace app ApplicationCallLog::~ApplicationCallLog() { - LOG_INFO("ApplicationCallLog::destroy"); } // Invoked upon receiving data message @@ -117,7 +116,7 @@ namespace app bool ApplicationCallLog::removeCalllogEntry(const CalllogRecord &record) { - LOG_DEBUG("Removing CalllogRecord: %" PRIu32, record.ID); + LOG_DEBUG("Removing call log record: %" PRIu32, record.ID); auto metaData = std::make_unique( gui::DialogMetadata{record.name, "delete_128px_W_G", @@ -125,7 +124,7 @@ namespace app "", [=]() -> bool { if (DBServiceAPI::CalllogRemove(this, record.ID) == false) { - LOG_ERROR("CalllogRemove id=%" PRIu32 " failed", record.ID); + LOG_ERROR("Call log remove id=%" PRIu32 " failed", record.ID); return false; } this->switchWindow(calllog::settings::MainWindowStr); diff --git a/module-apps/application-messages/ApplicationMessages.cpp b/module-apps/application-messages/ApplicationMessages.cpp index df77ada81..cdf6ab756 100644 --- a/module-apps/application-messages/ApplicationMessages.cpp +++ b/module-apps/application-messages/ApplicationMessages.cpp @@ -257,7 +257,7 @@ namespace app switchWindow(gui::name::window::main_window); return true; } - LOG_ERROR("ThreadRemove id=%" PRIu32 " failed", threadId); + LOG_ERROR("Thread remove id=%" PRIu32 " failed", threadId); return false; }); task->execute(this, this); @@ -308,7 +308,7 @@ namespace app task->execute(this, this); return true; } - LOG_ERROR("sSMSRemove id=%" PRIu32 " failed", record.ID); + LOG_ERROR("SMS remove id=%" PRIu32 " failed", record.ID); return false; }); task->execute(this, this); diff --git a/module-apps/application-messages/models/SMSTemplateModel.cpp b/module-apps/application-messages/models/SMSTemplateModel.cpp index 421e7664d..487534096 100644 --- a/module-apps/application-messages/models/SMSTemplateModel.cpp +++ b/module-apps/application-messages/models/SMSTemplateModel.cpp @@ -41,7 +41,6 @@ gui::ListItem *SMSTemplateModel::getItem(gui::Order order) auto item = new gui::SMSTemplateItem(); item->setTemplate(templ); item->activatedCallback = [=](gui::Item &it) { - LOG_INFO("activatedCallback"); if (auto app = dynamic_cast(application)) { if (app->templatesCallback) { return app->templatesCallback(templ); diff --git a/module-apps/application-messages/models/SMSThreadModel.cpp b/module-apps/application-messages/models/SMSThreadModel.cpp index d3cfe4010..77668b595 100644 --- a/module-apps/application-messages/models/SMSThreadModel.cpp +++ b/module-apps/application-messages/models/SMSThreadModel.cpp @@ -108,7 +108,7 @@ void SMSThreadModel::addReturnNumber() assert(app != nullptr); assert(smsInput->number != nullptr); if (!app->handleSendSmsFromThread(*smsInput->number, smsInput->inputText->getText())) { - LOG_ERROR("handleSendSmsFromThread failed"); + LOG_ERROR("Send SMS from thread failed"); } smsInput->clearDraftMessage(); return true; diff --git a/module-apps/application-messages/models/ThreadsModel.cpp b/module-apps/application-messages/models/ThreadsModel.cpp index a0e44b514..92a886b9e 100644 --- a/module-apps/application-messages/models/ThreadsModel.cpp +++ b/module-apps/application-messages/models/ThreadsModel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "MessagesStyle.hpp" @@ -35,7 +35,6 @@ auto ThreadsModel::getItem(gui::Order order) -> gui::ListItem * auto item = gui::ThreadItem::makeThreadItem(threadStruct); item->activatedCallback = [this, threadStruct](gui::Item &item) { - LOG_INFO("ThreadItem ActivatedCallback"); if (application) { const auto &threadItem = static_cast(item); application->switchWindow( diff --git a/module-apps/application-messages/widgets/SMSOutputWidget.cpp b/module-apps/application-messages/widgets/SMSOutputWidget.cpp index a44f7e4ed..03afd31ac 100644 --- a/module-apps/application-messages/widgets/SMSOutputWidget.cpp +++ b/module-apps/application-messages/widgets/SMSOutputWidget.cpp @@ -58,7 +58,7 @@ namespace gui body->addWidget(smsBubble); break; case SMSType::DRAFT: - LOG_ERROR("Can't handle Draft type message in smsBubble"); + LOG_ERROR("Can't handle draft type message in smsBubble"); break; default: break; @@ -87,7 +87,6 @@ namespace gui smsBubble->inputCallback = [application, record](Item &, const InputEvent &event) { if (event.isShortRelease(KeyCode::KEY_LF)) { - LOG_INFO("Message activated!"); auto app = dynamic_cast(application); assert(app != nullptr); app->switchWindow(gui::name::window::sms_options, std::make_unique(*record)); diff --git a/module-apps/application-messages/windows/MessagesMainWindow.cpp b/module-apps/application-messages/windows/MessagesMainWindow.cpp index 7975d8cbe..fb299880d 100644 --- a/module-apps/application-messages/windows/MessagesMainWindow.cpp +++ b/module-apps/application-messages/windows/MessagesMainWindow.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ApplicationMessages.hpp" @@ -103,7 +103,6 @@ namespace gui void MessagesMainWindow::onBeforeShow(ShowMode mode, SwitchData *data) { - LOG_INFO("Data: %s", data ? data->getDescription().c_str() : ""); { auto pdata = dynamic_cast(data); if (pdata != nullptr) { diff --git a/module-apps/application-messages/windows/NewMessage.cpp b/module-apps/application-messages/windows/NewMessage.cpp index 79be59518..42e1db141 100644 --- a/module-apps/application-messages/windows/NewMessage.cpp +++ b/module-apps/application-messages/windows/NewMessage.cpp @@ -283,7 +283,7 @@ namespace gui return false; } if (!sendSms()) { - LOG_ERROR("sendSms failed"); + LOG_ERROR("Send SMS failed"); } return true; }; diff --git a/module-apps/application-messages/windows/SMSThreadViewWindow.cpp b/module-apps/application-messages/windows/SMSThreadViewWindow.cpp index 7b5ac6b7f..f277de27f 100644 --- a/module-apps/application-messages/windows/SMSThreadViewWindow.cpp +++ b/module-apps/application-messages/windows/SMSThreadViewWindow.cpp @@ -91,7 +91,7 @@ namespace gui } if (const auto pdata = dynamic_cast(data); pdata != nullptr) { - LOG_INFO("Thread data received: %" PRIu32, pdata->thread->ID); + LOG_DEBUG("Thread data received: %" PRIu32, pdata->thread->ID); saveInfoAboutPreviousAppForProperSwitchBack(data); smsModel->numberID = pdata->thread->numberID; @@ -110,7 +110,7 @@ namespace gui } if (const auto pdata = dynamic_cast(data); pdata != nullptr) { - LOG_INFO("received sms templates data"); + LOG_DEBUG("Received sms templates data"); if (pdata->concatenate == SMSTextData::Concatenate::True) { smsModel->smsInput->inputText->addText(pdata->text); } diff --git a/module-apps/application-music-player/ApplicationMusicPlayer.cpp b/module-apps/application-music-player/ApplicationMusicPlayer.cpp index 73ffa9fb8..d394189c2 100644 --- a/module-apps/application-music-player/ApplicationMusicPlayer.cpp +++ b/module-apps/application-music-player/ApplicationMusicPlayer.cpp @@ -42,8 +42,6 @@ namespace app std::move(name), std::move(parent), statusIndicators, startInBackground, applicationMusicPlayerStackSize), priv{std::make_unique()} { - LOG_INFO("ApplicationMusicPlayer creating"); - bus.channels.push_back(sys::BusChannel::ServiceAudioNotifications); const auto paths = std::vector{purefs::dir::getUserMediaPath()}; diff --git a/module-apps/application-music-player/windows/MusicPlayerMainWindow.cpp b/module-apps/application-music-player/windows/MusicPlayerMainWindow.cpp index f689eefcc..a4eb21385 100644 --- a/module-apps/application-music-player/windows/MusicPlayerMainWindow.cpp +++ b/module-apps/application-music-player/windows/MusicPlayerMainWindow.cpp @@ -177,7 +177,7 @@ namespace gui if (window.empty()) { return true; } - LOG_INFO("switching to window %s", window.c_str()); + LOG_DEBUG("Switching to window %s", window.c_str()); application->switchWindow(window, nullptr); return true; }, diff --git a/module-apps/application-phonebook/windows/PhonebookContactDetails.cpp b/module-apps/application-phonebook/windows/PhonebookContactDetails.cpp index 0ab776fe0..6214eb182 100644 --- a/module-apps/application-phonebook/windows/PhonebookContactDetails.cpp +++ b/module-apps/application-phonebook/windows/PhonebookContactDetails.cpp @@ -74,7 +74,7 @@ namespace gui contactFlagsWidget->setSpeedDial(true, position); } catch (std::exception &e) { - LOG_ERROR("PhonebookContactDetails::onBeforeShow: %s", e.what()); + LOG_ERROR("Exception during setting speed dial: %s", e.what()); contactFlagsWidget->setSpeedDial(false, 0); } } diff --git a/module-apps/application-phonebook/windows/PhonebookContactOptions.cpp b/module-apps/application-phonebook/windows/PhonebookContactOptions.cpp index e6575f0d5..24669683f 100644 --- a/module-apps/application-phonebook/windows/PhonebookContactOptions.cpp +++ b/module-apps/application-phonebook/windows/PhonebookContactOptions.cpp @@ -23,7 +23,7 @@ namespace gui { auto *item = dynamic_cast(data); if (item == nullptr) { - LOG_WARN("Received null pointer"); + LOG_WARN("Failed to get phonebook data"); return false; } contact = item->getContact(); @@ -79,7 +79,7 @@ namespace gui "", [=]() -> bool { if (!DBServiceAPI::ContactRemove(this->application, contact->ID)) { - LOG_ERROR("Contact id=%" PRIu32 " remove failed", contact->ID); + LOG_ERROR("Failed to remove contact (id: %" PRIu32 ")", contact->ID); return false; } showNotification(NotificationType::Delete); diff --git a/module-apps/application-phonebook/windows/PhonebookMainWindow.cpp b/module-apps/application-phonebook/windows/PhonebookMainWindow.cpp index 975317b54..59ff517ef 100644 --- a/module-apps/application-phonebook/windows/PhonebookMainWindow.cpp +++ b/module-apps/application-phonebook/windows/PhonebookMainWindow.cpp @@ -111,7 +111,7 @@ namespace gui const auto code = translator.handle(inputEvent.getRawKey(), inputMode ? inputMode->get() : ""); if (code != Profile::none_key) { const auto letter = static_cast(code); - LOG_INFO("char=' %c'", letter); + LOG_DEBUG("Filtering by char=' %c'", letter); std::string filterLetter; filterLetter.push_back(letter); @@ -119,7 +119,7 @@ namespace gui LOG_DEBUG("Number of favourites contacts : %" PRIu32, phonebookModel->letterMap.favouritesCount); const auto dataOffset = phonebookModel->letterMap.firstLetterDictionary[filterLetter]; if (dataOffset != phonebookContactsMap::NO_MATCH_FOUND) { - LOG_DEBUG("PhoneBook Data Offset : %" PRIu32, dataOffset); + LOG_DEBUG("Phonebook data offset : %" PRIu32, dataOffset); phonebookModel->setDisplayMode(static_cast(ContactDisplayMode::SortedByLetter)); contactsList->rebuildList(gui::listview::RebuildType::OnOffset, dataOffset); } diff --git a/module-apps/application-phonebook/windows/PhonebookNamecardOptions.cpp b/module-apps/application-phonebook/windows/PhonebookNamecardOptions.cpp index db7a987ed..0e99c786b 100644 --- a/module-apps/application-phonebook/windows/PhonebookNamecardOptions.cpp +++ b/module-apps/application-phonebook/windows/PhonebookNamecardOptions.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -20,7 +20,7 @@ namespace gui { auto *item = dynamic_cast(data); if (item == nullptr) { - LOG_WARN("Received null pointer"); + LOG_ERROR("Failed to get phonebook data"); return false; } diff --git a/module-apps/application-phonebook/windows/PhonebookNewContact.cpp b/module-apps/application-phonebook/windows/PhonebookNewContact.cpp index bae32a404..4bfb55b9a 100644 --- a/module-apps/application-phonebook/windows/PhonebookNewContact.cpp +++ b/module-apps/application-phonebook/windows/PhonebookNewContact.cpp @@ -212,7 +212,7 @@ namespace gui if (contactAction == ContactAction::Add) { auto returnedContact = DBServiceAPI::ContactAdd(application, *contact); if (!returnedContact.has_value()) { - LOG_ERROR("verifyAndSave failed to ADD contact"); + LOG_ERROR("Failed to add contact"); return false; } *contact = returnedContact.value(); @@ -225,7 +225,7 @@ namespace gui return false; } else if (!DBServiceAPI::ContactUpdate(application, *contact)) { - LOG_ERROR("verifyAndSave failed to UPDATE contact"); + LOG_ERROR("Failed to update contact"); return false; } } @@ -258,7 +258,7 @@ namespace gui contact->ID = oldContactRecord.ID; } if (!DBServiceAPI::ContactUpdate(application, *contact)) { - LOG_ERROR("Contact id=%" PRIu32 " update failed", contact->ID); + LOG_ERROR("Failed to update contact (id: %" PRIu32 ")", contact->ID); return false; } @@ -303,7 +303,7 @@ namespace gui contact->speeddial, [=]() -> bool { if (!DBServiceAPI::ContactUpdate(application, *contact)) { - LOG_ERROR("Contact id=%" PRIu32 " update failed", contact->ID); + LOG_ERROR("Failed to update contact (id: %" PRIu32 ")", contact->ID); return false; } application->switchWindow(gui::name::window::main_window); diff --git a/module-apps/application-settings/ApplicationSettings.cpp b/module-apps/application-settings/ApplicationSettings.cpp index 0ad749f0e..0f3c6b5ed 100644 --- a/module-apps/application-settings/ApplicationSettings.cpp +++ b/module-apps/application-settings/ApplicationSettings.cpp @@ -651,26 +651,26 @@ namespace app void ApplicationSettings::operatorOnChanged(const std::string &value) { - LOG_DEBUG("[ApplicationSettings::operatorOnChanged] value=%s", value.c_str()); + LOG_DEBUG("OperatorOn changed: %s", value.c_str()); if (!value.empty()) { operatorsOn = utils::getNumericValue(value); } } bool ApplicationSettings::getOperatorsOn() const noexcept { - LOG_DEBUG("[ApplicationSettings::getOperatorsOn] %d", operatorsOn); + LOG_DEBUG("OperatorOn: %d", operatorsOn); return operatorsOn; } void ApplicationSettings::setOperatorsOn(bool value) { operatorsOn = value; - LOG_DEBUG("[ApplicationSettings::setOperatorsOn] to %d", operatorsOn); + LOG_DEBUG("New OperatorOn: %d", operatorsOn); settings->setValue(settings::operators_on, std::to_string(static_cast(value))); } void ApplicationSettings::setOsUpdateVersion(const std::string &value) { - LOG_DEBUG("[ApplicationSettings::setOsUpdateVersion] to value=%s", value.c_str()); + LOG_DEBUG("New OS version: %s", value.c_str()); settings->setValue(::settings::SystemProperties::osUpdateVersion, value, ::settings::SettingsScope::Global); } diff --git a/module-apps/application-settings/models/bluetooth/BluetoothSettingsModel.cpp b/module-apps/application-settings/models/bluetooth/BluetoothSettingsModel.cpp index b34c4c5ba..39363162f 100644 --- a/module-apps/application-settings/models/bluetooth/BluetoothSettingsModel.cpp +++ b/module-apps/application-settings/models/bluetooth/BluetoothSettingsModel.cpp @@ -97,7 +97,7 @@ auto BluetoothSettingsModel::getActiveDevice() -> std::optional std::optional mainWindowOptionsNew(app::ApplicationCommon *app) if (window.empty()) { return false; } - LOG_INFO("switching to %s page", window.c_str()); + LOG_DEBUG("Switching to %s page", window.c_str()); app->switchWindow(window, nullptr); return true; }, diff --git a/module-apps/application-settings/windows/advanced/AdvancedOptionsWindow.cpp b/module-apps/application-settings/windows/advanced/AdvancedOptionsWindow.cpp index 6fd8a9dad..64aac54e2 100644 --- a/module-apps/application-settings/windows/advanced/AdvancedOptionsWindow.cpp +++ b/module-apps/application-settings/windows/advanced/AdvancedOptionsWindow.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "AdvancedOptionsWindow.hpp" @@ -16,7 +16,7 @@ std::list advancedOptions(app::ApplicationCommon *app) if (window.empty()) { return false; } - LOG_INFO("switching to %s page", window.c_str()); + LOG_DEBUG("Switching to %s page", window.c_str()); app->switchWindow(window, nullptr); return true; }, diff --git a/module-apps/application-settings/windows/apps/AlarmClockWindow.cpp b/module-apps/application-settings/windows/apps/AlarmClockWindow.cpp index 7240e9f68..100d587e2 100644 --- a/module-apps/application-settings/windows/apps/AlarmClockWindow.cpp +++ b/module-apps/application-settings/windows/apps/AlarmClockWindow.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "AlarmClockWindow.hpp" @@ -65,7 +65,7 @@ namespace gui void AlarmClockWindow::setVolume(uint8_t vol) { - LOG_INFO("setVolume %d", static_cast(vol)); + LOG_INFO("New volume: %d", vol); mAudioModel->setVolume(vol); } diff --git a/module-apps/application-settings/windows/apps/AppsWindow.cpp b/module-apps/application-settings/windows/apps/AppsWindow.cpp index 0c0a4ae22..43d990ca4 100644 --- a/module-apps/application-settings/windows/apps/AppsWindow.cpp +++ b/module-apps/application-settings/windows/apps/AppsWindow.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "AppsWindow.hpp" @@ -24,7 +24,7 @@ namespace gui if (window.empty()) { return false; } - LOG_INFO("switching to %s page", window.c_str()); + LOG_DEBUG("Switching to %s page", window.c_str()); application->switchWindow(window, nullptr); return true; }, diff --git a/module-apps/application-settings/windows/apps/MessagesWindow.cpp b/module-apps/application-settings/windows/apps/MessagesWindow.cpp index 5849141b6..1d309739c 100644 --- a/module-apps/application-settings/windows/apps/MessagesWindow.cpp +++ b/module-apps/application-settings/windows/apps/MessagesWindow.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "MessagesWindow.hpp" @@ -62,7 +62,7 @@ namespace gui void MessagesWindow::switchShowUnreadFirst() { mShowUnreadMessagesFirst = !mShowUnreadMessagesFirst; - LOG_INFO("switchSoundState %d", static_cast(mSoundEnabled)); + LOG_INFO("Switch sound state: %d", static_cast(mSoundEnabled)); refreshOptionsList(); } diff --git a/module-apps/application-settings/windows/apps/SoundSelectWindow.cpp b/module-apps/application-settings/windows/apps/SoundSelectWindow.cpp index 346e7666a..07068b012 100644 --- a/module-apps/application-settings/windows/apps/SoundSelectWindow.cpp +++ b/module-apps/application-settings/windows/apps/SoundSelectWindow.cpp @@ -52,7 +52,7 @@ namespace gui { const auto info = dynamic_cast(data); if (info == nullptr) { - LOG_ERROR("Null switch data pointer!"); + LOG_ERROR("Failed to get a sound data!"); return; } diff --git a/module-apps/application-settings/windows/display-keypad/DisplayAndKeypadWindow.cpp b/module-apps/application-settings/windows/display-keypad/DisplayAndKeypadWindow.cpp index cf7cd24cf..8edc0029a 100644 --- a/module-apps/application-settings/windows/display-keypad/DisplayAndKeypadWindow.cpp +++ b/module-apps/application-settings/windows/display-keypad/DisplayAndKeypadWindow.cpp @@ -27,7 +27,7 @@ namespace gui if (window.empty()) { return false; } - LOG_INFO("switching to %s page", window.c_str()); + LOG_DEBUG("Switching to %s page", window.c_str()); application->switchWindow(window, nullptr); return true; }, diff --git a/module-apps/application-settings/windows/network/NetworkWindow.cpp b/module-apps/application-settings/windows/network/NetworkWindow.cpp index c8022c1a9..435d7c38d 100644 --- a/module-apps/application-settings/windows/network/NetworkWindow.cpp +++ b/module-apps/application-settings/windows/network/NetworkWindow.cpp @@ -62,7 +62,7 @@ namespace gui settingsApp->sendVolteChangeRequest(false); break; default: - LOG_INFO("[VoLTE] skip request due to unsettled VoLTE state"); + LOG_INFO("VoLTE state is unsettled, skipping request"); break; } @@ -131,7 +131,7 @@ namespace gui auto labelText = "" + utils::translate("app_settings_network_voice_over_lte"); if (!volteState.permitted) { if (volteState.enablement == cellular::VolteState::Enablement::On) { - LOG_ERROR("[VoLTE] still enabled in modem despite not permitted by operator"); + LOG_ERROR("VoLTE still enabled in modem despite not permitted by operator"); } labelText += ": "; labelText += utils::translate("app_settings_network_volte_not_available"); diff --git a/module-apps/application-settings/windows/system/DateAndTimeMainWindow.cpp b/module-apps/application-settings/windows/system/DateAndTimeMainWindow.cpp index 06dca88ca..78f9af864 100644 --- a/module-apps/application-settings/windows/system/DateAndTimeMainWindow.cpp +++ b/module-apps/application-settings/windows/system/DateAndTimeMainWindow.cpp @@ -63,12 +63,12 @@ namespace gui if (!automaticDateAndTimeIsOn) { addOption(utils::translate("app_settings_date_and_time_change_time_zone"), [=](Item &item) { - LOG_INFO("switching to %s page", window::name::change_time_zone); + LOG_DEBUG("Switching to %s page", window::name::change_time_zone); application->switchWindow(window::name::change_time_zone, nullptr); return true; }); addOption(utils::translate("app_settings_date_and_time_change_date_and_time"), [=](Item &item) { - LOG_INFO("switching to %s page", changeDateAndTimeWindow.c_str()); + LOG_DEBUG("Switching to %s page", changeDateAndTimeWindow.c_str()); application->switchWindow(changeDateAndTimeWindow, nullptr); return true; }); diff --git a/module-apps/application-settings/windows/system/SystemMainWindow.cpp b/module-apps/application-settings/windows/system/SystemMainWindow.cpp index acf2a268d..d5c622f87 100644 --- a/module-apps/application-settings/windows/system/SystemMainWindow.cpp +++ b/module-apps/application-settings/windows/system/SystemMainWindow.cpp @@ -23,7 +23,7 @@ namespace gui optionList.emplace_back(std::make_unique( utils::translate(name), [=](Item &item) { - LOG_INFO("switching to %s page", window.c_str()); + LOG_DEBUG("Switching to %s page", window.c_str()); application->switchWindow(window, nullptr); return true; }, @@ -45,7 +45,7 @@ namespace gui sys::SystemManagerCommon::FactoryReset(application); return true; }}); - LOG_INFO("switching to %s page", window.c_str()); + LOG_DEBUG("Switching to %s page", window.c_str()); application->switchWindow(window, gui::ShowMode::GUI_SHOW_INIT, std::move(metaData)); return true; }, diff --git a/module-apps/application-special-input/widgets/SpecialInputTableWidget.cpp b/module-apps/application-special-input/widgets/SpecialInputTableWidget.cpp index 2fb3dc59c..8f22e1844 100644 --- a/module-apps/application-special-input/widgets/SpecialInputTableWidget.cpp +++ b/module-apps/application-special-input/widgets/SpecialInputTableWidget.cpp @@ -76,7 +76,7 @@ namespace gui it->activatedCallback = [=](Item &it) { setFocusItem(nullptr); - LOG_INFO("handled special char for %s", application->getCurrentWindow()->getName().c_str()); + LOG_INFO("Handled special char for %s", application->getCurrentWindow()->getName().c_str()); auto switchData = std::make_unique(gui::SwitchSpecialChar::Type::Response, app->requester, str); diff --git a/module-apps/application-test/ApplicationTest.cpp b/module-apps/application-test/ApplicationTest.cpp index d689905cb..76757b4fc 100644 --- a/module-apps/application-test/ApplicationTest.cpp +++ b/module-apps/application-test/ApplicationTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "application-test/ApplicationTest.hpp" @@ -15,7 +15,7 @@ namespace app StartInBackground startInBackground) : Application(name, parent, statusIndicators, startInBackground) { - LOG_INFO("created!"); + LOG_INFO("Created!"); } ApplicationTest::~ApplicationTest() @@ -25,14 +25,14 @@ namespace app sys::ReturnCodes ApplicationTest::InitHandler() { - LOG_INFO("initializing!"); + LOG_INFO("Initializing!"); // NOTE // this is very important! as it: // 1. sets state initializing on app // 2. initailizes settigns - every app have settings object by default const auto ret = Application::InitHandler(); if (ret != sys::ReturnCodes::Success) { - LOG_ERROR("init app failure! %d", int(ret)); + LOG_ERROR("Init app failure! %d", int(ret)); return ret; } createUserInterface(); diff --git a/module-apps/application-test/windows/TestPopup.cpp b/module-apps/application-test/windows/TestPopup.cpp index 2ed44aec5..ce8e6037e 100644 --- a/module-apps/application-test/windows/TestPopup.cpp +++ b/module-apps/application-test/windows/TestPopup.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "LocalStyle.hpp" @@ -11,7 +11,7 @@ namespace gui TestPopupWindow::TestPopupWindow(app::ApplicationCommon *app, const std::string &name) : AppWindow(app, name) { - LOG_INFO("popup build!"); + LOG_INFO("Pop-up build!"); buildInterface(); } diff --git a/module-apps/apps-common/ApplicationCommon.cpp b/module-apps/apps-common/ApplicationCommon.cpp index 06586188a..a2bdcd772 100644 --- a/module-apps/apps-common/ApplicationCommon.cpp +++ b/module-apps/apps-common/ApplicationCommon.cpp @@ -267,10 +267,10 @@ namespace app std::string window; #if DEBUG_APPLICATION_MANAGEMENT == 1 - LOG_INFO("switching [%s] to window: %s data description: %s", - GetName().c_str(), - windowName.length() ? windowName.c_str() : default_window.c_str(), - data ? data->getDescription().c_str() : ""); + LOG_DEBUG("Switching [%s] to window: %s data description: %s", + GetName().c_str(), + windowName.length() ? windowName.c_str() : default_window.c_str(), + data ? data->getDescription().c_str() : ""); #endif // case to handle returning to previous application @@ -434,7 +434,7 @@ namespace app sys::MessagePointer ApplicationCommon::handleKBDKeyEvent(sys::Message *msgl) { if (this->getState() != app::ApplicationCommon::State::ACTIVE_FORGROUND) { - LOG_FATAL("!!! Terrible terrible damage! application with no focus grabbed key!"); + LOG_FATAL("Terrible terrible damage! Application with no focus grabbed key!"); } const auto msg = static_cast(msgl); const auto inputEvent = keyTranslator->translate(msg->key); @@ -489,7 +489,7 @@ namespace app auto result = actionHandler(std::move(data)); if (getState() == State::ACTIVE_FORGROUND && windowsStack().isEmpty()) { - LOG_ERROR("OnAction application switch with no window provided. Fallback to default mainWindow."); + LOG_ERROR("Application switch with no window provided. Fallback to default mainWindow."); pushWindow(default_window); } @@ -518,8 +518,8 @@ namespace app sys::MessagePointer ApplicationCommon::handleApplicationSwitchLaunch(sys::Message *msgl) { const auto msg = static_cast(msgl); - bool handled = false; - LOG_DEBUG("AppSwitch: %s", msg->getTargetApplicationName().c_str()); + bool handled = false; + LOG_DEBUG("Application switch: %s", msg->getTargetApplicationName().c_str()); // Application is starting or it is in the background. Upon switch command if name is correct it goes // foreground if ((state == State::ACTIVATING) || (state == State::INITIALIZING) || (state == State::ACTIVE_BACKGROUND)) { @@ -527,9 +527,9 @@ namespace app if (msg->getTargetApplicationName() == this->GetName()) { setState(State::ACTIVE_FORGROUND); if (app::manager::Controller::confirmSwitch(this)) { - LOG_INFO("target Window: %s : target description: %s", - msg->getTargetWindowName().c_str(), - msg->getData() ? msg->getData()->getDescription().c_str() : ""); + LOG_DEBUG("Target window: %s : target description: %s", + msg->getTargetWindowName().c_str(), + msg->getData() ? msg->getData()->getDescription().c_str() : ""); switchWindow(msg->getTargetWindowName(), std::move(msg->getData())); handled = true; } @@ -650,7 +650,7 @@ namespace app refreshWindow(msg->getRefreshMode()); } else { - LOG_ERROR("cant update window: %s in app: %s, params: haveBuilder: %s is_on_top: %s", + LOG_ERROR("Can't update window: '%s' in app: '%s', params: haveBuilder: %s is_on_top: %s", msg->getWindowName().c_str(), GetName().c_str(), haveBuilder ? "yes" : "no", @@ -681,7 +681,7 @@ namespace app void ApplicationCommon::checkBlockingRequests() { if (getState() == State::FINALIZING_CLOSE && !callbackStorage->checkBlockingCloseRequests()) { - LOG_INFO("Blocking requests done for [%s]. Closing application.", GetName().c_str()); + LOG_INFO("Blocking requests done for '%s'. Closing application.", GetName().c_str()); setState(State::DEACTIVATING); app::manager::Controller::confirmClose(this); } @@ -721,7 +721,7 @@ namespace app } const auto window = getCurrentWindow(); if (window == nullptr) { - LOG_ERROR("No window - can't dump DOM"); + LOG_ERROR("Failed to get current window"); return sys::msgNotHandled(); } @@ -767,7 +767,7 @@ namespace app { settings->deinit(); LOG_INFO("Closing an application: %s", GetName().c_str()); - LOG_INFO("Deleting windows"); + LOG_DEBUG("Deleting windows"); windowsStack().clear(); return sys::ReturnCodes::Success; } @@ -856,16 +856,16 @@ namespace app const auto topOfWindowsStackId = windowsStack().getWindowData(app::topWindow)->disposition.id; if (data->ignoreIfTheSamePopupIsOnTopOfTheStack && id == topOfWindowsStackId) { - LOG_WARN("ignoring popup because the same is already on the top of the stack"); + LOG_WARN("Ignoring popup because the same is already on the top of the stack"); return; } if (!blueprint) { - LOG_ERROR("no blueprint to handle %s popup - fallback", std::string(magic_enum::enum_name(id)).c_str()); + LOG_ERROR("No blueprint to handle %s popup - fallback", std::string(magic_enum::enum_name(id)).c_str()); blueprint = popupBlueprintFallback(id); } if (data->getDisposition().windowtype != gui::popup::Disposition::WindowType::Popup) { - LOG_ERROR("setting popup window type from %s to popup - fallback", + LOG_ERROR("Setting popup window type from %s to popup - fallback", magic_enum::enum_name(data->getDisposition().windowtype).data()); data->setDisposition(gui::popup::Disposition{ gui::popup::Disposition::Priority::Normal, gui::popup::Disposition::WindowType::Popup, id}); @@ -907,7 +907,7 @@ namespace app } auto const popup = magic_enum::enum_name(id).data(); - LOG_DEBUG("handling popup: %s", popup); + LOG_DEBUG("Handling popup: %s", popup); /// request handle actually switches window to popup window auto retval = request->handle(); if (!retval) { @@ -943,9 +943,9 @@ namespace app void ApplicationCommon::requestShutdownWindow(const std::string &windowName) { #if DEBUG_APPLICATION_MANAGEMENT == 1 - LOG_INFO("switching [%s] to shutdown window: %s", - GetName().c_str(), - windowName.length() ? windowName.c_str() : default_window.c_str()); + LOG_DEBUG("Switching [%s] to shutdown window: %s", + GetName().c_str(), + windowName.length() ? windowName.c_str() : default_window.c_str()); #endif if (!windowsFactory.isRegistered(windowName)) { LOG_ERROR("Cannot find window %s windowsFactory in application: %s", windowName.c_str(), GetName().c_str()); @@ -985,7 +985,7 @@ namespace app // handle if window was already on LOG_INFO("App: %s window %s request", GetName().c_str(), newWindow.c_str()); if (newWindow.empty() && windowsStack().popLastWindow()) { - LOG_INFO("Empty window request!"); + LOG_WARN("Empty window request!"); return; } if (windowsStack().pop(newWindow)) { diff --git a/module-apps/apps-common/ApplicationCommonPopupBlueprints.cpp b/module-apps/apps-common/ApplicationCommonPopupBlueprints.cpp index af3d3a96d..69b4fbe9e 100644 --- a/module-apps/apps-common/ApplicationCommonPopupBlueprints.cpp +++ b/module-apps/apps-common/ApplicationCommonPopupBlueprints.cpp @@ -92,7 +92,7 @@ namespace app auto phoneLockBlueprint = [&](gui::popup::ID id, std::unique_ptr ¶ms) { auto popupParams = dynamic_cast(params.get()); if (popupParams == nullptr) { - LOG_ERROR("this is most probably due to wrong unique_ptr handling - please check"); + LOG_ERROR("This is most probably due to wrong unique_ptr handling - please check"); return false; } diff --git a/module-apps/apps-common/AsyncTask.cpp b/module-apps/apps-common/AsyncTask.cpp index c5321940b..2f1253a8a 100644 --- a/module-apps/apps-common/AsyncTask.cpp +++ b/module-apps/apps-common/AsyncTask.cpp @@ -51,7 +51,7 @@ namespace app { const auto [result, id] = DBServiceAPI::GetQuery(application, target, std::move(query)); if (!result) { - LOG_FATAL("cant request!"); + LOG_FATAL("Failed to send request!"); } return id; } @@ -71,7 +71,7 @@ namespace app std::shared_ptr msg{std::move(message)}; bool result = application->bus.sendUnicast(msg, serviceName); if (!result) { - LOG_FATAL("cant request!"); + LOG_FATAL("Failed to send message!"); } return msg->uniID; } diff --git a/module-apps/apps-common/locks/handlers/SimLockHandler.cpp b/module-apps/apps-common/locks/handlers/SimLockHandler.cpp index d53b8ba85..41ebdf562 100644 --- a/module-apps/apps-common/locks/handlers/SimLockHandler.cpp +++ b/module-apps/apps-common/locks/handlers/SimLockHandler.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "SimLockHandler.hpp" @@ -378,7 +378,7 @@ namespace locks case SimInputTypeAction::Error: return handleCMEErrorRequest(storedErrorCode); default: - LOG_WARN("got message of unexpected type: %s", magic_enum::enum_name(simInputTypeAction).data()); + LOG_WARN("Received message of unexpected type: %s", magic_enum::enum_name(simInputTypeAction).data()); return sys::msgNotHandled(); } } diff --git a/module-apps/apps-common/notifications/NotificationsModel.cpp b/module-apps/apps-common/notifications/NotificationsModel.cpp index b1960ae70..a7d3ef606 100644 --- a/module-apps/apps-common/notifications/NotificationsModel.cpp +++ b/module-apps/apps-common/notifications/NotificationsModel.cpp @@ -74,7 +74,7 @@ void NotificationsModel::updateData(app::manager::actions::NotificationsChangedP return; } if (params == nullptr) { - LOG_ERROR("params is nullptr"); + LOG_ERROR("Params are not provided"); return; } diff --git a/module-apps/apps-common/options/type/OptionContact.cpp b/module-apps/apps-common/options/type/OptionContact.cpp index e2bcae762..7d2fa2736 100644 --- a/module-apps/apps-common/options/type/OptionContact.cpp +++ b/module-apps/apps-common/options/type/OptionContact.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "OptionContact.hpp" @@ -30,7 +30,7 @@ namespace gui::option break; default: text = utils::translate("app_options_invalid_option"); - LOG_WARN("ContactOperation %d not supported", static_cast(contactOperation)); + LOG_WARN("Contact operation %d not supported", static_cast(contactOperation)); break; } diff --git a/module-apps/apps-common/popups/lock-popups/SimSwitchingWindow.cpp b/module-apps/apps-common/popups/lock-popups/SimSwitchingWindow.cpp index ea8ff8fa2..325b42324 100644 --- a/module-apps/apps-common/popups/lock-popups/SimSwitchingWindow.cpp +++ b/module-apps/apps-common/popups/lock-popups/SimSwitchingWindow.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "SimSwitchingWindow.hpp" @@ -46,7 +46,7 @@ namespace gui case Store::GSM::SIM::SIM_FAIL: case Store::GSM::SIM::SIM_UNKNOWN: if (std::chrono::steady_clock::now() - startTime >= constants::maxDurationTime) { - LOG_INFO("The SIM switch operation failed. We return to the previous window."); + LOG_WARN("The SIM switch operation failed."); application->getSimLockSubject().simSwitched(); application->returnToPreviousWindow(); } diff --git a/module-apps/apps-common/popups/presenter/AlarmPresenter.cpp b/module-apps/apps-common/popups/presenter/AlarmPresenter.cpp index 387009b16..694c46bd2 100644 --- a/module-apps/apps-common/popups/presenter/AlarmPresenter.cpp +++ b/module-apps/apps-common/popups/presenter/AlarmPresenter.cpp @@ -138,7 +138,7 @@ namespace app::popup if (timerHandle.isActive()) timerHandle.stop(); } - LOG_DEBUG("Snoozed!"); + LOG_DEBUG("Alarm snoozed!"); } void AlarmPopupPresenter::stopAlarm() @@ -152,7 +152,7 @@ namespace app::popup if (timerHandle.isActive()) timerHandle.stop(); } - LOG_DEBUG("Stopped!"); + LOG_DEBUG("Alarm stopped!"); } void AlarmPopupPresenter::skipToNextSnooze() diff --git a/module-apps/apps-common/widgets/ButtonTriState.cpp b/module-apps/apps-common/widgets/ButtonTriState.cpp index 50eccca14..1e1a28aba 100644 --- a/module-apps/apps-common/widgets/ButtonTriState.cpp +++ b/module-apps/apps-common/widgets/ButtonTriState.cpp @@ -56,7 +56,7 @@ namespace gui setText(transitingText); break; default: - LOG_ERROR("button state '%s' not implemented - defaulting to OFF", + LOG_ERROR("Button state '%s' not implemented - defaulting to OFF", magic_enum::enum_name(currentState).data()); [[fallthrough]]; case State::Off: diff --git a/module-apps/apps-common/widgets/TimeWidget.cpp b/module-apps/apps-common/widgets/TimeWidget.cpp index 7982d3b33..eecf6fbb6 100644 --- a/module-apps/apps-common/widgets/TimeWidget.cpp +++ b/module-apps/apps-common/widgets/TimeWidget.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "TimeWidget.hpp" @@ -94,7 +94,7 @@ namespace gui hours = std::stoi(hourInput->getText().c_str()); } catch (std::exception &e) { - LOG_ERROR("applyInputCallbacks hours: %s", e.what()); + LOG_ERROR("Exception during getting hours: %s", e.what()); return true; } @@ -218,7 +218,7 @@ namespace gui { if (type == Type::End) { if (secondItem == nullptr) { - LOG_ERROR("secondItem not connected!"); + LOG_ERROR("TimeWidget not connected!"); return false; } std::chrono::hours start_hour; @@ -235,7 +235,7 @@ namespace gui } } catch (std::exception &e) { - LOG_WARN("start_hour: %s", e.what()); + LOG_ERROR("Exception while setting start_hour: %s", e.what()); return false; } @@ -249,7 +249,7 @@ namespace gui } } catch (std::exception &e) { - LOG_ERROR("end_hour: %s", e.what()); + LOG_ERROR("Exception while setting end_hour: %s", e.what()); return false; } @@ -257,7 +257,7 @@ namespace gui start_minutes = std::stoi(secondItem->minuteInput->getText().c_str()); } catch (std::exception &e) { - LOG_ERROR("start_minutes: %s", e.what()); + LOG_ERROR("Exception while setting start_minutes: %s", e.what()); return false; } @@ -265,7 +265,7 @@ namespace gui end_minutes = std::stoi(minuteInput->getText().c_str()); } catch (std::exception &e) { - LOG_ERROR("end_minutes: %s", e.what()); + LOG_ERROR("Exception while setting end_minutes: %s", e.what()); return false; } diff --git a/module-apps/apps-common/windows/AppWindow.cpp b/module-apps/apps-common/windows/AppWindow.cpp index 25b7aed50..da02f9068 100644 --- a/module-apps/apps-common/windows/AppWindow.cpp +++ b/module-apps/apps-common/windows/AppWindow.cpp @@ -180,7 +180,7 @@ namespace gui } if (inputEvent.isLongRelease(gui::KeyCode::KEY_RF)) { - LOG_INFO("exit to main menu"); + LOG_INFO("Exit to main menu"); app::manager::Controller::sendAction(application, app::manager::actions::Home); } diff --git a/module-audio/Audio/Profiles/ProfileConfigUtils.cpp b/module-audio/Audio/Profiles/ProfileConfigUtils.cpp index 269f2e1e5..961bb55ee 100644 --- a/module-audio/Audio/Profiles/ProfileConfigUtils.cpp +++ b/module-audio/Audio/Profiles/ProfileConfigUtils.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ProfileConfigUtils.hpp" @@ -52,7 +52,7 @@ namespace audio { std::ifstream file; std::string configString; - LOG_DEBUG("Reading %s ...", filePath.c_str()); + LOG_DEBUG("Reading profile configuration: %s", filePath.c_str()); file.open(filePath); if (not file.is_open()) { LOG_ERROR("Can't open profile configuration file, using defaults!"); @@ -97,7 +97,7 @@ namespace audio config.playbackPathGain = playbackPathGain; } else { - LOG_WARN("playbackPathGain value out of range (%u), using fallback value %u!", + LOG_WARN("PlaybackPathGain value out of range (%u), using fallback value %u!", playbackPathGain, config.playbackPathGain); } @@ -107,7 +107,7 @@ namespace audio config.playbackPathAtten = playbackPathAtten; } else { - LOG_WARN("playbackPathAtten value out of range (%u), using fallback value %u!", + LOG_WARN("PlaybackPathAtten value out of range (%u), using fallback value %u!", playbackPathAtten, config.playbackPathAtten); } diff --git a/module-bluetooth/Bluetooth/BluetoothWorker.cpp b/module-bluetooth/Bluetooth/BluetoothWorker.cpp index 1c54f342a..4aa135755 100644 --- a/module-bluetooth/Bluetooth/BluetoothWorker.cpp +++ b/module-bluetooth/Bluetooth/BluetoothWorker.cpp @@ -141,7 +141,7 @@ BluetoothWorker::~BluetoothWorker() auto BluetoothWorker::run() -> bool { - LOG_INFO("-> BluetoothWorker run request"); + LOG_INFO("BluetoothWorker run request"); if (isRunning) { return true; } @@ -155,7 +155,7 @@ auto BluetoothWorker::run() -> bool auto BluetoothWorker::handleCommand(QueueHandle_t queue) -> bool { - LOG_INFO("handle bluetooth command(s)"); + LOG_INFO("Handle bluetooth command(s)"); xQueueReceive(queue, nullptr, 0); while (not workerQueue->empty()) { auto command = workerQueue->peek(); @@ -189,7 +189,7 @@ auto BluetoothWorker::handleMessage(uint32_t queueID) -> bool { QueueHandle_t queue = queues[queueID]->GetQueueHandle(); if (queueID == queueService) { - LOG_DEBUG("not interested"); + LOG_DEBUG("Ignoring message on 'queueService' queue"); return true; } @@ -254,7 +254,7 @@ auto BluetoothWorker::handleMessage(uint32_t queueID) -> bool LOG_ERROR("Uart error [%d]: %s", notification, bluetooth::MessageCstr(notification)); break; default: - LOG_ERROR("ERROR"); + LOG_ERROR("Unknown message: %d", notification); } return true; diff --git a/module-bluetooth/Bluetooth/BtKeysStorage.cpp b/module-bluetooth/Bluetooth/BtKeysStorage.cpp index 94ef6a1f4..34700c3b1 100644 --- a/module-bluetooth/Bluetooth/BtKeysStorage.cpp +++ b/module-bluetooth/Bluetooth/BtKeysStorage.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -37,17 +37,17 @@ namespace bluetooth void KeyStorage::openStorage() { - LOG_INFO("opening storage from API"); + LOG_INFO("Opening storage from API"); std::string keysEntry; if (settings) { keysEntry = std::visit(bluetooth::StringVisitor(), settings->getValue(bluetooth::Settings::BtKeys)); } else { - LOG_ERROR("failed opening settings for BT!"); + LOG_ERROR("Failed opening settings for BT!"); return; } if (keysEntry.empty()) { - LOG_WARN("opening empty key entry!"); + LOG_WARN("Opening empty key entry!"); return; } @@ -63,14 +63,14 @@ namespace bluetooth void KeyStorage::closeStorage() { - LOG_INFO("closing storage from API"); + LOG_INFO("Closing storage from API"); writeSettings(); } - // + auto KeyStorage::getLinkKey(uint8_t *bd_addr, link_key_t link_key, link_key_type_t *type) -> int { if (type != nullptr && bd_addr != nullptr) { - LOG_INFO("getting key from API"); + LOG_INFO("Getting key from API"); json11::Json finalJson = json11::Json::object{{strings::keys, keys}}; auto keysEntryDump = finalJson.dump(); @@ -114,13 +114,12 @@ namespace bluetooth settings->onLinkKeyAdded(bd_addr_to_str(bd_addr)); } writeSettings(); - LOG_INFO("keys written to the file"); LOG_INFO("Keys in file: %d", (int)keys.size()); } void KeyStorage::deleteLinkKey(uint8_t *bd_addr) { auto keysSize = keys.size(); - LOG_INFO("deleting key from API"); + LOG_INFO("Deleting key from API"); auto end = std::remove_if(keys.begin(), keys.end(), [&](auto &key) { bd_addr_t addr; sscanf_bd_addr(key[strings::bd_addr].string_value().c_str(), addr); @@ -157,7 +156,7 @@ namespace bluetooth settings->setValue(bluetooth::Settings::BtKeys, keysEntry); } else { - LOG_ERROR("failed to open settings to write!"); + LOG_ERROR("Failed to open settings to write!"); return; } } diff --git a/module-bluetooth/Bluetooth/glucode/BluetoothRunLoop.cpp b/module-bluetooth/Bluetooth/glucode/BluetoothRunLoop.cpp index a40e41822..3ba339e26 100644 --- a/module-bluetooth/Bluetooth/glucode/BluetoothRunLoop.cpp +++ b/module-bluetooth/Bluetooth/glucode/BluetoothRunLoop.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "BluetoothRunLoop.hpp" @@ -38,7 +38,7 @@ namespace bluetooth // task to handle to optimize 'run on main thread' btstack_run_loop_task = xTaskGetCurrentTaskHandle(); - LOG_INFO("run loop init, task %p, queue item size %u", + LOG_INFO("Run loop init, task %p, queue item size %u", btstack_run_loop_task, static_cast(sizeof(function_call_t))); } @@ -106,7 +106,7 @@ namespace bluetooth // don't add timer that's already in there auto *next = reinterpret_cast(it->next); if (next == ts) { - LOG_ERROR("btstack_run_loop_timer_add error: timer to add already in list!"); + LOG_ERROR("Timer 'btstack_run_loop_timer' already in list!"); return; } // exit if new timeout before list timeout diff --git a/module-bluetooth/Bluetooth/glucode/btstack_uart_block_rt1051.cpp b/module-bluetooth/Bluetooth/glucode/btstack_uart_block_rt1051.cpp index 06c7053da..7078dd676 100644 --- a/module-bluetooth/Bluetooth/glucode/btstack_uart_block_rt1051.cpp +++ b/module-bluetooth/Bluetooth/glucode/btstack_uart_block_rt1051.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -73,7 +73,7 @@ extern "C" static void uart_rt1051_receive_block(uint8_t *buffer, uint16_t len) { #ifdef DEBUG_UART - LOG_INFO("<-- read: %d", len); + LOG_DEBUG("<-- read: %d", len); #endif BlueKitchen::getInstance()->read(buffer, len); } @@ -81,7 +81,7 @@ extern "C" static void uart_rt1051_send_block(const uint8_t *buffer, uint16_t length) { #ifdef DEBUG_UART - LOG_INFO("--> write: %d", length); + LOG_DEBUG("--> write: %d", length); #endif BlueKitchen::getInstance()->write(buffer, length); } @@ -115,7 +115,6 @@ extern "C" const btstack_uart_block_t *btstack_uart_block_rt1051_instance() { - LOG_INFO("btstack_uart_block_rt1051_instance"); return &btstack_uart_posix; } }; diff --git a/module-bluetooth/Bluetooth/interface/BluetoothDriverImpl.cpp b/module-bluetooth/Bluetooth/interface/BluetoothDriverImpl.cpp index 9a2849546..cdac5ed1d 100644 --- a/module-bluetooth/Bluetooth/interface/BluetoothDriverImpl.cpp +++ b/module-bluetooth/Bluetooth/interface/BluetoothDriverImpl.cpp @@ -128,17 +128,19 @@ namespace bluetooth } void Driver::local_version_information_handler(uint8_t *packet) { - LOG_INFO("Local version information:"); uint16_t hci_version = packet[6]; uint16_t hci_revision = little_endian_read_16(packet, 7); uint16_t lmp_version = packet[9]; uint16_t manufacturer = little_endian_read_16(packet, 10); uint16_t lmp_subversion = little_endian_read_16(packet, 12); - LOG_INFO("- HCI Version 0x%04x", hci_version); - LOG_INFO("- HCI Revision 0x%04x", hci_revision); - LOG_INFO("- LMP Version 0x%04x", lmp_version); - LOG_INFO("- LMP Subversion 0x%04x", lmp_subversion); - LOG_INFO("- Manufacturer 0x%04x", manufacturer); + LOG_INFO("Local version information: HCI Version: 0x%04x, HCI Revision: 0x%04x, LMP Version: 0x%04x, LMP " + "Subversion: 0x%04x, Manufacturer: 0x%04x", + hci_version, + hci_revision, + lmp_version, + lmp_subversion, + manufacturer); + switch (manufacturer) { case BLUETOOTH_COMPANY_ID_TEXAS_INSTRUMENTS_INC: LOG_INFO("Texas Instruments - CC256x compatible chipset."); diff --git a/module-bluetooth/Bluetooth/interface/profiles/A2DP/A2DP.cpp b/module-bluetooth/Bluetooth/interface/profiles/A2DP/A2DP.cpp index 97d39147f..ac2ec4cc5 100644 --- a/module-bluetooth/Bluetooth/interface/profiles/A2DP/A2DP.cpp +++ b/module-bluetooth/Bluetooth/interface/profiles/A2DP/A2DP.cpp @@ -425,8 +425,8 @@ namespace bluetooth local_seid = a2dp_subevent_stream_established_get_local_seid(packet); cid = a2dp_subevent_stream_established_get_a2dp_cid(packet); - LOG_INFO("A2DP_SUBEVENT_STREAM_ESTABLISHED: a2dp_cid [expected 0x%02X, received 0x%02X], local_seid " - "[expected 0x%02X, received 0x%02X], remote_seid [expected 0x%02X, received 0x%02X]", + LOG_INFO("A2DP subevent stream established: a2dp_cid (expected 0x%02X, received 0x%02X), local_seid " + "(expected 0x%02X, received 0x%02X), remote_seid (expected 0x%02X, received 0x%02X)", AVRCP::mediaTracker.a2dp_cid, cid, AVRCP::mediaTracker.local_seid, diff --git a/module-bluetooth/Bluetooth/interface/profiles/SCO/SCO.cpp b/module-bluetooth/Bluetooth/interface/profiles/SCO/SCO.cpp index 6ad0bfd62..41a44f08f 100644 --- a/module-bluetooth/Bluetooth/interface/profiles/SCO/SCO.cpp +++ b/module-bluetooth/Bluetooth/interface/profiles/SCO/SCO.cpp @@ -123,7 +123,7 @@ auto SCO::SCOImpl::audioInitialize(int sampleRate) -> Result metadata.samplesPerFrame = audioSamplesPerPacket; if (sourceQueue == nullptr || sinkQueue == nullptr) { - LOG_ERROR("failed to create queue!"); + LOG_ERROR("Failed to create queue!"); return Result(Result::Code::SystemError); } @@ -179,7 +179,7 @@ void SCO::SCOImpl::receiveCvsd(uint8_t *packet, uint16_t size) xQueueSend(sinkQueue, &audioData, 5); } else { - LOG_ERROR("queue is nullptr!"); + LOG_ERROR("Queue is not initialized!"); } } diff --git a/module-bsp/board/linux/usb_cdc/usb_cdc.cpp b/module-bsp/board/linux/usb_cdc/usb_cdc.cpp index f6abd38af..063499de0 100644 --- a/module-bsp/board/linux/usb_cdc/usb_cdc.cpp +++ b/module-bsp/board/linux/usb_cdc/usb_cdc.cpp @@ -170,7 +170,7 @@ namespace bsp fd = 0; fd = open("/dev/ptmx", O_RDWR | O_NOCTTY); if (fd == -1) { - LOG_ERROR("bsp::usbInit Failed to open /dev/ptmx, can't allocate new pseudo terminal"); + LOG_ERROR("Failed to open /dev/ptmx, can't allocate new pseudo terminal"); return -1; } @@ -179,7 +179,7 @@ namespace bsp pts_name = ptsname(fd); if (pts_name == nullptr) { - LOG_ERROR("bsp::usbInit ptsname returned NULL, no pseudo terminal allocated"); + LOG_ERROR("ptsname returned NULL, no pseudo terminal allocated"); return -1; } @@ -187,7 +187,7 @@ namespace bsp inotify_add_watch(fdNotify, pts_name, IN_OPEN | IN_CLOSE_WRITE); writePtsToFile(pts_name); - LOG_INFO("bsp::usbInit linux ptsname: %s", pts_name); + LOG_INFO("linux ptsname: %s", pts_name); struct termios newtio {}; memset(&newtio, 0, sizeof(newtio)); @@ -219,7 +219,7 @@ namespace bsp &taskHandleReceive); if (task_error != pdPASS) { - LOG_ERROR("bsp::usbInit Failed to start freertos USB_Linux_Receive"); + LOG_ERROR("Failed to start freertos USB_Linux_Receive"); return -1; } diff --git a/module-bsp/board/linux/vibrator/vibrator.cpp b/module-bsp/board/linux/vibrator/vibrator.cpp index 1f0a499be..7c5574665 100644 --- a/module-bsp/board/linux/vibrator/vibrator.cpp +++ b/module-bsp/board/linux/vibrator/vibrator.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "bsp/vibrator/vibrator.hpp" @@ -11,11 +11,11 @@ namespace bsp void enable() { - LOG_DEBUG("vibration starts\t\U0001f7e2\U0001f4f3"); + LOG_DEBUG("Vibration starts\t\U0001f7e2\U0001f4f3"); } void disable() { - LOG_DEBUG("vibration ends \t\U0001f6d1\U0001f4f3"); + LOG_DEBUG("Vibration ends \t\U0001f6d1\U0001f4f3"); } void init(std::chrono::milliseconds pulse) {} diff --git a/module-bsp/board/linux/watchdog/software_watchdog.cpp b/module-bsp/board/linux/watchdog/software_watchdog.cpp index 79bc08f2d..b460983ed 100644 --- a/module-bsp/board/linux/watchdog/software_watchdog.cpp +++ b/module-bsp/board/linux/watchdog/software_watchdog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "software_watchdog.hpp" @@ -51,7 +51,7 @@ namespace bsp::watchdog // Critical section not required (atomic 32-bit reads) if (lastTimeoutTimestamp - lastRefreshTimestamp >= timeoutPeriod) { - LOG_FATAL("!!! Software watchdog timeout, exiting !!!"); + LOG_FATAL("Software watchdog timeout, exiting !!!"); exit(EXIT_FAILURE); } } diff --git a/module-cellular/at/src/ATFactory.cpp b/module-cellular/at/src/ATFactory.cpp index 531c042ec..c73e74454 100644 --- a/module-cellular/at/src/ATFactory.cpp +++ b/module-cellular/at/src/ATFactory.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ATFactory.hpp" @@ -136,7 +136,7 @@ namespace at assert(g_cmds_map.at(at)); return *(g_cmds_map.at(at)); } - LOG_ERROR("no such at command defined: %d", static_cast(at)); + LOG_ERROR("No such at command defined: %d", static_cast(at)); assert(g_cmds_map.at(AT::AT)); return *(g_cmds_map.at(AT::AT)); } diff --git a/module-cellular/at/src/UrcCusd.cpp b/module-cellular/at/src/UrcCusd.cpp index c72a43d88..e8ee28a20 100644 --- a/module-cellular/at/src/UrcCusd.cpp +++ b/module-cellular/at/src/UrcCusd.cpp @@ -32,7 +32,7 @@ Cusd::Cusd(const std::string &urcBody, const std::string &urcHead) : Urc(urcBody if (auto status = getStatus(); status != StatusType::FurtherUserActionRequired && status != StatusType::NoFurtherUserActionRequired) { - LOG_WARN("unsupported CUSD status: %d", magic_enum::enum_integer(status)); + LOG_WARN("Unsupported CUSD status: %d", magic_enum::enum_integer(status)); } } catch (std::runtime_error const &exc) { @@ -109,7 +109,7 @@ auto Cusd::split(const std::string &str) -> void } if (endQuotationMarkPosition == startQuotationMarkPosition + 1) { - LOG_WARN("empty CUSD message"); + LOG_WARN("Empty CUSD message"); } else { auto messageStartPosition = startQuotationMarkPosition + 1; diff --git a/module-cellular/at/src/UrcQind.cpp b/module-cellular/at/src/UrcQind.cpp index 7e208c30f..746abd768 100644 --- a/module-cellular/at/src/UrcQind.cpp +++ b/module-cellular/at/src/UrcQind.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -70,7 +70,7 @@ auto Qind::validate(enum CSQ check) const noexcept -> bool } } catch (const std::exception &ex) { - LOG_FATAL("exception: %s", ex.what()); + LOG_ERROR("Exception: %s", ex.what()); } return false; } diff --git a/module-cellular/modem/ATCommon.cpp b/module-cellular/modem/ATCommon.cpp index 0679c05cd..dba41f9cc 100644 --- a/module-cellular/modem/ATCommon.cpp +++ b/module-cellular/modem/ATCommon.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ATCommon.hpp" @@ -86,7 +86,7 @@ Result Channel::cmd(const std::string &cmd, std::chrono::milliseconds timeout, s cmdInit(); std::string cmdFixed = formatCommand(cmd); - LOG_DEBUG("start of %s", cmdFixed.c_str()); + LOG_DEBUG("Start of %s", cmdFixed.c_str()); cmdSend(cmdFixed); auto startTime = std::chrono::steady_clock::now(); diff --git a/module-cellular/modem/ATParser.cpp b/module-cellular/modem/ATParser.cpp index 4eea23f75..d80e690ff 100644 --- a/module-cellular/modem/ATParser.cpp +++ b/module-cellular/modem/ATParser.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ATParser.hpp" @@ -79,7 +79,7 @@ at::Result ATParser::processNewData(sys::Service *service, const bsp::cellular:: } else if (!ret.empty()) { if (ret.size() == 1 && ret[0] == ATParser::Urc::Fota) { - LOG_DEBUG("parsing FOTA"); + LOG_DEBUG("Parsing FOTA"); cpp_freertos::LockGuard lock(mutex); urcBuffer.erase(); } diff --git a/module-cellular/modem/ATStream.cpp b/module-cellular/modem/ATStream.cpp index ebd00d707..ae5358ac7 100644 --- a/module-cellular/modem/ATStream.cpp +++ b/module-cellular/modem/ATStream.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include #include "ATStream.hpp" @@ -55,7 +55,7 @@ namespace at Result::Code::ERROR; // setup error but in this case error from +CME ERROR with valid errorCode auto tmp_ec = magic_enum::enum_cast(errcode); if (tmp_ec.has_value()) { - LOG_ERROR("%s", utils::enumToString(tmp_ec.value()).c_str()); + LOG_ERROR("CME error: %s", utils::enumToString(tmp_ec.value()).c_str()); result.errorCode = tmp_ec.value(); } else { @@ -71,7 +71,7 @@ namespace at auto atmp_ec = magic_enum::enum_cast(errcode); if (atmp_ec.has_value()) { - LOG_ERROR("%s", utils::enumToString(atmp_ec.value()).c_str()); + LOG_ERROR("CMS error code: %s", utils::enumToString(atmp_ec.value()).c_str()); result.errorCode = atmp_ec.value(); } else { diff --git a/module-cellular/modem/mux/CellularMux.cpp b/module-cellular/modem/mux/CellularMux.cpp index 8f7463f3c..d0e019bf4 100644 --- a/module-cellular/modem/mux/CellularMux.cpp +++ b/module-cellular/modem/mux/CellularMux.cpp @@ -369,7 +369,7 @@ CellularMux::ConfState CellularMux::startMultiplexer() auto frameData = data; if (frameData.size() < 4) { - LOG_ERROR("frame too short"); + LOG_ERROR("Frame too short"); return; } switch (frameData[0]) { diff --git a/module-cellular/modem/mux/DLCChannel.cpp b/module-cellular/modem/mux/DLCChannel.cpp index fd19e9838..7a0c55954 100644 --- a/module-cellular/modem/mux/DLCChannel.cpp +++ b/module-cellular/modem/mux/DLCChannel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "DLCChannel.h" @@ -35,7 +35,7 @@ DLCChannel::DLCChannel(DLCI_t DLCI, const std::string &name, bsp::Cellular *cell bool DLCChannel::init() { active = establish(); - LOG_INFO("create channel %s: %s", name.c_str(), active ? "TRUE" : "FALSE"); + LOG_INFO("Create channel %s: %s", name.c_str(), active ? "TRUE" : "FALSE"); return active; } @@ -173,7 +173,7 @@ at::Result DLCChannel::parseInputData(bsp::cellular::CellularResult *cellularRes (void *)cellularResult->getSerialized().get(), cellularResult->getSerializedSize(), pdMS_TO_TICKS(at::defaultBufferTimeoutMs.count()))) { - LOG_DEBUG("[DLC] Message buffer full!"); + LOG_DEBUG("DLC message buffer full!"); result.code = at::Result::Code::FULL_MSG_BUFFER; } } diff --git a/module-db/Common/Query.cpp b/module-db/Common/Query.cpp index e8c52e9b8..0590cca84 100644 --- a/module-db/Common/Query.cpp +++ b/module-db/Common/Query.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "Query.hpp" @@ -40,7 +40,7 @@ bool EndpointListener::handleQueryResponse(db::QueryResult *response) return ret; } - LOG_ERROR("callback is nullptr!"); + LOG_ERROR("Callback is nullptr!"); return false; } diff --git a/module-db/Database/Database.cpp b/module-db/Database/Database.cpp index a8c99b592..7187d79ef 100644 --- a/module-db/Database/Database.cpp +++ b/module-db/Database/Database.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "Database.hpp" @@ -74,7 +74,7 @@ Database::Database(const char *name, bool readOnly) const int flags = (readOnly) ? (SQLITE_OPEN_READONLY) : (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE); LOG_INFO("Opening database: %s", dbName.c_str()); if (const auto rc = sqlite3_open_v2(name, &dbConnection, flags, nullptr); rc != SQLITE_OK) { - LOG_ERROR("SQLITE INITIALIZATION ERROR! rc=%d dbName=%s", rc, name); + LOG_ERROR("SQLITE initialization error! rc=%d dbName=%s", rc, name); throw DatabaseInitialisationError{"Failed to initialize the sqlite db"}; } sqlite3_extended_result_codes(dbConnection, enabled); @@ -207,7 +207,7 @@ auto Database::pragmaQueryForValue(const std::string &pragmaStatement, const std auto results = query(pragmaStatement.c_str()); if (!results || results->getRowCount() == 0) { - LOG_DEBUG("no results!"); + LOG_DEBUG("No results!"); return false; } @@ -238,7 +238,7 @@ void Database::pragmaQuery(const std::string &pragmaStatement) } while (results->nextRow()); } else { - LOG_DEBUG("no results!"); + LOG_DEBUG("No results!"); } } @@ -249,11 +249,11 @@ bool Database::storeIntoFile(const std::filesystem::path &syncPath) // that's why we need to commit it manually if (sqlite3_get_autocommit(dbConnection) == 0) { if (const auto rc = execute("COMMIT;"); !rc) { - LOG_ERROR("failed to execute commit; sqlite3 autocommit after commit: %d", + LOG_ERROR("Failed to execute commit; sqlite3 autocommit after commit: %d", sqlite3_get_autocommit(dbConnection)); return false; } - LOG_INFO("sqlite3 autocommit after commit: %d", sqlite3_get_autocommit(dbConnection)); + LOG_INFO("SQLITE3 autocommit after commit: %d", sqlite3_get_autocommit(dbConnection)); } LOG_INFO("Store database: %s, into file: %s - STARTED", dbName.c_str(), syncPath.c_str()); diff --git a/module-db/Interface/SMSRecord.cpp b/module-db/Interface/SMSRecord.cpp index 4ee83bb48..07919de0a 100644 --- a/module-db/Interface/SMSRecord.cpp +++ b/module-db/Interface/SMSRecord.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "SMSRecord.hpp" @@ -81,7 +81,7 @@ bool SMSRecordInterface::Add(const SMSRecord &rec) thread.msgCount++; if (rec.type == SMSType::INBOX) { thread.unreadMsgCount++; - LOG_DEBUG("unreadMsgCount = %" PRIu32 " for thread = %" PRIu32, thread.unreadMsgCount, thread.ID); + LOG_DEBUG("Unread messages = %" PRIu32 " for thread = %" PRIu32, thread.unreadMsgCount, thread.ID); } if (!threadInterface.Update(thread)) { diff --git a/module-db/Interface/ThreadRecord.cpp b/module-db/Interface/ThreadRecord.cpp index fdc197a60..c0aa36b85 100644 --- a/module-db/Interface/ThreadRecord.cpp +++ b/module-db/Interface/ThreadRecord.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ThreadRecord.hpp" @@ -196,7 +196,7 @@ std::unique_ptr ThreadRecordInterface::markAsReadQuery(const st auto result = false; if (record.isValid()) { - LOG_DEBUG("query-read %d", static_cast(localQuery->read)); + LOG_DEBUG("Query read: %d", static_cast(localQuery->read)); record.unreadMsgCount = localQuery->read == db::query::MarkAsRead::Read::True ? 0 : 1; result = Update(record); } diff --git a/module-db/Tables/ContactsTable.cpp b/module-db/Tables/ContactsTable.cpp index 48dc80a8a..61774fc9e 100644 --- a/module-db/Tables/ContactsTable.cpp +++ b/module-db/Tables/ContactsTable.cpp @@ -89,7 +89,7 @@ ContactsTableRow ContactsTable::getByIdCommon(std::unique_ptr retQu { debug_db_data("%s", __FUNCTION__); if ((retQuery == nullptr) || (retQuery->getRowCount() == 0)) { - LOG_DEBUG("no results"); + LOG_DEBUG("No results"); return ContactsTableRow(); } diff --git a/module-gui/gui/core/DrawCommand.cpp b/module-gui/gui/core/DrawCommand.cpp index f2c9f65be..df484a9a1 100644 --- a/module-gui/gui/core/DrawCommand.cpp +++ b/module-gui/gui/core/DrawCommand.cpp @@ -176,7 +176,7 @@ namespace gui inline void DrawImage::checkImageSize(Context *ctx, ImageMap *image) const { if (image->getHeight() > ctx->getH() || image->getWidth() > ctx->getW()) { - LOG_WARN("image %s {w: %d,h %d} > context {w %d,h %d}", + LOG_WARN("Image %s {w: %d,h %d} > context {w %d,h %d}", image->getName().c_str(), image->getWidth(), ctx->getW(), diff --git a/module-gui/gui/core/FontManager.cpp b/module-gui/gui/core/FontManager.cpp index 644f016d3..caf72ab95 100644 --- a/module-gui/gui/core/FontManager.cpp +++ b/module-gui/gui/core/FontManager.cpp @@ -133,7 +133,7 @@ namespace gui for (const auto &entry : styleJson.object_items()) { auto fontName = entry.second.string_value(); if (!std::filesystem::is_regular_file(fontFolder + "/" + fontName)) { - LOG_ERROR("Could not find font: %s", fontName.c_str()); + LOG_WARN("Could not find font: %s", fontName.c_str()); } else { LOG_INFO("Add font to list: %s - %s", entry.first.c_str(), fontName.c_str()); diff --git a/module-gui/gui/core/ImageManager.cpp b/module-gui/gui/core/ImageManager.cpp index b44edcf01..414312f8e 100644 --- a/module-gui/gui/core/ImageManager.cpp +++ b/module-gui/gui/core/ImageManager.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ImageManager.hpp" @@ -42,7 +42,7 @@ namespace gui void ImageManager::clear() { for (ImageMap *imageMap : imageMaps) { - LOG_INFO("deleting image: %s", imageMap->getName().c_str()); + LOG_INFO("Deleting image: %s", imageMap->getName().c_str()); delete imageMap; } imageMaps.clear(); diff --git a/module-gui/gui/core/RawFont.cpp b/module-gui/gui/core/RawFont.cpp index c9c6174cc..30f778e97 100644 --- a/module-gui/gui/core/RawFont.cpp +++ b/module-gui/gui/core/RawFont.cpp @@ -141,7 +141,7 @@ namespace gui return glyph; } - LOG_WARN("unsupported font glyph ID: %" PRIu32, glyph_id); + LOG_WARN("Unsupported font glyph ID: %" PRIu32, glyph_id); return unsupported.get(); } @@ -173,7 +173,7 @@ namespace gui } if ((start >= str.length()) || (start + count - 1 >= str.length())) { - LOG_ERROR("incorrect string index provided"); + LOG_ERROR("Incorrect string index provided"); return 0; } diff --git a/module-gui/gui/input/Profile.cpp b/module-gui/gui/input/Profile.cpp index f5f1221d8..f969665c5 100644 --- a/module-gui/gui/input/Profile.cpp +++ b/module-gui/gui/input/Profile.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -49,7 +49,7 @@ namespace gui auto _ = gsl::finally([fd] { std::fclose(fd); }); if (err.length() != 0) { - LOG_FATAL("%s", err.c_str()); + LOG_FATAL("Parsing json error: %s", err.c_str()); return json11::Json(); } return parsedJson; diff --git a/module-gui/gui/widgets/status-bar/SignalStrengthBar.cpp b/module-gui/gui/widgets/status-bar/SignalStrengthBar.cpp index 426eb2301..26e65fe84 100644 --- a/module-gui/gui/widgets/status-bar/SignalStrengthBar.cpp +++ b/module-gui/gui/widgets/status-bar/SignalStrengthBar.cpp @@ -53,7 +53,7 @@ namespace gui::status_bar { try { if (img == nullptr) { - LOG_ERROR("SignalStrength Image nullptr"); + LOG_ERROR("SignalStrength image nullptr"); return; } @@ -71,7 +71,7 @@ namespace gui::status_bar } } catch (const std::exception &exception) { - LOG_ERROR("%s", exception.what()); + LOG_ERROR("Exception while updating signal image: %s", exception.what()); } } } // namespace gui::status_bar diff --git a/module-gui/gui/widgets/text/core/cursors/TextBlockCursor.cpp b/module-gui/gui/widgets/text/core/cursors/TextBlockCursor.cpp index 3628563ef..be7483b7e 100644 --- a/module-gui/gui/widgets/text/core/cursors/TextBlockCursor.cpp +++ b/module-gui/gui/widgets/text/core/cursors/TextBlockCursor.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "TextBlockCursor.hpp" @@ -201,7 +201,7 @@ namespace gui } auto block = currentBlock(); if (block == blocksEnd()) { - LOG_ERROR("add char to document with no text blocks shouldn't ever happen"); + LOG_ERROR("Add char to document with no text blocks shouldn't ever happen"); return; } if (utf_val == text::newline) { @@ -246,7 +246,7 @@ namespace gui bool BlockCursor::removeChar() { if (checkNpos()) { - LOG_ERROR("cant remove from not initialized/empty cursor"); + LOG_ERROR("Can't remove from uninitialized/empty cursor"); return false; } @@ -262,7 +262,7 @@ namespace gui } if (block == blocksEnd()) { - LOG_ERROR("removing char from document with no TextBlocks"); + LOG_ERROR("Removing char from document with no TextBlocks"); return false; } diff --git a/module-gui/gui/widgets/text/modes/InputMode.cpp b/module-gui/gui/widgets/text/modes/InputMode.cpp index 58a0d8444..5aa7a6417 100644 --- a/module-gui/gui/widgets/text/modes/InputMode.cpp +++ b/module-gui/gui/widgets/text/modes/InputMode.cpp @@ -61,7 +61,7 @@ void InputMode::next() if (input_mode_list_pos == input_mode_list.size()) { input_mode_list_pos = 0; } - LOG_INFO("%" PRIu32, input_mode_list_pos); + LOG_INFO("Position: %" PRIu32, input_mode_list_pos); show_input_type(); } diff --git a/module-gui/gui/widgets/text/parsers/RichTextParser.cpp b/module-gui/gui/widgets/text/parsers/RichTextParser.cpp index 18f818cfe..d1899d9a9 100644 --- a/module-gui/gui/widgets/text/parsers/RichTextParser.cpp +++ b/module-gui/gui/widgets/text/parsers/RichTextParser.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "RichTextParser.hpp" @@ -109,7 +109,7 @@ namespace text return true; } catch (const std::exception &exception) { - LOG_ERROR("%s", exception.what()); + LOG_ERROR("Exception: %s", exception.what()); return false; } return false; @@ -159,7 +159,7 @@ namespace text return true; } catch (const std::exception &exception) { - LOG_ERROR("%s", exception.what()); + LOG_ERROR("Exception: %s", exception.what()); return false; } } diff --git a/module-services/service-antenna/ServiceAntenna.cpp b/module-services/service-antenna/ServiceAntenna.cpp index c8c153bb7..14c73fe59 100644 --- a/module-services/service-antenna/ServiceAntenna.cpp +++ b/module-services/service-antenna/ServiceAntenna.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -57,7 +57,6 @@ ServiceAntenna::ServiceAntenna() state{std::make_unique>(this)}, phoneModeObserver{ std::make_unique()} { - LOG_INFO("[%s] Initializing", service::name::antenna); timer = sys::TimerFactory::createPeriodicTimer( this, "Antenna", std::chrono::seconds{5}, [this](sys::Timer & /*timer*/) { timer.stop(); @@ -87,7 +86,6 @@ ServiceAntenna::ServiceAntenna() ServiceAntenna::~ServiceAntenna() { - LOG_INFO("[%s] Cleaning resources", service::name::antenna); } // Invoked upon receiving data message @@ -104,7 +102,7 @@ sys::MessagePointer ServiceAntenna::DataReceivedHandler(sys::DataMessage *msgl, if (CellularServiceAPI::GetAntenna(this, antenna)) { currentAntenna = antenna; if (state->get() == antenna::State::switchAntenna) { - LOG_INFO("Antena switched."); + LOG_INFO("Antenna switched"); state->enableStateTimeout(cpp_freertos::Ticks::GetTicks(), pdMS_TO_TICKS(antenna::connectionStatusTimeout), @@ -130,28 +128,29 @@ sys::MessagePointer ServiceAntenna::DataReceivedHandler(sys::DataMessage *msgl, break; } - if (handled) + if (handled) { return std::make_shared(); - else - return std::make_shared(sys::ReturnCodes::Unresolved); + } + return std::make_shared(sys::ReturnCodes::Unresolved); } // Invoked during initialization sys::ReturnCodes ServiceAntenna::InitHandler() { registerMessageHandlers(); + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } sys::ReturnCodes ServiceAntenna::DeinitHandler() { + LOG_INFO("Deinitialized"); return sys::ReturnCodes::Success; } sys::ReturnCodes ServiceAntenna::SwitchPowerModeHandler(const sys::ServicePowerMode mode) { - LOG_FATAL("[ServiceEvtMgr] PowerModeHandler: %s", c_str(mode)); - + LOG_INFO("New power mode: %s", c_str(mode)); suspended = true; switch (mode) { @@ -169,25 +168,23 @@ sys::ReturnCodes ServiceAntenna::SwitchPowerModeHandler(const sys::ServicePowerM void ServiceAntenna::handleLockRequest(antenna::lockState request) { auto currentState = state->get(); + LOG_INFO("Current state: %s, requested stated: %s", + magic_enum::enum_name(currentState).data(), + magic_enum::enum_name(request).data()); + if (request == antenna::lockState::locked) { - LOG_INFO("AntennaService lock request."); if (currentState != antenna::State::locked) { state->set(antenna::State::locked); serviceLocked = request; - LOG_INFO("AntennaService locked."); return; } - LOG_INFO("AntennaService lock request skipped."); } else if (request == antenna::lockState::unlocked) { - LOG_INFO("AntennaService unlock request. Service state: %s", c_str(state->get())); if (currentState == antenna::State::locked) { state->set(state->getLast()); serviceLocked = request; - LOG_INFO("AntennaService unlocked. Restoring last state."); return; } - LOG_INFO("AntennaService unlock request skipped."); } } diff --git a/module-services/service-audio/AudioServiceAPI.cpp b/module-services/service-audio/AudioServiceAPI.cpp index 31391e4d1..bfee2caa6 100644 --- a/module-services/service-audio/AudioServiceAPI.cpp +++ b/module-services/service-audio/AudioServiceAPI.cpp @@ -23,18 +23,20 @@ namespace AudioServiceAPI { auto SendAudioRequest(sys::Service *serv, std::shared_ptr msg) { - auto msgType = static_cast(msg->type); - LOG_DEBUG("Msg type %d", msgType); + LOG_DEBUG("Message type: %s", magic_enum::enum_name(msg->type).data()); auto ret = serv->bus.sendUnicastSync(msg, service::name::audio, sys::BusProxy::defaultTimeout); if (ret.first == sys::ReturnCodes::Success) { if (auto resp = std::dynamic_pointer_cast(ret.second)) { - LOG_DEBUG("Msg type %d done", msgType); + LOG_DEBUG("Message processed"); return resp; } - LOG_ERROR("msgType %d - not AudioResponseMessage", msgType); + LOG_ERROR("Response type not AudioResponseMessage, actual type: %s", + magic_enum::enum_name(ret.second->type).data()); return std::make_shared(audio::RetCode::Failed); } - LOG_ERROR("Command %d Failed with %d error", msgType, static_cast(ret.first)); + LOG_ERROR("Command %s Failed with %d error", + magic_enum::enum_name(msg->type).data(), + static_cast(ret.first)); return std::make_shared(audio::RetCode::Failed); } } // namespace @@ -189,7 +191,7 @@ namespace AudioServiceAPI std::stoi(GetSetting(serv, audio::Setting::VibrationLevel, PlaybackType::System))); } catch (const std::logic_error &e) { - LOG_ERROR("exception %s", e.what()); + LOG_ERROR("Setting vibration level failed: %s", e.what()); return std::nullopt; } } @@ -225,7 +227,7 @@ namespace AudioServiceAPI return static_cast(std::stoi(GetSetting(serv, audio::Setting::Volume, playbackType))); } catch (const std::logic_error &e) { - LOG_ERROR("exception %s", e.what()); + LOG_ERROR("Cannot get a volume: %s", e.what()); return std::nullopt; } } diff --git a/module-services/service-audio/ServiceAudio.cpp b/module-services/service-audio/ServiceAudio.cpp index 6413da357..a320edcdb 100644 --- a/module-services/service-audio/ServiceAudio.cpp +++ b/module-services/service-audio/ServiceAudio.cpp @@ -114,7 +114,6 @@ ServiceAudio::ServiceAudio() cpuSentinel(std::make_shared(service::name::audio, this)), settingsProvider(std::make_unique()) { - LOG_INFO("[ServiceAudio] Initializing"); bus.channels.push_back(sys::BusChannel::ServiceAudioNotifications); auto sentinelRegistrationMsg = std::make_shared(cpuSentinel); @@ -136,7 +135,6 @@ ServiceAudio::ServiceAudio() ServiceAudio::~ServiceAudio() { - LOG_INFO("[ServiceAudio] Cleaning resources"); } sys::ReturnCodes ServiceAudio::InitHandler() @@ -151,13 +149,15 @@ sys::ReturnCodes ServiceAudio::InitHandler() settingsProvider->registerValueChange( setting.first, [this](const std::string &name, const std::string &value) { settingsChanged(name, value); }); } - + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } sys::ReturnCodes ServiceAudio::DeinitHandler() { + settingsProvider->deinit(); + LOG_INFO("Deinitialized"); return sys::ReturnCodes::Success; } @@ -215,7 +215,6 @@ std::optional ServiceAudio::AudioServicesCallback(const sys::Messag sys::ReturnCodes ServiceAudio::SwitchPowerModeHandler(const sys::ServicePowerMode mode) { - LOG_FATAL("[ServiceAudio] PowerModeHandler: %s", c_str(mode)); return sys::ReturnCodes::Success; } @@ -756,7 +755,7 @@ std::string ServiceAudio::getSetting(const Setting &setting, return set_it->second; } - LOG_ERROR("ServiceAudio::getSetting setting name %s does not exist", path.c_str()); + LOG_ERROR("Setting '%s' does not exist", path.c_str()); return std::string{}; } @@ -847,7 +846,7 @@ void ServiceAudio::settingsChanged(const std::string &name, std::string value) s_it->second = value; return; } - LOG_ERROR("ServiceAudio::settingsChanged received notification about not registered setting: %s", name.c_str()); + LOG_ERROR("Setting '%s' not registered", name.c_str()); } void ServiceAudio::onVolumeChanged(const Volume volume, const VolumeChangeRequestSource source) diff --git a/module-services/service-bluetooth/ServiceBluetooth.cpp b/module-services/service-bluetooth/ServiceBluetooth.cpp index 694e33e9c..0d9d7b68e 100644 --- a/module-services/service-bluetooth/ServiceBluetooth.cpp +++ b/module-services/service-bluetooth/ServiceBluetooth.cpp @@ -51,13 +51,11 @@ namespace ServiceBluetooth::ServiceBluetooth() : sys::Service(service::name::bluetooth, "", BluetoothServiceStackDepth) { - LOG_INFO("[ServiceBluetooth] Initializing"); bus.channels.push_back(sys::BusChannel::ServiceCellularNotifications); } ServiceBluetooth::~ServiceBluetooth() { - LOG_INFO("[ServiceBluetooth] Cleaning resources"); } sys::ReturnCodes ServiceBluetooth::InitHandler() @@ -126,6 +124,7 @@ sys::ReturnCodes ServiceBluetooth::InitHandler() settingsHolder->setValue(bluetooth::Settings::State, static_cast(BluetoothStatus::State::Off)); } }; + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } @@ -135,6 +134,7 @@ sys::ReturnCodes ServiceBluetooth::DeinitHandler() settingsHolder->deinit(); worker->closeWorker(); worker.reset(); + LOG_INFO("Deinitialized"); return sys::ReturnCodes::Success; } @@ -152,7 +152,7 @@ sys::MessagePointer ServiceBluetooth::DataReceivedHandler([[maybe_unused]] sys:: sys::ReturnCodes ServiceBluetooth::SwitchPowerModeHandler(const sys::ServicePowerMode mode) { - LOG_ERROR("TODO"); + // Implement power mode handler return sys::ReturnCodes::Success; } diff --git a/module-services/service-bluetooth/service-bluetooth/BluetoothDevicesModel.cpp b/module-services/service-bluetooth/service-bluetooth/BluetoothDevicesModel.cpp index 2414854c1..e658f20f0 100644 --- a/module-services/service-bluetooth/service-bluetooth/BluetoothDevicesModel.cpp +++ b/module-services/service-bluetooth/service-bluetooth/BluetoothDevicesModel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "BluetoothDevicesModel.hpp" @@ -85,7 +85,7 @@ void BluetoothDevicesModel::setInternalDeviceState(const Devicei &device, const { auto dev = getDeviceByAddress(device.address); if (not dev) { - LOG_ERROR("no such device - ignored"); + LOG_ERROR("Device doesn't exist, ignored"); return; } dev.value().get().deviceState = state; diff --git a/module-services/service-bluetooth/service-bluetooth/SettingsHolder.cpp b/module-services/service-bluetooth/service-bluetooth/SettingsHolder.cpp index c50a94dd5..68df99d88 100644 --- a/module-services/service-bluetooth/service-bluetooth/SettingsHolder.cpp +++ b/module-services/service-bluetooth/service-bluetooth/SettingsHolder.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "SettingsHolder.hpp" @@ -26,7 +26,7 @@ namespace bluetooth settingsMap[newSetting] = value; settingsProvider->setValue(settingString[newSetting], std::visit(StringVisitor(), value)); - LOG_INFO("setting %s set", settingString[newSetting].c_str()); + LOG_INFO("Setting '%s' set", settingString[newSetting].c_str()); } SettingsHolder::SettingsHolder(std::unique_ptr settingsPtr) : settingsProvider(std::move(settingsPtr)) diff --git a/module-services/service-cellular/CellularServiceAPI.cpp b/module-services/service-cellular/CellularServiceAPI.cpp index 496e709c3..3f4f1712d 100644 --- a/module-services/service-cellular/CellularServiceAPI.cpp +++ b/module-services/service-cellular/CellularServiceAPI.cpp @@ -57,7 +57,7 @@ std::string CellularServiceAPI::GetIMSI(sys::Service *serv, bool getFullIMSINumb cellular::ResponseMessage *response = dynamic_cast(ret.second.get()); if (response == nullptr) { - LOG_ERROR("CellularServiceAPI::GetIMSI failed"); + LOG_ERROR("Failed to get IMSI"); return std::string(); } @@ -65,7 +65,7 @@ std::string CellularServiceAPI::GetIMSI(sys::Service *serv, bool getFullIMSINumb return response->data; } else { - LOG_ERROR("CellularServiceAPI::GetIMSI failed"); + LOG_ERROR("Failed to get IMSI"); return std::string(); } } @@ -176,7 +176,7 @@ bool CellularServiceAPI::GetFirmwareVersion(sys::Service *serv, std::string &res if (ret.first == sys::ReturnCodes::Success) { auto celResponse = std::dynamic_pointer_cast(ret.second); if ((celResponse != nullptr) && (celResponse->retCode == true)) { - LOG_DEBUG("Modem Firmware: %s", celResponse->data.c_str()); + LOG_DEBUG("Modem firmware: %s", celResponse->data.c_str()); response = celResponse->data; return true; } @@ -249,7 +249,7 @@ bool CellularServiceAPI::IsCallInProgress(sys::Service *serv, bool &response) if (ret.first == sys::ReturnCodes::Success) { auto celResponse = std::dynamic_pointer_cast(ret.second); if ((celResponse != nullptr) && (celResponse->retCode == sys::ReturnCodes::Success)) { - LOG_DEBUG("Is Call in progress: %d", celResponse->active); + LOG_DEBUG("Is call in progress: %s", celResponse->active ? "yes" : "no"); response = celResponse->active; return true; } @@ -265,7 +265,7 @@ bool CellularServiceAPI::IsCallStateForCallApplicationActive(sys::Service *serv, if (ret.first == sys::ReturnCodes::Success) { auto celResponse = std::dynamic_pointer_cast(ret.second); if ((celResponse != nullptr) && (celResponse->retCode == sys::ReturnCodes::Success)) { - LOG_DEBUG("Is Call in active for ApplicationCall: %d", celResponse->active); + LOG_DEBUG("Is call in active for ApplicationCall: %d", celResponse->active); response = celResponse->active; return true; } diff --git a/module-services/service-cellular/CellularUrcHandler.cpp b/module-services/service-cellular/CellularUrcHandler.cpp index a78a9438c..85032d5b6 100644 --- a/module-services/service-cellular/CellularUrcHandler.cpp +++ b/module-services/service-cellular/CellularUrcHandler.cpp @@ -15,7 +15,7 @@ using namespace at::urc; void CellularUrcHandler::Handle(Clip &urc) { - LOG_TRACE("incoming call..."); + LOG_TRACE("Incoming call"); std::string phoneNumber; if (urc.isValid()) { phoneNumber = urc.getNumber(); @@ -64,7 +64,7 @@ void CellularUrcHandler::Handle(Creg &urc) void CellularUrcHandler::Handle(Cmti &urc) { - LOG_TRACE("received new SMS notification"); + LOG_TRACE("Received new SMS notification"); if (urc.isValid()) { response = std::make_unique(urc.getIndex()); urc.setHandled(true); @@ -127,7 +127,7 @@ void CellularUrcHandler::Handle(Qind &urc) // Received signal strength change auto rssi = urc.getRSSI(); if (!rssi) { - LOG_INFO("Invalid csq - ignore"); + LOG_WARN("Invalid csq - ignore"); AntennaServiceAPI::InvalidCSQNotification(&cellularService); } else { @@ -171,7 +171,7 @@ void CellularUrcHandler::Handle(Cpin &urc) if (urc.isValid()) { auto state = urc.getState(); if (!state) { - LOG_INFO("Invalid cpin - ignore"); + LOG_WARN("Invalid cpin - ignore"); } else { response = std::make_unique(*state); @@ -216,7 +216,7 @@ void CellularUrcHandler::Handle(UrcResponse &urc) for (auto &t : typesToHandle) { if (t == urc.getURCResponseType()) { - LOG_INFO("call (aborted|missed) type: %s", magic_enum::enum_name(t).data()); + LOG_INFO("Call (aborted|missed) type: %s", magic_enum::enum_name(t).data()); response = std::make_unique(); urc.setHandled(true); } diff --git a/module-services/service-cellular/PacketData.cpp b/module-services/service-cellular/PacketData.cpp index 1e11b5d9f..13c3099dc 100644 --- a/module-services/service-cellular/PacketData.cpp +++ b/module-services/service-cellular/PacketData.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "PacketData.hpp" @@ -197,7 +197,7 @@ namespace packet_data contextMap[apnConfig->contextId] = apnConfig; } - LOG_DEBUG("loadAPNSettings"); + LOG_DEBUG("APN settings loaded"); } std::string PacketData::saveAPNSettings() const @@ -208,14 +208,14 @@ namespace packet_data std::transform(contextMap.begin(), contextMap.end(), std::back_inserter(vec), [](auto &apn) { return apn.second->to_json(); }); - LOG_DEBUG("saveAPNSettings"); + LOG_DEBUG("APN settings saved"); return json11::Json(vec).dump(); } at::Result::Code PacketData::updateAPNSettings(std::uint8_t ctxId) { - LOG_DEBUG("updateAPNSettings %d", ctxId); + LOG_DEBUG("Updating APN settings: %d", ctxId); PDPContext pdpCtx(cellularService); std::shared_ptr apnConfig; std::shared_ptr modemApn; @@ -233,7 +233,7 @@ namespace packet_data else { if (!phoneApn->second->compare(modemApn)) { /// rebuild configuration - LOG_DEBUG("Update modem context %d", ctxId); + LOG_DEBUG("Update modem context: %d", ctxId); if (ctxId > internalAPNMaxId) { return pdpCtx.setConfiguration(phoneApn->second); } @@ -248,7 +248,7 @@ namespace packet_data if (!modemApn->isEmpty()) { /** update phone configuration base on modem conf (eg. ims) */ - LOG_DEBUG("Update modem context %d", ctxId); + LOG_DEBUG("Update modem context: %d", ctxId); if (ctxId > internalAPNMaxId) { return pdpCtx.setConfiguration(modemApn, true); } diff --git a/module-services/service-cellular/ServiceCellular.cpp b/module-services/service-cellular/ServiceCellular.cpp index 1fbf439fe..c153faabc 100644 --- a/module-services/service-cellular/ServiceCellular.cpp +++ b/module-services/service-cellular/ServiceCellular.cpp @@ -125,7 +125,6 @@ ServiceCellular::ServiceCellular() phoneModeObserver{std::make_unique()}, priv{std::make_unique(this)} { - LOG_INFO("[ServiceCellular] Initializing"); bus.channels.push_back(sys::BusChannel::ServiceCellularNotifications); bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); @@ -190,7 +189,6 @@ ServiceCellular::ServiceCellular() ServiceCellular::~ServiceCellular() { - LOG_INFO("[ServiceCellular] Cleaning resources"); } void ServiceCellular::SleepTimerHandler() @@ -220,7 +218,6 @@ void ServiceCellular::WakeUpHandler() void ServiceCellular::CallStateTimerHandler() { - LOG_DEBUG("CallStateTimerHandler"); auto msg = std::make_shared(); bus.sendUnicast(std::move(msg), ::service::name::cellular); } @@ -255,7 +252,7 @@ sys::ReturnCodes ServiceCellular::InitHandler() const auto rawVolteSetting = settings->getValue(settings::Cellular::volteEnabled, settings::SettingsScope::Global); if (rawVolteSetting.empty()) { - LOG_ERROR("[VoLTE] setting missing in database - defaulting to disabled"); + LOG_ERROR("VoLTE setting missing in database - defaulting to disabled"); settings->setValue(settings::Cellular::volteEnabled, "0", settings::SettingsScope::Global); } @@ -281,12 +278,14 @@ sys::ReturnCodes ServiceCellular::InitHandler() cmux->registerCellularDevice(); + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } sys::ReturnCodes ServiceCellular::DeinitHandler() { settings->deinit(); + LOG_INFO("Deinitialized"); return sys::ReturnCodes::Success; } @@ -295,8 +294,6 @@ void ServiceCellular::ProcessCloseReason(sys::CloseReason closeReason) sys::ReturnCodes ServiceCellular::SwitchPowerModeHandler(const sys::ServicePowerMode mode) { - LOG_INFO("[ServiceCellular] PowerModeHandler: %s", c_str(mode)); - switch (mode) { case sys::ServicePowerMode::Active: cmux->exitSleepMode(); @@ -608,7 +605,7 @@ void ServiceCellular::registerMessageHandlers() auto message = static_cast(request); auto channel = cmux->get(CellularMux::Channel::Commands); if (channel == nullptr) { - LOG_ERROR("[VoLTE] failed to get channel, skipping request"); + LOG_ERROR("Skipping VoLTE request, failed to get channel"); return sys::MessageNone{}; } settings->setValue( @@ -632,7 +629,7 @@ void ServiceCellular::registerMessageHandlers() connect(typeid(cellular::msg::notification::SimReady), [&](sys::Message *) { if (priv->volteHandler->isFunctionalityResetNeeded()) { - LOG_INFO("[VoLTE] first run after switching - functionality reset needed"); + LOG_INFO("First run after switching VoLTE - functionality reset needed"); priv->modemResetHandler->performFunctionalityReset(); return sys::MessageNone{}; } @@ -722,7 +719,6 @@ void ServiceCellular::change_state(cellular::StateChange *msg) bool ServiceCellular::handle_idle() { - LOG_DEBUG("Idle"); return true; } @@ -782,7 +778,7 @@ bool ServiceCellular::handle_power_up_procedure() } case bsp::Board::none: default: - LOG_FATAL("Board not known!"); + LOG_FATAL("Unknown board!"); assert(0); break; } @@ -889,7 +885,7 @@ bool ServiceCellular::handle_audio_conf_procedure() if (cmux->startMultiplexer() == CellularMux::ConfState::Success) { - LOG_DEBUG("[ServiceCellular] Modem is fully operational"); + LOG_DEBUG("Modem is fully operational"); // open channel - notifications DLCChannel *notificationsChannel = cmux->get(CellularMux::Channel::Notifications); if (notificationsChannel != nullptr) { diff --git a/module-services/service-cellular/call/CellularCall.cpp b/module-services/service-cellular/call/CellularCall.cpp index 901b17a0c..7a7884ae7 100644 --- a/module-services/service-cellular/call/CellularCall.cpp +++ b/module-services/service-cellular/call/CellularCall.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "call/CellularCall.hpp" @@ -36,7 +36,7 @@ namespace call Call &Call::operator=(Call &&other) noexcept { if (not other.machine) { - LOG_ERROR("operator= on wrong call"); + LOG_ERROR("On wrong call"); return *this; } machine = std::make_unique(std::move(other.machine->di)); diff --git a/module-services/service-cellular/call/api/ModemCallApi.cpp b/module-services/service-cellular/call/api/ModemCallApi.cpp index eba48934f..5432a31eb 100644 --- a/module-services/service-cellular/call/api/ModemCallApi.cpp +++ b/module-services/service-cellular/call/api/ModemCallApi.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ModemCallApi.hpp" @@ -16,13 +16,13 @@ namespace cellular bool Api::handleEvent(at::AT modemCommand) { if (!cellular->cmux) { - LOG_INFO("no cmux at this time - ignoring request"); + LOG_INFO("No cmux at this time - ignoring request"); return false; } auto channel = cellular->cmux->get(CellularMux::Channel::Commands); if (!channel) { - LOG_INFO("no cmux command channel at this time - ignoring request"); + LOG_INFO("No cmux command channel at this time - ignoring request"); return false; } diff --git a/module-services/service-cellular/checkSmsCenter.cpp b/module-services/service-cellular/checkSmsCenter.cpp index fad83b637..dffcbbe53 100644 --- a/module-services/service-cellular/checkSmsCenter.cpp +++ b/module-services/service-cellular/checkSmsCenter.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "checkSmsCenter.hpp" @@ -14,7 +14,7 @@ if (!centerResponse) { success = false; if (centerResponse.code == at::Result::Code::PARSING_ERROR) { - LOG_FATAL("possibly unrecoverable SMS center value error!"); + LOG_FATAL("Possibly unrecoverable SMS center value error!"); } } return success; diff --git a/module-services/service-cellular/src/SimCard.cpp b/module-services/service-cellular/src/SimCard.cpp index 67571c890..1e336e370 100644 --- a/module-services/service-cellular/src/SimCard.cpp +++ b/module-services/service-cellular/src/SimCard.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "SimCard.hpp" @@ -394,7 +394,7 @@ namespace cellular onSimSelected(); } else { - LOG_ERROR("onSimSelected callback is missing"); + LOG_ERROR("Callback is missing"); } } } diff --git a/module-services/service-cellular/src/VolteHandler.hpp b/module-services/service-cellular/src/VolteHandler.hpp index d0c894bbd..ea4469824 100644 --- a/module-services/service-cellular/src/VolteHandler.hpp +++ b/module-services/service-cellular/src/VolteHandler.hpp @@ -40,7 +40,7 @@ namespace cellular::service { if (!permit) { if (enable) { - LOG_INFO("[VoLTE] requested to enable, but not permitted for this operator - disabling"); + LOG_INFO("Requested to enable VoLTE, but not permitted for this operator - disabling"); } enable = false; @@ -51,7 +51,7 @@ namespace cellular::service auto voiceDomainAnswer = channel.cmd(factory(at::AT::QNVFW) + NetworkServiceDomain(NetworkServiceDomain::Type::Voice)); if (!voiceDomainAnswer) { - throw std::runtime_error("[VoLTE] failed to set voice domain before trying to enable VoLTE"); + throw std::runtime_error("Failed to set voice domain before trying to enable VoLTE"); } auto smsDomainAnswer = diff --git a/module-services/service-cellular/src/VolteHandlerImpl.cpp b/module-services/service-cellular/src/VolteHandlerImpl.cpp index c71ce7721..50819fbe1 100644 --- a/module-services/service-cellular/src/VolteHandlerImpl.cpp +++ b/module-services/service-cellular/src/VolteHandlerImpl.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "VolteHandlerImpl.hpp" @@ -11,12 +11,12 @@ namespace cellular::internal std::pair parsed; if (!at::response::parseQCFG_IMS(response, parsed)) { - throw std::runtime_error("[VoLTE] unable to parse modem's response to QCFG with IMS"); + throw std::runtime_error("Unable to parse modem's response to QCFG with IMS"); } auto const &ims = parsed.first; bool stateMatchesRequest = (ims != IMSState::Disable) == requestedState; - LOG_INFO("[VoLTE] current IMS state: %s which %s expectation", + LOG_INFO("Current IMS state: %s which %s expectation", magic_enum::enum_name(ims).data(), ((stateMatchesRequest) ? "matches" : "doesn't match")); return stateMatchesRequest; diff --git a/module-services/service-cellular/src/ussd/USSDHandler.cpp b/module-services/service-cellular/src/ussd/USSDHandler.cpp index 0567b3756..2a9e88ef2 100644 --- a/module-services/service-cellular/src/ussd/USSDHandler.cpp +++ b/module-services/service-cellular/src/ussd/USSDHandler.cpp @@ -59,7 +59,7 @@ namespace cellular::ussd void USSDHandler::setUSSDTimer() { if (not onTimerStart || not onTimerStop) { - LOG_ERROR("No onTimerStart or onTimerStop callback provided!"); + LOG_ERROR("No callback provided!"); return; } switch (ussdState) { @@ -98,7 +98,7 @@ namespace cellular::ussd setUSSDTimer(); return true; default: - LOG_WARN("unexpected URC handling state: %s", magic_enum::enum_name(ussdState).data()); + LOG_WARN("Unexpected URC handling state: %s", magic_enum::enum_name(ussdState).data()); return false; } } @@ -106,7 +106,7 @@ namespace cellular::ussd bool USSDHandler::ussdSessionTimeout() { if (!onTimerGetState) { - LOG_ERROR("No onTimerGetState callback provided!"); + LOG_ERROR("No callback provided!"); return false; } diff --git a/module-services/service-cellular/src/volte/VolteCapabilityHandler.cpp b/module-services/service-cellular/src/volte/VolteCapabilityHandler.cpp index ee5d1cf59..ead731613 100644 --- a/module-services/service-cellular/src/volte/VolteCapabilityHandler.cpp +++ b/module-services/service-cellular/src/volte/VolteCapabilityHandler.cpp @@ -16,7 +16,7 @@ namespace cellular::service { const auto &imsi = cellularInterface->getImsi(channel); if (!imsi.has_value()) { - LOG_ERROR("[VoLTE] failed to read IMSI - VoLTE not permitted"); + LOG_ERROR("VoLTE not permitted - failed to read IMSI"); return false; } @@ -27,7 +27,7 @@ namespace cellular::service { const auto &imsi = cellularInterface->getImsi(channel); if (!imsi.has_value()) { - LOG_ERROR("[VoLTE] failed to read IMSI - VoLTE not permitted"); + LOG_ERROR("VoLTE not permitted - failed to read IMSI"); return ImsiParser::SupportStatus::Unsupported; } diff --git a/module-services/service-cellular/src/volte/VolteCapabilityHandlerCellular.cpp b/module-services/service-cellular/src/volte/VolteCapabilityHandlerCellular.cpp index 8d68f4eaa..502494a98 100644 --- a/module-services/service-cellular/src/volte/VolteCapabilityHandlerCellular.cpp +++ b/module-services/service-cellular/src/volte/VolteCapabilityHandlerCellular.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "VolteCapabilityHandlerCellular.hpp" @@ -11,7 +11,7 @@ namespace cellular::service { auto result = channel.cmd(at::AT::CIMI); if (not result) { - LOG_ERROR("[VoLTE] failed to read IMSI - will disable VoLTE"); + LOG_ERROR("Failed to read IMSI - will disable VoLTE"); return std::nullopt; } diff --git a/module-services/service-db/ServiceDBCommon.cpp b/module-services/service-db/ServiceDBCommon.cpp index 481a4ba3b..35e8cbd74 100644 --- a/module-services/service-db/ServiceDBCommon.cpp +++ b/module-services/service-db/ServiceDBCommon.cpp @@ -16,7 +16,6 @@ namespace ServiceDBCommon::ServiceDBCommon() : sys::Service(service::name::db, "", serviceDbStackSize, sys::ServicePriority::Idle) { - LOG_INFO("[ServiceDB] Initializing"); } db::Interface *ServiceDBCommon::getInterface(db::Interface::Name interface) @@ -65,8 +64,11 @@ sys::MessagePointer ServiceDBCommon::DataReceivedHandler(sys::DataMessage *msgl, sys::ReturnCodes ServiceDBCommon::InitHandler() { if (const auto isSuccess = Database::initialize(); !isSuccess) { + LOG_ERROR("Failed to initialize"); + return sys::ReturnCodes::Failure; } + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } @@ -79,6 +81,8 @@ sys::ReturnCodes ServiceDBCommon::DeinitHandler() if (const auto isSuccess = Database::deinitialize(); !isSuccess) { return sys::ReturnCodes::Failure; } + LOG_INFO("Deinitialized"); + return sys::ReturnCodes::Success; } diff --git a/module-services/service-db/agents/quotes/QuotesAgent.cpp b/module-services/service-db/agents/quotes/QuotesAgent.cpp index 5106f78fe..2c982edb5 100644 --- a/module-services/service-db/agents/quotes/QuotesAgent.cpp +++ b/module-services/service-db/agents/quotes/QuotesAgent.cpp @@ -110,7 +110,7 @@ namespace Quotes { auto req = std::dynamic_pointer_cast(query); auto [type, randomizedId] = randomizedQuoteModel.getId(); - LOG_DEBUG("Randomized id: %d, type: %d", randomizedId, static_cast(type)); + LOG_DEBUG("Randomized id: %d, type: %s", randomizedId, magic_enum::enum_name(type).data()); std::unique_ptr queryResult; if (type == QuoteType::Predefined) { diff --git a/module-services/service-db/agents/quotes/RandomizedQuoteModel.cpp b/module-services/service-db/agents/quotes/RandomizedQuoteModel.cpp index ec680325d..f91d5e024 100644 --- a/module-services/service-db/agents/quotes/RandomizedQuoteModel.cpp +++ b/module-services/service-db/agents/quotes/RandomizedQuoteModel.cpp @@ -87,9 +87,9 @@ namespace Quotes settings->setValue( settings::Quotes::randomQuotesList, serializer->serialize(list), settings::SettingsScope::Global); } - LOG_DEBUG("Selected quote ID: %d, type: %d, remaining quotes to next shuffle: %zu", + LOG_DEBUG("Selected quote ID: %d, type: %s, remaining quotes to next shuffle: %zu", list.front().second, - static_cast(list.front().first), + magic_enum::enum_name(list.front().first).data(), list.size()); } auto RandomizedQuoteModel::isIdExpired() -> bool diff --git a/module-services/service-db/agents/settings/SettingsAgent.cpp b/module-services/service-db/agents/settings/SettingsAgent.cpp index 40c12e0b9..356c67a9b 100644 --- a/module-services/service-db/agents/settings/SettingsAgent.cpp +++ b/module-services/service-db/agents/settings/SettingsAgent.cpp @@ -118,7 +118,7 @@ auto SettingsAgent::handleSetVariable(sys::Message *req) -> sys::MessagePointer auto updateMsg = std::make_shared(regPath, value, oldValue.value_or("")); parentService->bus.sendUnicast(std::move(updateMsg), regPath.service); - LOG_DEBUG("[SettingsAgent::handleSetVariable] notified service: %s", regPath.service.c_str()); + LOG_DEBUG("SettingsAgent notified service: %s", regPath.service.c_str()); } } } @@ -141,7 +141,7 @@ auto SettingsAgent::handleRegisterOnVariableChange(sys::Message *req) -> sys::Me return std::make_shared(); } auto currentValue = dbGetValue(path).value_or(""); - LOG_DEBUG("[SettingsAgent::handleRegisterOnVariableChange] %s", path.to_string().c_str()); + LOG_DEBUG("SettingsAgent handled register for: %s", path.to_string().c_str()); auto msgValue = std::make_shared<::settings::Messages::VariableChanged>(std::move(path), std::move(currentValue), ""); parentService->bus.sendUnicast(std::move(msgValue), msg->sender); @@ -156,7 +156,7 @@ auto SettingsAgent::handleUnregisterOnVariableChange(sys::Message *req) -> sys:: auto path = msg->getPath(); if (dbUnregisterValueChange(path)) { if (auto it = variableChangeRecipients.find(path.to_string()); it != variableChangeRecipients.end()) { - LOG_DEBUG("[SettingsAgent::handleUnregisterOnVariableChange] %s", path.to_string().c_str()); + LOG_DEBUG("SettingsAgent handled unregister for: %s", path.to_string().c_str()); it->second.erase(path); } } diff --git a/module-services/service-desktop/ServiceDesktop.cpp b/module-services/service-desktop/ServiceDesktop.cpp index 66e76d5e3..4c7c06c9d 100644 --- a/module-services/service-desktop/ServiceDesktop.cpp +++ b/module-services/service-desktop/ServiceDesktop.cpp @@ -22,7 +22,6 @@ ServiceDesktop::ServiceDesktop(const std::filesystem::path &mtpRootPath) [this](sys::Timer & /*timer*/) { outboxNotifications.clearNotifications(); })}, mtpRootPath{mtpRootPath} { - LOG_INFO("[ServiceDesktop] Initializing"); bus.channels.push_back(sys::BusChannel::PhoneLockChanges); bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); bus.channels.push_back(sys::BusChannel::USBNotifications); @@ -30,7 +29,6 @@ ServiceDesktop::ServiceDesktop(const std::filesystem::path &mtpRootPath) ServiceDesktop::~ServiceDesktop() { - LOG_INFO("[ServiceDesktop] Cleaning resources"); } sys::ReturnCodes ServiceDesktop::InitHandler() @@ -55,11 +53,13 @@ sys::ReturnCodes ServiceDesktop::InitHandler() checkChargingCondition(); + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } sys::ReturnCodes ServiceDesktop::DeinitHandler() { + LOG_INFO("Deinitialized"); return usbWorkerDeinit(); } @@ -80,11 +80,11 @@ sys::MessagePointer ServiceDesktop::DataReceivedHandler(sys::DataMessage * /*msg if (auto queryResponse = dynamic_cast(resp)) { auto result = queryResponse->getResult(); if (result == nullptr) { - LOG_ERROR("Wrong result - nullptr!"); + LOG_ERROR("Wrong result: nullptr!"); return response; } if (result->hasListener()) { - LOG_DEBUG("Handling result..."); + LOG_DEBUG("Handling result"); result->handle(); } } @@ -211,6 +211,7 @@ auto ServiceDesktop::usbWorkerDeinit() -> sys::ReturnCodes desktopWorker.reset(); initialized = false; isUsbConfigured = false; + LOG_DEBUG("USB worker deinitialized"); // It must be run after the worker is closed. cleanFileSystemEndpointUndeliveredTransfers(); return sys::ReturnCodes::Success; diff --git a/module-services/service-desktop/Sync.cpp b/module-services/service-desktop/Sync.cpp index 263a70fbc..a98796556 100644 --- a/module-services/service-desktop/Sync.cpp +++ b/module-services/service-desktop/Sync.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -23,7 +23,7 @@ static bool isValidDirentry(const std::filesystem::directory_entry &direntry) Sync::CompletionCode Sync::PrepareSyncPackage(sys::Service *ownerService, std::filesystem::path &path) { assert(ownerService != nullptr); - LOG_INFO("Sync package preparation started..."); + LOG_DEBUG("Sync package preparation started"); if (!Sync::RemoveSyncDir(path)) { return CompletionCode::FSError; @@ -33,9 +33,8 @@ Sync::CompletionCode Sync::PrepareSyncPackage(sys::Service *ownerService, std::f return CompletionCode::FSError; } - LOG_DEBUG("Sync package preparation started..."); if (!DBServiceAPI::DBPrepareSyncPackage(ownerService, path)) { - LOG_ERROR("Sync package preparation, quitting..."); + LOG_ERROR("Sync package preparation failed, quiting"); Sync::RemoveSyncDir(path); return CompletionCode::DBError; } @@ -51,6 +50,8 @@ Sync::CompletionCode Sync::PrepareSyncPackage(sys::Service *ownerService, std::f return CompletionCode::FSError; } + LOG_DEBUG("Sync package preparation finished"); + return CompletionCode::Success; } @@ -58,11 +59,11 @@ bool Sync::RemoveSyncDir(const std::filesystem::path &path) { /* prepare directories */ if (std::filesystem::is_directory(path)) { - LOG_INFO("Removing sync directory %s...", path.c_str()); + LOG_DEBUG("Removing sync directory: %s", path.c_str()); std::error_code errorCode; if (std::filesystem::remove_all(path, errorCode) == 0) { - LOG_ERROR("Removing sync directory %s failed, error: %d.", path.c_str(), errorCode.value()); + LOG_ERROR("Removing sync directory '%s' failed, error: %d.", path.c_str(), errorCode.value()); return false; } } @@ -72,7 +73,7 @@ bool Sync::RemoveSyncDir(const std::filesystem::path &path) bool Sync::CreateSyncDir(const std::filesystem::path &path) { - LOG_INFO("Creating sync directory %s...", path.c_str()); + LOG_INFO("Creating sync directory: %s", path.c_str()); if (std::filesystem::exists(path)) { LOG_ERROR("Sync directory already exists!"); return false; @@ -88,7 +89,7 @@ bool Sync::CreateSyncDir(const std::filesystem::path &path) bool Sync::PackSyncFiles(const std::filesystem::path &path) { if (std::filesystem::is_empty(path)) { - LOG_ERROR("Sync dir is empty, quitting..."); + LOG_ERROR("Sync dir is empty, quitting"); return false; } @@ -102,11 +103,11 @@ bool Sync::PackSyncFiles(const std::filesystem::path &path) } }); - LOG_INFO("Opening tar %s file...", tarFilePath.c_str()); + LOG_INFO("Opening tar %s file", tarFilePath.c_str()); int ret = mtar_open(&tarFile, tarFilePath.c_str(), "w"); if (ret != MTAR_ESUCCESS) { - LOG_ERROR("Opening tar file failed, quitting..."); + LOG_ERROR("Opening tar file failed, quitting"); return false; } isTarFileOpen = true; @@ -121,8 +122,8 @@ bool Sync::PackSyncFiles(const std::filesystem::path &path) continue; } - LOG_INFO("Archiving file ..."); - LOG_DEBUG("Writing tar header ..."); + LOG_DEBUG("Archiving file "); + LOG_DEBUG("Writing tar header"); if (mtar_write_file_header(&tarFile, direntry.path().filename().c_str(), @@ -155,21 +156,21 @@ bool Sync::PackSyncFiles(const std::filesystem::path &path) fileStream.read(fileStreamBuffer.get(), readSize); if (mtar_write_data(&tarFile, fileStreamBuffer.get(), readSize) != MTAR_ESUCCESS) { - LOG_ERROR("Writing into sync package failed, quitting..."); + LOG_ERROR("Writing into sync package failed, quitting"); return false; } } } - LOG_INFO("Finalizing tar file..."); + LOG_DEBUG("Finalizing tar file"); if (mtar_finalize(&tarFile) != MTAR_ESUCCESS) { - LOG_ERROR("Finalizing tar file failed, quitting...."); + LOG_ERROR("Finalizing tar file failed, quitting"); return false; } - LOG_INFO("Closing tar file..."); + LOG_INFO("Closing tar file"); if (mtar_close(&tarFile) != MTAR_ESUCCESS) { - LOG_ERROR("Closing tar file failed, quitting..."); + LOG_ERROR("Closing tar file failed, quitting"); return false; } isTarFileOpen = false; diff --git a/module-services/service-desktop/WorkerDesktop.cpp b/module-services/service-desktop/WorkerDesktop.cpp index 1e4111dcd..7afb29c91 100644 --- a/module-services/service-desktop/WorkerDesktop.cpp +++ b/module-services/service-desktop/WorkerDesktop.cpp @@ -70,8 +70,6 @@ void WorkerDesktop::closeWorker(void) } initialized = false; - LOG_INFO("we can deinit worker now"); - /// additional wait to flush on serial - we should wait for data sent... vTaskDelay(500); @@ -86,8 +84,6 @@ void WorkerDesktop::closeWorker(void) LOG_ERROR("Sentinel %s could not be removed!", cpuSentinel->GetName().c_str()); } cpuSentinel.reset(); - - LOG_DEBUG("deinit end"); } void WorkerDesktop::reset() @@ -141,7 +137,7 @@ bool WorkerDesktop::handleMessage(std::uint32_t queueID) result = handleSignallingQueueMessage(queue); } else { - LOG_INFO("handleMessage got message on an unhandled queue '%s'!", qname.c_str()); + LOG_WARN("Unhandled queue '%s'!", qname.c_str()); } return result; @@ -154,7 +150,7 @@ bool WorkerDesktop::handleReceiveQueueMessage(std::shared_ptr } std::string *receivedMsg = nullptr; if (!queue->Dequeue(&receivedMsg, 0)) { - LOG_ERROR("handleMessage xQueueReceive failed for '%s'.", sdesktop::cdcReceiveQueueName); + LOG_ERROR("Failed dequeue for '%s'.", sdesktop::cdcReceiveQueueName); return false; } @@ -176,13 +172,13 @@ bool WorkerDesktop::handleSendQueueMessage(std::shared_ptr &qu } std::string *sendMsg = nullptr; if (!queue->Dequeue(&sendMsg, 0)) { - LOG_ERROR("handleMessage xQueueReceive failed for '%s'.", sdesktop::cdcSendQueueName); + LOG_ERROR("Failed dequeue for '%s'.", sdesktop::cdcSendQueueName); return false; } const std::uint32_t dataSent = bsp::usbCDCSend(sendMsg); if (dataSent != sendMsg->length()) { - LOG_ERROR("Data not sent! Data sent: %" PRIu32 "B, msg length: %zuB", dataSent, sendMsg->length()); + LOG_ERROR("Data not sent! (Data sent: %" PRIu32 "B, msg length: %zuB)", dataSent, sendMsg->length()); } delete sendMsg; @@ -198,13 +194,13 @@ bool WorkerDesktop::handleServiceQueueMessage(std::shared_ptr sys::WorkerCommand cmd; if (serviceQueue.Dequeue(&cmd, 0)) { - LOG_DEBUG("Received cmd: %d", static_cast(cmd.command)); + LOG_DEBUG("Received command: %d", static_cast(cmd.command)); #if defined(DEBUG) assert(false); #endif } else { - LOG_ERROR("handleMessage xQueueReceive failed for '%s'.", SERVICE_QUEUE_NAME.c_str()); + LOG_ERROR("Failed dequeue for '%s'.", SERVICE_QUEUE_NAME.c_str()); return false; } return true; @@ -214,7 +210,7 @@ bool WorkerDesktop::handleIrqQueueMessage(std::shared_ptr &que { bsp::USBDeviceStatus notification = bsp::USBDeviceStatus::Disconnected; if (!queue->Dequeue(¬ification, 0)) { - LOG_ERROR("handleMessage xQueueReceive failed for %s.", sdesktop::irqQueueName); + LOG_ERROR("Failed dequeue for %s.", sdesktop::irqQueueName); return false; } @@ -266,7 +262,7 @@ bool WorkerDesktop::handleSignallingQueueMessage(std::shared_ptrDequeue(&cmd, 0)) { - LOG_ERROR("handleMessage xQueueReceive failed for '%s'.", sdesktop::signallingQueueName); + LOG_ERROR("Failed dequeue for '%s'.", sdesktop::signallingQueueName); return false; } diff --git a/module-services/service-desktop/endpoints/Endpoint.cpp b/module-services/service-desktop/endpoints/Endpoint.cpp index 9e6d3dc60..007790ae9 100644 --- a/module-services/service-desktop/endpoints/Endpoint.cpp +++ b/module-services/service-desktop/endpoints/Endpoint.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -23,7 +23,7 @@ namespace sdesktop::endpoints { context.setResponseStatus(http::Code::Forbidden); sender::putToSendQueue(context.createSimpleResponse()); - LOG_INFO("Endpoint #%d secured", static_cast(context.getEndpoint())); + LOG_INFO("Endpoint '%s' secured", magic_enum::enum_name(context.getEndpoint()).data()); } } // namespace sdesktop::endpoints diff --git a/module-services/service-desktop/endpoints/bluetooth/BluetoothHelper.cpp b/module-services/service-desktop/endpoints/bluetooth/BluetoothHelper.cpp index f911fe4f9..baf2c3775 100644 --- a/module-services/service-desktop/endpoints/bluetooth/BluetoothHelper.cpp +++ b/module-services/service-desktop/endpoints/bluetooth/BluetoothHelper.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -42,11 +42,11 @@ namespace sdesktop::endpoints const auto &power = state[btConsts::states::power]; if (power == json::bluetooth::on) { status.state = BluetoothStatus::State::On; - LOG_INFO("turning on BT from harness!"); + LOG_INFO("Turning on BT from harness!"); } else if (power == json::bluetooth::off) { status.state = BluetoothStatus::State::Off; - LOG_INFO("turning off BT from harness!"); + LOG_INFO("Turning off BT from harness!"); } const auto &visibility = state[btConsts::states::visibility]; status.visibility = visibility == json::bluetooth::on; diff --git a/module-services/service-desktop/endpoints/developerMode/DeveloperModeHelper.cpp b/module-services/service-desktop/endpoints/developerMode/DeveloperModeHelper.cpp index aef08cc5d..2c9c030c9 100644 --- a/module-services/service-desktop/endpoints/developerMode/DeveloperModeHelper.cpp +++ b/module-services/service-desktop/endpoints/developerMode/DeveloperModeHelper.cpp @@ -62,7 +62,7 @@ namespace sdesktop::endpoints using namespace sdesktop::developerMode; auto cmd = body[json::developerMode::AT].string_value(); auto timeout = std::chrono::milliseconds(body[json::developerMode::timeout].int_value()); - LOG_DEBUG("at request sent with timeout >%d<", int(timeout.count())); + LOG_DEBUG("At request sent with timeout >%d<", int(timeout.count())); auto event = std::make_unique(cmd, timeout); auto msg = std::make_shared(std::move(event)); code = toCode(owner->bus.sendUnicast(msg, service::name::cellular)); @@ -273,7 +273,7 @@ namespace sdesktop::endpoints case 18: return bsp::KeyCodes::SSwitchMid; default: - LOG_ERROR("invalid keycode"); + LOG_ERROR("Invalid keycode"); return bsp::KeyCodes::Undefined; }; } diff --git a/module-services/service-desktop/endpoints/developerMode/Mode/UI_Helper.cpp b/module-services/service-desktop/endpoints/developerMode/Mode/UI_Helper.cpp index 8aecc1a6c..9b5a70687 100644 --- a/module-services/service-desktop/endpoints/developerMode/Mode/UI_Helper.cpp +++ b/module-services/service-desktop/endpoints/developerMode/Mode/UI_Helper.cpp @@ -12,7 +12,7 @@ namespace sdesktop::endpoints { void UI_Helper::preProcess(http::Method method, Context &context) { - LOG_INFO("In UI helper - requesting %d", static_cast(method)); + LOG_INFO("In UI helper: requesting %s", magic_enum::enum_name(method).data()); } class UIEvent : public sdesktop::Event diff --git a/module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpointCommon.cpp b/module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpointCommon.cpp index 662489ee0..cd1ddbbcf 100644 --- a/module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpointCommon.cpp +++ b/module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpointCommon.cpp @@ -31,7 +31,7 @@ namespace sdesktop::endpoints const auto diagFileType = parseDiagnosticFileType(requestBody[json::fileList]); if (!magic_enum::enum_contains(diagFileType)) { - LOG_ERROR("Bad diagnostic type %d requested", static_cast(diagFileType)); + LOG_ERROR("Bad diagnostic type '%s' requested", magic_enum::enum_name(diagFileType).data()); return http::Code::BadRequest; } diff --git a/module-services/service-desktop/endpoints/filesystem/FS_Helper.cpp b/module-services/service-desktop/endpoints/filesystem/FS_Helper.cpp index 3bb1b5520..cf1a451c2 100644 --- a/module-services/service-desktop/endpoints/filesystem/FS_Helper.cpp +++ b/module-services/service-desktop/endpoints/filesystem/FS_Helper.cpp @@ -50,7 +50,6 @@ namespace sdesktop::endpoints auto FS_Helper::processGet(Context &context) -> ProcessResult { - LOG_DEBUG("Handling GET"); const auto &body = context.getBody(); ResponseContext response{}; @@ -74,7 +73,6 @@ namespace sdesktop::endpoints auto FS_Helper::processPut(Context &context) -> ProcessResult { - LOG_DEBUG("Handling PUT"); const auto &body = context.getBody(); auto code = http::Code::BadRequest; ResponseContext response{}; @@ -103,7 +101,6 @@ namespace sdesktop::endpoints auto FS_Helper::processDelete(Context &context) -> ProcessResult { - LOG_DEBUG("Handling DEL"); const auto &body = context.getBody(); auto code = http::Code::BadRequest; @@ -191,7 +188,7 @@ namespace sdesktop::endpoints dataWithCrc32 = fileOps.getDataForReceiveID(rxID, chunkNo); } catch (std::exception &e) { - LOG_ERROR("%s", e.what()); + LOG_ERROR("Exception during getting data: %s", e.what()); json11::Json::object response({{json::reason, e.what()}}); return ResponseContext{.status = http::Code::BadRequest, .body = response}; @@ -233,7 +230,7 @@ namespace sdesktop::endpoints LOG_DEBUG("Start sending of file: %s", filePath.c_str()); if (fileSize == 0 || fileCrc32.empty()) { - LOG_ERROR("File %s corrupted", filePath.c_str()); + LOG_ERROR("File '%s' corrupted", filePath.c_str()); return ResponseContext{.status = code}; } @@ -248,8 +245,6 @@ namespace sdesktop::endpoints if (!std::filesystem::exists(filePath)) { LOG_DEBUG("Creating file %s", filePath.c_str()); - - code = http::Code::Created; } else { LOG_DEBUG("Overwriting file %s", filePath.c_str()); @@ -304,8 +299,7 @@ namespace sdesktop::endpoints returnCode = fileOps.sendDataForTransmitID(txID, chunkNo, data); } catch (std::exception &e) { - LOG_ERROR("%s", e.what()); - + LOG_ERROR("Exception during sending data: %s", e.what()); auto code = http::Code::NotAcceptable; auto response = json11::Json::object({{json::reason, e.what()}}); @@ -320,8 +314,6 @@ namespace sdesktop::endpoints {{json::fs::txID, static_cast(txID)}, {json::fs::chunkNo, static_cast(chunkNo)}}); } else { - LOG_ERROR("FileOperations::sendDataForTransmitID failed"); - code = http::Code::BadRequest; response = json11::Json::object( {{json::fs::txID, static_cast(txID)}, {json::fs::chunkNo, static_cast(chunkNo)}}); diff --git a/module-services/service-desktop/endpoints/filesystem/FileContext.cpp b/module-services/service-desktop/endpoints/filesystem/FileContext.cpp index 87af1fa52..c8a6c8c49 100644 --- a/module-services/service-desktop/endpoints/filesystem/FileContext.cpp +++ b/module-services/service-desktop/endpoints/filesystem/FileContext.cpp @@ -106,7 +106,7 @@ auto FileReadContext::read() -> std::vector advanceFileOffset(dataLeft); if (reachedEOF()) { - LOG_INFO("Reached EOF"); + LOG_DEBUG("Reached EOF"); } return buffer; @@ -134,7 +134,7 @@ auto FileWriteContext::write(const std::vector &data) -> void advanceFileOffset(dataLeft); if (reachedEOF()) { - LOG_INFO("Reached EOF of %s", path.c_str()); + LOG_DEBUG("Reached EOF of %s", path.c_str()); } } diff --git a/module-services/service-desktop/endpoints/filesystem/FileOperations.cpp b/module-services/service-desktop/endpoints/filesystem/FileOperations.cpp index 879b11344..7dad57c70 100644 --- a/module-services/service-desktop/endpoints/filesystem/FileOperations.cpp +++ b/module-services/service-desktop/endpoints/filesystem/FileOperations.cpp @@ -156,7 +156,7 @@ auto FileOperations::getDataForReceiveID(transfer_id rxID, std::uint32_t chunkNo } if (fileCtx->reachedEOF()) { - LOG_INFO("Reached EOF for rxID %u", static_cast(rxID)); + LOG_DEBUG("Reached EOF for rxID %u", static_cast(rxID)); fileCrc32 = fileCtx->fileHash(); writeTransfers.erase(rxID); } @@ -208,7 +208,7 @@ auto FileOperations::sendDataForTransmitID(transfer_id txID, std::uint32_t chunk fileCtx->write(*fileData); if (fileCtx->reachedEOF()) { - LOG_INFO("Reached EOF for txID %u", static_cast(txID)); + LOG_DEBUG("Reached EOF for txID %u", static_cast(txID)); auto fileOK = fileCtx->crc32Matches(); if (!fileOK) { @@ -232,7 +232,7 @@ auto FileOperations::cleanUpUndeliveredTransfers() -> void return; } - LOG_INFO("Clean up after undelivered transfers"); + LOG_DEBUG("Clean up after undelivered transfers"); for (auto &wt : writeTransfers) { wt.second->removeFile(); wt.second.reset(); diff --git a/module-services/service-desktop/endpoints/update/UpdateHelper.cpp b/module-services/service-desktop/endpoints/update/UpdateHelper.cpp index 912ea8b17..2f36174ba 100644 --- a/module-services/service-desktop/endpoints/update/UpdateHelper.cpp +++ b/module-services/service-desktop/endpoints/update/UpdateHelper.cpp @@ -94,7 +94,7 @@ namespace sdesktop::endpoints bool removeDirectory(const std::filesystem::path &path) { if (std::filesystem::is_directory(path)) { - LOG_INFO("'%s' exists, removing", path.c_str()); + LOG_INFO("Removing directory: %s", path.c_str()); std::error_code errorCode; if (std::filesystem::remove_all(path, errorCode) == 0) { return false; @@ -167,7 +167,7 @@ namespace sdesktop::endpoints void UpdateHelper::preProcess(http::Method method, [[maybe_unused]] Context &context) { - LOG_INFO("In UpdateHelper - requesting %d", static_cast(method)); + LOG_INFO("UpdateHelper requesting: %s", magic_enum::enum_name(method).data()); } auto UpdateHelper::processPost(Context &context) -> ProcessResult diff --git a/module-services/service-desktop/parser/MessageHandler.cpp b/module-services/service-desktop/parser/MessageHandler.cpp index ada44e6cc..be05116a5 100644 --- a/module-services/service-desktop/parser/MessageHandler.cpp +++ b/module-services/service-desktop/parser/MessageHandler.cpp @@ -32,7 +32,7 @@ namespace sdesktop::endpoints { auto context = ContextFactory::create(messageJson); - LOG_DEBUG("[MsgHandler]\nmethod: %s\nendpoint: %s\nuuid: %d", + LOG_DEBUG("Message details: method: %s, endpoint: %s, uuid: %d", magic_enum::enum_name(context->getMethod()).data(), magic_enum::enum_name(context->getEndpoint()).data(), context->getUuid()); @@ -40,7 +40,7 @@ namespace sdesktop::endpoints auto handler = endpointFactory->create(*context, OwnerServicePtr); if (handler == nullptr) { - LOG_ERROR("No way to handle!"); + LOG_ERROR("Handler not created. Cannot proceed"); return; } handler->handle(*context); diff --git a/module-services/service-desktop/parser/ParserFSM.cpp b/module-services/service-desktop/parser/ParserFSM.cpp index bf41135bc..afd46e851 100644 --- a/module-services/service-desktop/parser/ParserFSM.cpp +++ b/module-services/service-desktop/parser/ParserFSM.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ParserFSM.hpp" @@ -93,8 +93,6 @@ namespace sdesktop::endpoints return; } - LOG_DEBUG("Payload length: %lu", payloadLength); - message::removeHeader(receivedMsg); parseNewMessage(); } @@ -110,7 +108,6 @@ namespace sdesktop::endpoints LOG_DEBUG("Header: %s\n", header.c_str()); payloadLength = message::calcPayloadLength(header); - LOG_DEBUG("Payload length: %lu\n", payloadLength); message::eraseFront(receivedMsg, missingHeaderLength); parseNewMessage(); diff --git a/module-services/service-eink/ServiceEink.cpp b/module-services/service-eink/ServiceEink.cpp index d2179e006..4a54ef7b2 100644 --- a/module-services/service-eink/ServiceEink.cpp +++ b/module-services/service-eink/ServiceEink.cpp @@ -87,7 +87,6 @@ namespace service::eink sys::ReturnCodes ServiceEink::InitHandler() { - LOG_INFO("Initializing Eink"); if (const auto status = display->reinitAndPowerOn(); status != hal::eink::EinkStatus::EinkOK) { LOG_FATAL("Error: Could not initialize Eink display!"); return sys::ReturnCodes::Failure; @@ -104,6 +103,7 @@ namespace service::eink eInkSentinel->HoldMinimumFrequency(); + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } @@ -128,6 +128,8 @@ namespace service::eink display->shutdown(); settings->deinit(); + + LOG_INFO("Deinitialized"); return sys::ReturnCodes::Success; } @@ -144,7 +146,6 @@ namespace service::eink sys::ReturnCodes ServiceEink::SwitchPowerModeHandler(const sys::ServicePowerMode mode) { - LOG_INFO("PowerModeHandler: %s", c_str(mode)); switch (mode) { case sys::ServicePowerMode::Active: enterActiveMode(); diff --git a/module-services/service-fileindexer/InotifyHandler.cpp b/module-services/service-fileindexer/InotifyHandler.cpp index d4aff07b5..1d4395a08 100644 --- a/module-services/service-fileindexer/InotifyHandler.cpp +++ b/module-services/service-fileindexer/InotifyHandler.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -41,8 +41,7 @@ namespace service::detail void InotifyHandler::registerMessageHandlers() { - if (svc == nullptr) { - LOG_ERROR("svc is nullptr"); + if (!isParentServiceInitialized()) { return; } svc->connect(typeid(purefs::fs::message::inotify), [&](sys::Message *request) -> sys::MessagePointer { @@ -53,7 +52,7 @@ namespace service::detail bool InotifyHandler::addWatch(std::string_view monitoredPath) { if (mfsNotifier == nullptr) { - LOG_ERROR("mfsNotifier is nullptr"); + LOG_ERROR("Notifier not initialized"); return false; } // Wait for close, delete move to or from location @@ -142,15 +141,14 @@ namespace service::detail // On update or create content void InotifyHandler::onUpdateOrCreate(std::string_view path) { - LOG_DEBUG("onUpdateOrCreate: %s", std::string(path).c_str()); - if (svc == nullptr) { - LOG_ERROR("svc is nullptr"); + LOG_DEBUG("Processing file: %s", std::string(path).c_str()); + if (!isParentServiceInitialized()) { return; } const auto extension = utils::stringToLowercase(fs::path(path).extension()); if (!isExtSupported(extension)) { - LOG_WARN("Not supported extension - %s", extension.c_str()); + LOG_WARN("Not supported extension: %s", extension.c_str()); return; } @@ -160,22 +158,21 @@ namespace service::detail DBServiceAPI::GetQuery(svc.get(), db::Interface::Name::MultimediaFiles, std::move(query)); } else { - LOG_INFO("onUpdateOrCreate: skipped file"); + LOG_WARN("File corrupted, skipping."); } } // On remove content void InotifyHandler::onRemove(std::string_view path) { - LOG_DEBUG("onRemove path: %s", std::string(path).c_str()); - if (svc == nullptr) { - LOG_ERROR("svc is nullptr"); + LOG_DEBUG("Processing file: %s", std::string(path).c_str()); + if (!isParentServiceInitialized()) { return; } const auto extension = utils::stringToLowercase(fs::path(path).extension()); if (!isExtSupported(extension)) { - LOG_WARN("Not supported extension - %s", extension.c_str()); + LOG_WARN("Not supported extension: %s", extension.c_str()); return; } @@ -183,4 +180,13 @@ namespace service::detail DBServiceAPI::GetQuery(svc.get(), db::Interface::Name::MultimediaFiles, std::move(query)); } + bool InotifyHandler::isParentServiceInitialized() + { + if (svc == nullptr) { + LOG_ERROR("Parent service is nullptr, cannot proceed"); + return false; + } + return true; + } + } // namespace service::detail diff --git a/module-services/service-fileindexer/ServiceFileIndexer.cpp b/module-services/service-fileindexer/ServiceFileIndexer.cpp index e40f39754..3a97c1394 100644 --- a/module-services/service-fileindexer/ServiceFileIndexer.cpp +++ b/module-services/service-fileindexer/ServiceFileIndexer.cpp @@ -19,12 +19,10 @@ namespace service ServiceFileIndexer::ServiceFileIndexer(const std::vector &paths) : sys::Service{service::name::file_indexer, "", fileIndexerServiceStackSize}, mStartupIndexer{paths} { - LOG_DEBUG("[%s] Initializing", service::name::file_indexer); } ServiceFileIndexer::~ServiceFileIndexer() { - LOG_INFO("[%s] Cleaning resources", service::name::file_indexer); } sys::MessagePointer ServiceFileIndexer::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) @@ -43,12 +41,13 @@ namespace service return sys::ReturnCodes::Success; } + LOG_INFO("Initialized"); return sys::ReturnCodes::Failure; } sys::ReturnCodes ServiceFileIndexer::DeinitHandler() { - LOG_DEBUG("[%s] Deitializing", service::name::file_indexer); + LOG_INFO("Deinitialized"); return sys::ReturnCodes::Success; } diff --git a/module-services/service-fileindexer/StartupIndexer.cpp b/module-services/service-fileindexer/StartupIndexer.cpp index 5b892a3a0..d1eef811f 100644 --- a/module-services/service-fileindexer/StartupIndexer.cpp +++ b/module-services/service-fileindexer/StartupIndexer.cpp @@ -94,7 +94,7 @@ namespace service::detail if (isDirectoryFullyTraversed(mSubDirIterator)) { if (mTopDirIterator == std::cend(directoriesToScan)) { createLockFile(); - LOG_INFO("Initial startup indexer - Finished ..."); + LOG_INFO("Initial startup indexer: Finished"); mIdxTimer.stop(); return; } @@ -125,7 +125,7 @@ namespace service::detail auto StartupIndexer::start(std::shared_ptr svc, std::string_view svc_name) -> void { if (!hasLockFile()) { - LOG_INFO("Initial startup indexer - Started..."); + LOG_INFO("Initial startup indexer: Started"); auto query = std::make_unique(); DBServiceAPI::GetQuery(svc.get(), db::Interface::Name::MultimediaFiles, std::move(query)); @@ -135,7 +135,7 @@ namespace service::detail mForceStop = false; } else { - LOG_INFO("Initial startup indexer - Not needed..."); + LOG_INFO("Initial startup indexer: Not needed"); } } diff --git a/module-services/service-fileindexer/include/service-fileindexer/InotifyHandler.hpp b/module-services/service-fileindexer/include/service-fileindexer/InotifyHandler.hpp index 99453a5aa..56f890682 100644 --- a/module-services/service-fileindexer/include/service-fileindexer/InotifyHandler.hpp +++ b/module-services/service-fileindexer/include/service-fileindexer/InotifyHandler.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #pragma once @@ -43,5 +43,7 @@ namespace service::detail void onRemove(std::string_view path); sys::MessagePointer handleInotifyMessage(purefs::fs::message::inotify *inotify); + + bool isParentServiceInitialized(); }; } // namespace service::detail diff --git a/module-services/service-gui/ServiceGUI.cpp b/module-services/service-gui/ServiceGUI.cpp index a3d6081cf..4f913559c 100644 --- a/module-services/service-gui/ServiceGUI.cpp +++ b/module-services/service-gui/ServiceGUI.cpp @@ -88,12 +88,16 @@ namespace service::gui worker->init(queueInfo); worker->run(); stateManager.setState(ServiceGUIState::Running); + + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } sys::ReturnCodes ServiceGUI::DeinitHandler() { worker->close(); + + LOG_INFO("Deinitialized"); return sys::ReturnCodes::Success; } @@ -116,7 +120,6 @@ namespace service::gui sys::ReturnCodes ServiceGUI::SwitchPowerModeHandler(const sys::ServicePowerMode mode) { - LOG_INFO("PowerModeHandler: %s", c_str(mode)); return sys::ReturnCodes::Success; } diff --git a/module-services/service-test/ServiceTest.cpp b/module-services/service-test/ServiceTest.cpp index dc6aef6bc..c868cdc1b 100644 --- a/module-services/service-test/ServiceTest.cpp +++ b/module-services/service-test/ServiceTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "service-test/ServiceTest.hpp" @@ -14,7 +14,6 @@ namespace service::test ServiceTest::ServiceTest() : sys::Service(service::name::service_test, "", stackSize) { - LOG_INFO("[ServiceTest] Initializing"); } sys::ReturnCodes ServiceTest::InitHandler() @@ -50,11 +49,14 @@ namespace service::test t.stop(); }); th.start(); + + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } sys::ReturnCodes ServiceTest::DeinitHandler() { + LOG_INFO("Deinitialized"); return sys::ReturnCodes::Success; } diff --git a/module-services/service-time/AlarmHandlerFactory.cpp b/module-services/service-time/AlarmHandlerFactory.cpp index a11f94aaf..b2992c0ec 100644 --- a/module-services/service-time/AlarmHandlerFactory.cpp +++ b/module-services/service-time/AlarmHandlerFactory.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -14,7 +14,7 @@ namespace alarms if (handlers.count(type) != 0u) { return handlers.at(type); } - LOG_ERROR("no such alarm type handler defined: %d", static_cast(type)); + LOG_ERROR("Alarm handler: %d is not defined", static_cast(type)); return nullptr; } diff --git a/module-services/service-time/ServiceTime.cpp b/module-services/service-time/ServiceTime.cpp index e8cd16269..e72d03e5f 100644 --- a/module-services/service-time/ServiceTime.cpp +++ b/module-services/service-time/ServiceTime.cpp @@ -26,14 +26,12 @@ namespace stm std::make_unique(this))}, alarmOperationsFactory{std::move(alarmOperationsFactory)} { - LOG_INFO("[ServiceTime] Initializing"); bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); bus.channels.push_back(sys::BusChannel::ServiceEvtmgrNotifications); } ServiceTime::~ServiceTime() { - LOG_INFO("[ServiceTime] Cleaning resources"); } sys::ReturnCodes ServiceTime::InitHandler() @@ -67,18 +65,21 @@ namespace stm [this]() { this->bus.sendUnicast(std::make_shared(), service::name::audio); }); alarmMessageHandler = std::make_unique(this, std::move(alarmOperations)); registerMessageHandlers(); + + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } sys::ReturnCodes ServiceTime::DeinitHandler() { settings->deinit(); + + LOG_INFO("Deinitialized"); return sys::ReturnCodes::Success; } sys::ReturnCodes ServiceTime::SwitchPowerModeHandler(const sys::ServicePowerMode mode) { - LOG_FATAL("[ServiceTime] PowerModeHandler: %s", c_str(mode)); return sys::ReturnCodes::Success; } diff --git a/module-sys/Service/Service.cpp b/module-sys/Service/Service.cpp index e60c50645..fec5666cd 100644 --- a/module-sys/Service/Service.cpp +++ b/module-sys/Service/Service.cpp @@ -76,7 +76,7 @@ namespace sys bus.connect(); enableRunLoop = true; if (!Start()) { - LOG_FATAL("FATAL ERROR: Start service failed!:%s", GetName().c_str()); + LOG_FATAL("Start service failed!:%s", GetName().c_str()); configASSERT(0); } } diff --git a/module-sys/SystemManager/PowerManager.cpp b/module-sys/SystemManager/PowerManager.cpp index 9c101482c..fb7b2104d 100644 --- a/module-sys/SystemManager/PowerManager.cpp +++ b/module-sys/SystemManager/PowerManager.cpp @@ -205,7 +205,7 @@ namespace sys const TickType_t periodTickIncrease = tickCount - lastLogStatisticsTimestamp; UpdateCpuFrequencyMonitor(lowPowerControl->GetCurrentFrequencyLevel()); - std::string log{"last period (total): "}; + std::string log{"Last period (total): "}; for (auto &level : cpuFrequencyMonitor) { log.append(level.GetName() + ": " + std::to_string(level.GetPeriodRuntimePercentage(periodTickIncrease)) + "% (" + std::to_string(level.GetTotalRuntimePercentage(tickCount)) + "%) "); diff --git a/module-sys/SystemManager/SystemManagerCommon.cpp b/module-sys/SystemManager/SystemManagerCommon.cpp index f503d5faf..6664cf7fb 100644 --- a/module-sys/SystemManager/SystemManagerCommon.cpp +++ b/module-sys/SystemManager/SystemManagerCommon.cpp @@ -124,8 +124,7 @@ namespace sys case SystemManagerCommon::State::Running: case SystemManagerCommon::State::Suspend: case SystemManagerCommon::State::Shutdown: - LOG_FATAL("State changed after reset/shutdown was requested to: %s! this is terrible failure!", - c_str(state)); + LOG_FATAL("State changed after reset/shutdown was requested to: %s! Terrible failure!", c_str(state)); break; } } @@ -248,7 +247,7 @@ namespace sys bool SystemManagerCommon::Restore(Service *s) { - LOG_DEBUG("trying to enter restore state"); + LOG_DEBUG("Trying to enter restore state"); auto ret = s->bus.sendUnicastSync(std::make_shared(Code::Restore), service::name::system_manager, sys::constants::restoreTimeout); @@ -365,7 +364,7 @@ namespace sys ++service; } else { - LOG_DEBUG("RequestServiceClose %s", (*service)->GetName().c_str()); + LOG_DEBUG("Request service to close: %s", (*service)->GetName().c_str()); if (!RequestServiceClose((*service)->GetName(), this)) { LOG_ERROR("Service %s did not respond -> to kill", (*service)->GetName().c_str()); kill(*service); @@ -458,10 +457,10 @@ namespace sys const auto message = static_cast(msg); if (std::find(servicesToClose.begin(), servicesToClose.end(), message->sender) == servicesToClose.end()) { - LOG_ERROR("%s is not on the list. Further processing skipped.", message->sender.c_str()); + LOG_ERROR("Service '%s' is not on the list. Further processing skipped.", message->sender.c_str()); return; } - LOG_INFO("ready to close %s", message->sender.c_str()); + LOG_INFO("Ready to close %s", message->sender.c_str()); servicesToClose.erase(std::remove(servicesToClose.begin(), servicesToClose.end(), message->sender), servicesToClose.end()); @@ -524,7 +523,7 @@ namespace sys { auto ret = toKill->DeinitHandler(); if (ret != sys::ReturnCodes::Success) { - LOG_DEBUG("deinit handler: %s", c_str(ret)); + LOG_DEBUG("Deinit handler status: %s", c_str(ret)); } toKill->CloseHandler(); } @@ -572,14 +571,14 @@ namespace sys * state. */ connect(sevm::KbdMessage(), [&](Message *) { if (state == State::Shutdown) { - LOG_INFO("Rebooting phone after shutdown with USB connected..."); + LOG_INFO("Rebooting phone after shutdown with USB connected"); set(State::Reboot); } return MessageNone{}; }); connect(sevm::BatteryBrownoutMessage(), [&](Message *) { - LOG_INFO("Battery Brownout voltage level reached! Closing system..."); + LOG_INFO("Battery Brownout voltage level reached! Closing system"); CloseSystemHandler(CloseReason::SystemBrownout); return MessageNone{}; }); @@ -672,7 +671,7 @@ namespace sys void SystemManagerCommon::CloseSystemHandler(CloseReason closeReason) { - LOG_DEBUG("Invoking closing procedure..."); + LOG_DEBUG("Invoking closing procedure"); cpuSentinel->HoldMinimumFrequency(bsp::CpuFrequencyMHz::Level_6); @@ -733,7 +732,7 @@ namespace sys DestroyServices(getWhiteListFor(WhiteListType::Restore)); - LOG_INFO("entered restore state"); + LOG_INFO("Entered restore state"); } void SystemManagerCommon::RebootHandler() diff --git a/module-sys/SystemWatchdog/SystemWatchdog.cpp b/module-sys/SystemWatchdog/SystemWatchdog.cpp index 35d758037..e027f3912 100644 --- a/module-sys/SystemWatchdog/SystemWatchdog.cpp +++ b/module-sys/SystemWatchdog/SystemWatchdog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -66,7 +66,7 @@ namespace sys if (Ticks::GetTicks() - lastRefreshTimestamp >= refreshTimeoutPeriod) { // Allow HW watchdog timeout to occur timeout_occurred = true; - LOG_FATAL("!!! System watchdog timeout, system will be resetted soon !!!"); + LOG_FATAL("System watchdog timeout, system will be reset soon!"); } else { bsp::watchdog::refresh(); diff --git a/module-utils/log/Logger.cpp b/module-utils/log/Logger.cpp index a63727523..d135b5184 100644 --- a/module-utils/log/Logger.cpp +++ b/module-utils/log/Logger.cpp @@ -316,15 +316,15 @@ namespace Log bufferSizeLeft = lineBufferSizeLeft(); bytesParsed = snprintf(&lineBuffer[lineBufferCurrentPos], bufferSizeLeft, - "%s%-5s %s[%s] %s%s:%s:%d:%s ", + "%s%-5s %s[%s] %s%s:%d:%s:%s ", logColors->levelColors[level].data(), levelNames[level], logColors->serviceNameColor.data(), getTaskDesc(), logColors->callerInfoColor.data(), file, - function, line, + function, logColors->resetColor.data()); if (bytesParsed >= 0) { lineBufferCurrentPos += std::min(bufferSizeLeft, static_cast(bytesParsed)); diff --git a/module-utils/time/time/time_conversion.cpp b/module-utils/time/time/time_conversion.cpp index 7d54eb661..71e620773 100644 --- a/module-utils/time/time/time_conversion.cpp +++ b/module-utils/time/time/time_conversion.cpp @@ -327,7 +327,7 @@ namespace utils::time seconds = (this->duration % secondsInHour) % secondsInMinute; if (verboseConversion) { - LOG_DEBUG("duration %" PRIu64 " - %lu hours %lu minutes %lu seconds", + LOG_DEBUG("Duration %" PRIu64 " - %lu hours %lu minutes %lu seconds", static_cast(duration), hours, minutes, diff --git a/module-utils/time/time/time_date_validation.cpp b/module-utils/time/time/time_date_validation.cpp index b4f1f8951..1f3c2f69d 100644 --- a/module-utils/time/time/time_date_validation.cpp +++ b/module-utils/time/time/time_date_validation.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md /* @@ -67,7 +67,7 @@ namespace utils m = std::stoi(minute); } catch (std::exception &e) { - LOG_INFO("validateTime exception"); + LOG_ERROR("Time validate exception"); return false; } return validateTime(h, m, mode12h); diff --git a/module-utils/unicode/utf8/utf8/UTF8.cpp b/module-utils/unicode/utf8/utf8/UTF8.cpp index eb27caabb..61c2bf1e5 100644 --- a/module-utils/unicode/utf8/utf8/UTF8.cpp +++ b/module-utils/unicode/utf8/utf8/UTF8.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -412,7 +412,7 @@ uint32_t UTF8::find(const char *s, uint32_t pos) const getStreamLength(s, stringSize, stringCount); if ((stringCount == 0) && (s[0] != 0)) { - LOG_ERROR("corrupted string"); + LOG_ERROR("Corrupted string"); return npos; } @@ -445,7 +445,7 @@ uint32_t UTF8::findLast(const char *s, uint32_t pos) const getStreamLength(s, stringSize, stringCount); // check input substring if ((stringCount == 0) && (s[0] != 0)) { - LOG_ERROR("corrupted string"); + LOG_ERROR("Corrupted string"); return npos; } // check if pos is in range of source string @@ -639,14 +639,14 @@ bool UTF8::insert(const char *ch, const uint32_t &index) *(ch + 3)); if (ch_len == 0) { - LOG_FATAL("not UTF8 character insert failed"); + LOG_FATAL("Not UTF8 character insert failed"); return false; } // if there is not enough space in string buffer try to expand it by default expansion size. if (ch_len + sizeUsed >= sizeAllocated) { if (expand() == false) { - LOG_FATAL("expand"); + LOG_FATAL("Expand string buffer failed"); return false; } } @@ -740,7 +740,7 @@ uint32_t UTF8::decode(const char *utf8_char, uint32_t &length) len = 2; } else { - LOG_ERROR("wrong utf8 char"); + LOG_ERROR("Wrong utf8 char"); return ret; } } @@ -756,7 +756,7 @@ uint32_t UTF8::decode(const char *utf8_char, uint32_t &length) len = 3; } else { - LOG_ERROR("wrong utf8 char"); + LOG_ERROR("Wrong utf8 char"); return ret; } } @@ -775,7 +775,7 @@ uint32_t UTF8::decode(const char *utf8_char, uint32_t &length) len = 4; } else { - LOG_ERROR("wrong utf8 char"); + LOG_ERROR("Wrong utf8 char"); return ret; } } diff --git a/module-utils/utility/Utils.hpp b/module-utils/utility/Utils.hpp index 50d1397ff..62719ea59 100644 --- a/module-utils/utility/Utils.hpp +++ b/module-utils/utility/Utils.hpp @@ -248,7 +248,7 @@ namespace utils value = std::stoi(text); } catch (const std::exception &e) { - LOG_ERROR("toNumeric exception %s", e.what()); + LOG_ERROR("To numeric exception %s", e.what()); return false; } return true; @@ -260,7 +260,7 @@ namespace utils return std::stoi(text); } catch (const std::exception &e) { - LOG_ERROR("toNumeric exception %s", e.what()); + LOG_ERROR("To numeric exception %s", e.what()); return 0; } } diff --git a/module-vfs/drivers/src/thirdparty/fatfs/ff_glue.cpp b/module-vfs/drivers/src/thirdparty/fatfs/ff_glue.cpp index abae46625..d35590888 100644 --- a/module-vfs/drivers/src/thirdparty/fatfs/ff_glue.cpp +++ b/module-vfs/drivers/src/thirdparty/fatfs/ff_glue.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md // ffFAT glue layer code @@ -119,7 +119,7 @@ namespace purefs::fs::drivers::ffat::internal } const auto res = diskmm->read(diskh, buff, sector, count); if (res < 0) { - LOG_ERROR("write error %i", res); + LOG_ERROR("Read error %i", res); return (res == -ERANGE) ? (RES_PARERR) : (RES_ERROR); } else { @@ -139,7 +139,7 @@ namespace purefs::fs::drivers::ffat::internal } const auto res = diskmm->write(diskh, buff, sector, count); if (res < 0) { - LOG_ERROR("write error %i", res); + LOG_ERROR("Write error %i", res); return (res == -ERANGE) ? (RES_PARERR) : (RES_ERROR); } else { diff --git a/module-vfs/src/purefs/blkdev/disk_handle.cpp b/module-vfs/src/purefs/blkdev/disk_handle.cpp index 8800f3a55..61e7201e6 100644 --- a/module-vfs/src/purefs/blkdev/disk_handle.cpp +++ b/module-vfs/src/purefs/blkdev/disk_handle.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include #include @@ -20,7 +20,7 @@ namespace purefs::blkdev::internal } } else { - LOG_ERROR("Unable to get sector count."); + LOG_FATAL("Disk handle pointer expired."); } } return m_sectors; diff --git a/module-vfs/src/purefs/blkdev/partition_parser.cpp b/module-vfs/src/purefs/blkdev/partition_parser.cpp index 2973ed58c..64b15e729 100644 --- a/module-vfs/src/purefs/blkdev/partition_parser.cpp +++ b/module-vfs/src/purefs/blkdev/partition_parser.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -153,7 +153,7 @@ namespace purefs::blkdev::internal int error{}; while (try_count--) { if (sector_in_buf != current_sector) { - LOG_INFO("extended parse: Read sector %u\n", unsigned(current_sector)); + LOG_INFO("Read sector %u\n", unsigned(current_sector)); error = m_disk->read(sect_buf.data(), current_sector, 1, 0); if (error < 0) break; @@ -163,7 +163,7 @@ namespace purefs::blkdev::internal const auto b1 = sect_buf[defs::mbr_signature_offs]; const auto b2 = sect_buf[defs::mbr_signature_offs + 1]; if (b1 != 0x55 || b2 != 0xAA) { - LOG_ERROR("extended_parse: No signature %02x,%02x", b1, b2); + LOG_ERROR("No signature %02x,%02x", b1, b2); break; } } diff --git a/products/BellHybrid/BellHybridMain.cpp b/products/BellHybrid/BellHybridMain.cpp index 86ac058d8..a52071de2 100644 --- a/products/BellHybrid/BellHybridMain.cpp +++ b/products/BellHybrid/BellHybridMain.cpp @@ -99,7 +99,7 @@ int main() platform->init(); } catch (const std::runtime_error &e) { - LOG_FATAL("%s", e.what()); + LOG_FATAL("Exception during platform initialization: %s", e.what()); abort(); } @@ -135,7 +135,7 @@ int main() platform->deinit(); } catch (const std::runtime_error &e) { - LOG_FATAL("%s", e.what()); + LOG_FATAL("Exception during platform deinit: %s", e.what()); abort(); } sys::SystemWatchdog::getInstance().deinit(); diff --git a/products/BellHybrid/apps/Application.cpp b/products/BellHybrid/apps/Application.cpp index dad6478b9..98067ae39 100644 --- a/products/BellHybrid/apps/Application.cpp +++ b/products/BellHybrid/apps/Application.cpp @@ -32,7 +32,7 @@ namespace app (isCurrentWindow(gui::popup::resolveWindowName(gui::popup::ID::PowerOff))) || (isCurrentWindow(gui::BellTurnOffWindow::name))); if (val == true) { - LOG_ERROR("block popup - as curent window is in higher order popup"); + LOG_ERROR("Block popup - as curent window is in higher order popup"); } return val ? gui::popup::FilterType::Ignore : gui::popup::FilterType::Show; }); diff --git a/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp b/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp index 524cf7c37..79e1378e2 100644 --- a/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp +++ b/products/BellHybrid/apps/application-bell-main/presenters/HomeScreenPresenter.cpp @@ -254,7 +254,7 @@ namespace app::home_screen { const auto greetingCollection = utils::translate_array("app_bell_greeting_msg"); if (greetingCollection.empty()) { - LOG_WARN("app_bell_greeting_msg array does not exist, using default string"); + LOG_WARN("Array 'app_bell_greeting_msg' does not exist, using default string"); return "app_bell_greeting_msg"; } diff --git a/products/BellHybrid/apps/application-bell-main/windows/BellMainSetHour.cpp b/products/BellHybrid/apps/application-bell-main/windows/BellMainSetHour.cpp index d0d52254c..19cd76daf 100644 --- a/products/BellHybrid/apps/application-bell-main/windows/BellMainSetHour.cpp +++ b/products/BellHybrid/apps/application-bell-main/windows/BellMainSetHour.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "BellMainSetHour.hpp" @@ -69,7 +69,6 @@ namespace gui bool BellMainSetHour::onInput(const InputEvent &inputEvent) { - LOG_INFO("Bell Main Window Input"); if (inputEvent.isShortRelease()) { switch (inputEvent.getKeyCode()) { case KeyCode::KEY_RF: diff --git a/products/BellHybrid/apps/common/src/AudioModel.cpp b/products/BellHybrid/apps/common/src/AudioModel.cpp index 25d40824a..dded89582 100644 --- a/products/BellHybrid/apps/common/src/AudioModel.cpp +++ b/products/BellHybrid/apps/common/src/AudioModel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "models/AudioModel.hpp" @@ -44,7 +44,7 @@ namespace if (auto resp = std::dynamic_pointer_cast(ret.second)) { return resp; } - LOG_ERROR("msgType %d - not AudioResponseMessage", msgType); + LOG_ERROR("Message type [%d] - not AudioResponseMessage", msgType); return std::make_shared(audio::RetCode::Failed); } LOG_ERROR("Command %d Failed with %d error", msgType, static_cast(ret.first)); diff --git a/products/BellHybrid/services/audio/ServiceAudio.cpp b/products/BellHybrid/services/audio/ServiceAudio.cpp index 175d1288b..6c7412e7f 100644 --- a/products/BellHybrid/services/audio/ServiceAudio.cpp +++ b/products/BellHybrid/services/audio/ServiceAudio.cpp @@ -64,7 +64,6 @@ namespace service cpuSentinel(std::make_shared(audioServiceName, this)), settingsProvider(std::make_unique()) { - LOG_INFO("[%s] Initializing", audioServiceName); bus.channels.push_back(sys::BusChannel::ServiceAudioNotifications); auto sentinelRegistrationMsg = std::make_shared(cpuSentinel); @@ -103,7 +102,6 @@ namespace service } Audio::~Audio() { - LOG_INFO("[%s] Cleaning resources", audioServiceName); } sys::MessagePointer Audio::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) { @@ -113,11 +111,12 @@ namespace service { settingsProvider->init(service::ServiceProxy(weak_from_this())); initializeDatabase(); - + LOG_INFO("Initialized"); return sys::ReturnCodes::Success; } sys::ReturnCodes Audio::DeinitHandler() { + LOG_INFO("Deinitialized"); return sys::ReturnCodes::Success; } void Audio::ProcessCloseReason([[maybe_unused]] sys::CloseReason closeReason) diff --git a/products/BellHybrid/services/desktop/endpoints/EndpointFactoryBell.cpp b/products/BellHybrid/services/desktop/endpoints/EndpointFactoryBell.cpp index 4cf4ced09..0c6b66925 100644 --- a/products/BellHybrid/services/desktop/endpoints/EndpointFactoryBell.cpp +++ b/products/BellHybrid/services/desktop/endpoints/EndpointFactoryBell.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "EndpointFactoryBell.hpp" @@ -20,7 +20,6 @@ namespace sdesktop::endpoints std::unique_ptr EndpointFactoryBell::create(Context &context, sys::Service *ownerServicePtr) { - LOG_DEBUG("Creating endpoint: %s", magic_enum::enum_name(context.getEndpoint()).data()); switch (context.getEndpoint()) { case EndpointType::update: return std::make_unique(ownerServicePtr); diff --git a/products/BellHybrid/services/time/AlarmOperations.cpp b/products/BellHybrid/services/time/AlarmOperations.cpp index 96ef5f36f..a4ff216df 100644 --- a/products/BellHybrid/services/time/AlarmOperations.cpp +++ b/products/BellHybrid/services/time/AlarmOperations.cpp @@ -69,7 +69,7 @@ namespace alarms std::stoi(settings.getValue(bell::settings::Bedtime::active, settings::SettingsScope::Global)); } catch (const std::exception &e) { - LOG_ERROR("BedtimeSettingsProviderImpl active db record not valid! err: %s", e.what()); + LOG_ERROR("Active db record not valid! err: %s", e.what()); } return enabled; } diff --git a/products/PurePhone/PurePhoneMain.cpp b/products/PurePhone/PurePhoneMain.cpp index 5b17c9928..2d0d4350e 100644 --- a/products/PurePhone/PurePhoneMain.cpp +++ b/products/PurePhone/PurePhoneMain.cpp @@ -192,7 +192,7 @@ int main() platform->init(); } catch (const std::runtime_error &e) { - LOG_FATAL("%s", e.what()); + LOG_FATAL("Exception during platform init: %s", e.what()); abort(); } @@ -272,7 +272,7 @@ int main() platform->deinit(); } catch (const std::runtime_error &e) { - LOG_FATAL("%s", e.what()); + LOG_FATAL("Exception during platform deinit: %s", e.what()); abort(); } sys::SystemWatchdog::getInstance().deinit(); @@ -280,7 +280,7 @@ int main() }); LOG_INFO("Launching %s ", ApplicationName); - LOG_INFO("commit: %s version: %s branch: %s", GIT_REV, VERSION, GIT_BRANCH); + LOG_INFO("Commit: %s version: %s branch: %s", GIT_REV, VERSION, GIT_BRANCH); cpp_freertos::Thread::StartScheduler(); LOG_INFO("Scheduler is terminated properly"); diff --git a/products/PurePhone/alarms/src/actions/PlayAudioActions.cpp b/products/PurePhone/alarms/src/actions/PlayAudioActions.cpp index d50c96c16..f76d50ad5 100644 --- a/products/PurePhone/alarms/src/actions/PlayAudioActions.cpp +++ b/products/PurePhone/alarms/src/actions/PlayAudioActions.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "PlayAudioActions.hpp" @@ -57,7 +57,7 @@ namespace alarms bool PlayToneAction::execute(const AlarmEventRecord &record) { const auto tonePath = std::filesystem::path{record.musicTone}; - LOG_DEBUG("play some music: %s", record.musicTone.c_str()); + LOG_DEBUG("Play some music: %s", record.musicTone.c_str()); return play(tonePath); } } // namespace alarms diff --git a/products/PurePhone/services/appmgr/ApplicationManager.cpp b/products/PurePhone/services/appmgr/ApplicationManager.cpp index 9b22d11bd..91cd73d32 100644 --- a/products/PurePhone/services/appmgr/ApplicationManager.cpp +++ b/products/PurePhone/services/appmgr/ApplicationManager.cpp @@ -578,7 +578,7 @@ namespace app::manager { if (not ApplicationManagerCommon::startApplication(app)) { if (ApplicationManagerCommon::isApplicationStarting(app)) { - LOG_INFO("%s is starting already...", app.name().c_str()); + LOG_INFO("%s is starting already", app.name().c_str()); return false; } diff --git a/products/PurePhone/services/db/ServiceDB.cpp b/products/PurePhone/services/db/ServiceDB.cpp index 32ba5a292..dbbd953cb 100644 --- a/products/PurePhone/services/db/ServiceDB.cpp +++ b/products/PurePhone/services/db/ServiceDB.cpp @@ -37,7 +37,7 @@ ServiceDB::~ServiceDB() multimediaFilesDB.reset(); Database::deinitialize(); - LOG_INFO("[ServiceDB] Cleaning resources"); + LOG_INFO("Cleaning resources"); } db::Interface *ServiceDB::getInterface(db::Interface::Name interface) diff --git a/products/PurePhone/services/desktop/endpoints/EndpointFactoryPure.cpp b/products/PurePhone/services/desktop/endpoints/EndpointFactoryPure.cpp index fe64ceaf2..f98d28b78 100644 --- a/products/PurePhone/services/desktop/endpoints/EndpointFactoryPure.cpp +++ b/products/PurePhone/services/desktop/endpoints/EndpointFactoryPure.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "EndpointFactoryPure.hpp" @@ -23,7 +23,6 @@ namespace sdesktop::endpoints std::unique_ptr EndpointFactoryPure::constructEndpoint(Context &context, sys::Service *ownerServicePtr) { - LOG_DEBUG("Creating endpoint: %d", static_cast(context.getEndpoint())); switch (context.getEndpoint()) { case EndpointType::update: return std::make_unique(ownerServicePtr); diff --git a/products/PurePhone/services/desktop/endpoints/contacts/ContactHelper.cpp b/products/PurePhone/services/desktop/endpoints/contacts/ContactHelper.cpp index 09abde240..00120a9e1 100644 --- a/products/PurePhone/services/desktop/endpoints/contacts/ContactHelper.cpp +++ b/products/PurePhone/services/desktop/endpoints/contacts/ContactHelper.cpp @@ -126,7 +126,7 @@ namespace sdesktop::endpoints DBServiceAPI::GetQuery(ownerServicePtr, db::Interface::Name::Contact, std::move(query)); } catch (const std::exception &e) { - LOG_ERROR("exception while requesting data from DB"); + LOG_ERROR("Exception while requesting data from DB"); return sys::ReturnCodes::Failure; } diff --git a/products/PurePhone/services/desktop/endpoints/messages/MessageHelper.cpp b/products/PurePhone/services/desktop/endpoints/messages/MessageHelper.cpp index 753556669..fcbdfe3a1 100644 --- a/products/PurePhone/services/desktop/endpoints/messages/MessageHelper.cpp +++ b/products/PurePhone/services/desktop/endpoints/messages/MessageHelper.cpp @@ -555,7 +555,7 @@ namespace sdesktop::endpoints DBServiceAPI::GetQuery(ownerServicePtr, db::Interface::Name::SMSThread, std::move(query)); } catch (const std::bad_cast &e) { - LOG_ERROR("exception while requesting thread"); + LOG_ERROR("Exception while requesting thread"); return sys::ReturnCodes::Failure; } return sys::ReturnCodes::Success; @@ -642,7 +642,7 @@ namespace sdesktop::endpoints DBServiceAPI::GetQuery(ownerServicePtr, db::Interface::Name::SMS, std::move(query)); } catch (const std::bad_cast &e) { - LOG_ERROR("exception while getting message by thread ID"); + LOG_ERROR("Exception while getting message by thread ID"); return sys::ReturnCodes::Failure; } return sys::ReturnCodes::Success; @@ -721,7 +721,7 @@ namespace sdesktop::endpoints DBServiceAPI::GetQuery(ownerServicePtr, db::Interface::Name::SMS, std::move(query)); } catch (const std::bad_cast &e) { - LOG_ERROR("exception while getting message"); + LOG_ERROR("Exception while getting message"); return sys::ReturnCodes::Failure; } return sys::ReturnCodes::Success; @@ -809,7 +809,7 @@ namespace sdesktop::endpoints DBServiceAPI::GetQuery(ownerServicePtr, db::Interface::Name::SMSTemplate, std::move(query)); } catch (const std::bad_cast &e) { - LOG_ERROR("exception while getting messages template"); + LOG_ERROR("Exception while getting messages template"); return sys::ReturnCodes::Failure; } return sys::ReturnCodes::Success; diff --git a/products/PurePhone/services/evtmgr/WorkerEvent.cpp b/products/PurePhone/services/evtmgr/WorkerEvent.cpp index 45d99880c..766e37e03 100644 --- a/products/PurePhone/services/evtmgr/WorkerEvent.cpp +++ b/products/PurePhone/services/evtmgr/WorkerEvent.cpp @@ -144,7 +144,7 @@ void WorkerEvent::requestSliderPositionRead() void WorkerEvent::handleMagnetometerEvent() { if (const auto &key = bsp::magnetometer::WorkerEventHandler(); key.has_value()) { - LOG_DEBUG("magneto IRQ handler: %s", c_str(*key)); + LOG_DEBUG("Magnetometer IRQ handler: %s", c_str(*key)); processKeyEvent(bsp::KeyEvents::Moved, *key); } }