Skip to content

Commit 1595004

Browse files
andy31415andreilitvinrestyled-commits
authored andcommitted
Replace usages of emberPrintln with ChipLogProgress calls (#27035)
* Replace debug print calls via: ``` rg emberAfPrintln src examples --files-with-matches | xargs sd 'emberAfPrintln\(EMBER_AF_PRINT_DEBUG, ("[^)]*\);)' 'ChipLogDetail($1' ``` * Replace one more missing bit * Remove all references of debug-printing or ember-print * Add Zcl as a log source for various files * remove one more unused file * Replace detail log with zcl * Replace emberAfDoorLockClusterPrintln * Replace all the other printlns * Ran clang-format * Remove usage of emberAfAttributesFlush as it was defined as empty before * Port emberAfPrintBuffer into attribute-table * Fix typo in replacement of logs * Restyled by whitespace * Restyled by clang-format * Update the print calls to log as well, not just println * clang-format * Restyled by clang-format * zap regen * emberAfprintAttributeTable was never used. Removing * Removed one more unused method --------- Co-authored-by: Andrei Litvin <[email protected]> Co-authored-by: Restyled.io <[email protected]>
1 parent 08bb188 commit 1595004

File tree

24 files changed

+560
-3240
lines changed

24 files changed

+560
-3240
lines changed

examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Status StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointI
7373
return Status::Success;
7474
}
7575
}
76-
emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %u", mode);
76+
ChipLogProgress(Zcl, "Cannot find the mode %u", mode);
7777
return Status::InvalidCommand;
7878
}
7979

examples/lock-app/linux/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
8787
// TODO: Watch for LockState, DoorState, Mode, etc changes and trigger appropriate action
8888
if (attributePath.mClusterId == Clusters::DoorLock::Id)
8989
{
90-
emberAfDoorLockClusterPrintln("Door Lock attribute changed");
90+
ChipLogProgress(Zcl, "Door Lock attribute changed");
9191
}
9292
}

examples/placeholder/linux/static-supported-modes-manager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Status StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointI
7373
return Status::Success;
7474
}
7575
}
76-
emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %u", mode);
76+
ChipLogProgress(Zcl, "Cannot find the mode %u", mode);
7777
return Status::InvalidCommand;
7878
}
7979

examples/platform/esp32/mode-support/static-supported-modes-manager.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
*/
1818

1919
#include "static-supported-modes-manager.h"
20-
#include <app/util/debug-printing.h>
21-
#include <app/util/ember-print.h>
2220
#include <platform/ESP32/ESP32Config.h>
2321

2422
using namespace chip;
@@ -176,7 +174,7 @@ Status StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointI
176174
return Status::Success;
177175
}
178176
}
179-
emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %u", mode);
177+
ChipLogProgress(Zcl, "Cannot find the mode %u", mode);
180178
return Status::InvalidCommand;
181179
}
182180

examples/window-app/common/src/WindowApp.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void WindowApp::DispatchEventAttributeChange(chip::EndpointId endpoint, chip::At
295295

296296
if (nullptr == cover)
297297
{
298-
emberAfWindowCoveringClusterPrint("Ep[%u] not supported AttributeId=%u\n", endpoint, (unsigned int) attribute);
298+
ChipLogProgress(Zcl, "Ep[%u] not supported AttributeId=%u\n", endpoint, (unsigned int) attribute);
299299
return;
300300
}
301301

@@ -675,7 +675,7 @@ void WindowApp::Cover::OnTiltTimeout(WindowApp::Timer & timer)
675675
void WindowApp::Cover::SchedulePositionSet(chip::Percent100ths position, bool isTilt)
676676
{
677677
CoverWorkData * data = chip::Platform::New<CoverWorkData>();
678-
VerifyOrReturn(data != nullptr, emberAfWindowCoveringClusterPrint("Cover::SchedulePositionSet - Out of Memory for WorkData"));
678+
VerifyOrReturn(data != nullptr, ChipLogProgress(Zcl, "Cover::SchedulePositionSet - Out of Memory for WorkData"));
679679

680680
data->mEndpointId = mEndpoint;
681681
data->percent100ths = position;
@@ -701,7 +701,7 @@ void WindowApp::Cover::CallbackPositionSet(intptr_t arg)
701701
void WindowApp::Cover::ScheduleOperationalStateSet(OperationalState opState, bool isTilt)
702702
{
703703
CoverWorkData * data = chip::Platform::New<CoverWorkData>();
704-
VerifyOrReturn(data != nullptr, emberAfWindowCoveringClusterPrint("Cover::OperationalStatusSet - Out of Memory for WorkData"));
704+
VerifyOrReturn(data != nullptr, ChipLogProgress(Zcl, "Cover::OperationalStatusSet - Out of Memory for WorkData"));
705705

706706
data->mEndpointId = mEndpoint;
707707
data->opState = opState;

src/app/chip_data_model.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ function(chip_configure_data_model APP_TARGET)
138138
# ${CHIP_APP_BASE_DIR}/util/ClientMonitoringRegistrationTable.cpp
139139
${CHIP_APP_BASE_DIR}/util/DataModelHandler.cpp
140140
${CHIP_APP_BASE_DIR}/util/ember-compatibility-functions.cpp
141-
${CHIP_APP_BASE_DIR}/util/ember-print.cpp
142141
${CHIP_APP_BASE_DIR}/util/error-mapping.cpp
143142
${CHIP_APP_BASE_DIR}/util/generic-callback-stubs.cpp
144143
${CHIP_APP_BASE_DIR}/util/message.cpp

src/app/chip_data_model.gni

-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ template("chip_data_model") {
173173
"${_app_root}/util/binding-table.cpp",
174174
"${_app_root}/util/binding-table.h",
175175
"${_app_root}/util/ember-compatibility-functions.cpp",
176-
"${_app_root}/util/ember-print.cpp",
177176
"${_app_root}/util/error-mapping.cpp",
178177
"${_app_root}/util/generic-callback-stubs.cpp",
179178
"${_app_root}/util/message.cpp",

src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,6 @@ bool emberAfAdministratorCommissioningClusterRevokeCommissioningCallback(
207207

208208
void MatterAdministratorCommissioningPluginServerInitCallback()
209209
{
210-
emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Initiating Admin Commissioning cluster.");
210+
ChipLogProgress(Zcl, "Initiating Admin Commissioning cluster.");
211211
registerAttributeAccessOverride(&gAdminCommissioningAttrAccess);
212212
}

src/app/clusters/barrier-control-server/barrier-control-server.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static void sendDefaultResponse(app::CommandHandler * commandObj, const app::Con
288288
{
289289
if (commandObj->AddStatus(commandPath, status) != CHIP_NO_ERROR)
290290
{
291-
emberAfBarrierControlClusterPrintln("Failed to send default response");
291+
ChipLogProgress(Zcl, "Failed to send default response");
292292
}
293293
}
294294

@@ -301,7 +301,7 @@ bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(
301301
EndpointId endpoint = commandPath.mEndpointId;
302302
Status status = Status::Success;
303303

304-
emberAfBarrierControlClusterPrintln("RX: GoToPercentCallback p=%d", percentOpen);
304+
ChipLogProgress(Zcl, "RX: GoToPercentCallback p=%d", percentOpen);
305305

306306
if (isRemoteLockoutOn(endpoint))
307307
{
@@ -319,8 +319,8 @@ bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(
319319
state.currentPosition = getCurrentPosition(endpoint);
320320
state.targetPosition = percentOpen;
321321
state.delayMs = calculateDelayMs(endpoint, state.targetPosition, &state.increasing);
322-
emberAfBarrierControlClusterPrintln("Scheduling barrier move from %d to %d with %" PRIu32 "ms delay", state.currentPosition,
323-
state.targetPosition, state.delayMs);
322+
ChipLogProgress(Zcl, "Scheduling barrier move from %d to %d with %" PRIu32 "ms delay", state.currentPosition,
323+
state.targetPosition, state.delayMs);
324324
scheduleTimerCallbackMs(endpoint, state.delayMs);
325325

326326
if (state.currentPosition < state.targetPosition)
@@ -353,6 +353,6 @@ void MatterBarrierControlPluginServerInitCallback() {}
353353

354354
void MatterBarrierControlClusterServerShutdownCallback(EndpointId endpoint)
355355
{
356-
emberAfBarrierControlClusterPrintln("Shuting barrier control server cluster on endpoint %d", endpoint);
356+
ChipLogProgress(Zcl, "Shuting barrier control server cluster on endpoint %d", endpoint);
357357
cancelEndpointTimerCallback(endpoint);
358358
}

src/app/clusters/color-control-server/color-control-server.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -1649,23 +1649,23 @@ void ColorControlServer::updateHueSatCommand(EndpointId endpoint)
16491649
Attributes::EnhancedCurrentHue::Set(endpoint, colorHueTransitionState->currentEnhancedHue);
16501650
Attributes::CurrentHue::Set(endpoint, static_cast<uint8_t>(colorHueTransitionState->currentEnhancedHue >> 8));
16511651

1652-
emberAfColorControlClusterPrintln("Enhanced Hue %d endpoint %d", colorHueTransitionState->currentEnhancedHue, endpoint);
1652+
ChipLogProgress(Zcl, "Enhanced Hue %d endpoint %d", colorHueTransitionState->currentEnhancedHue, endpoint);
16531653
}
16541654
}
16551655
else
16561656
{
16571657
if (previousHue != colorHueTransitionState->currentHue)
16581658
{
16591659
Attributes::CurrentHue::Set(colorHueTransitionState->endpoint, colorHueTransitionState->currentHue);
1660-
emberAfColorControlClusterPrintln("Hue %d endpoint %d", colorHueTransitionState->currentHue, endpoint);
1660+
ChipLogProgress(Zcl, "Hue %d endpoint %d", colorHueTransitionState->currentHue, endpoint);
16611661
}
16621662
}
16631663

16641664
if (previousSaturation != colorSaturationTransitionState->currentValue)
16651665
{
16661666
Attributes::CurrentSaturation::Set(colorSaturationTransitionState->endpoint,
16671667
(uint8_t) colorSaturationTransitionState->currentValue);
1668-
emberAfColorControlClusterPrintln("Saturation %d endpoint %d", colorSaturationTransitionState->currentValue, endpoint);
1668+
ChipLogProgress(Zcl, "Saturation %d endpoint %d", colorSaturationTransitionState->currentValue, endpoint);
16691669
}
16701670

16711671
computePwmFromHsv(endpoint);
@@ -2014,8 +2014,7 @@ void ColorControlServer::updateXYCommand(EndpointId endpoint)
20142014
Attributes::CurrentX::Set(endpoint, colorXTransitionState->currentValue);
20152015
Attributes::CurrentY::Set(endpoint, colorYTransitionState->currentValue);
20162016

2017-
emberAfColorControlClusterPrintln("Color X %d Color Y %d", colorXTransitionState->currentValue,
2018-
colorYTransitionState->currentValue);
2017+
ChipLogProgress(Zcl, "Color X %d Color Y %d", colorXTransitionState->currentValue, colorYTransitionState->currentValue);
20192018

20202019
computePwmFromXy(endpoint);
20212020
}
@@ -2215,7 +2214,7 @@ void ColorControlServer::updateTempCommand(EndpointId endpoint)
22152214

22162215
Attributes::ColorTemperatureMireds::Set(endpoint, colorTempTransitionState->currentValue);
22172216

2218-
emberAfColorControlClusterPrintln("Color Temperature %d", colorTempTransitionState->currentValue);
2217+
ChipLogProgress(Zcl, "Color Temperature %d", colorTempTransitionState->currentValue);
22192218

22202219
computePwmFromTemp(endpoint);
22212220
}
@@ -2705,7 +2704,7 @@ void emberAfColorControlClusterServerInitCallback(EndpointId endpoint)
27052704

27062705
void MatterColorControlClusterServerShutdownCallback(EndpointId endpoint)
27072706
{
2708-
emberAfColorControlClusterPrintln("Shuting down color control server cluster on endpoint %d", endpoint);
2707+
ChipLogProgress(Zcl, "Shuting down color control server cluster on endpoint %d", endpoint);
27092708
ColorControlServer::Instance().cancelEndpointTimerCallback(endpoint);
27102709
}
27112710

0 commit comments

Comments
 (0)