remove newline from logging statements. (#5022)

remove newline from logging statements in code. The LOG_* functions will now magically add it at the end.

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Thomas Göttgens
2024-10-14 06:11:43 +02:00
committed by GitHub
parent fb9f361052
commit 05e4a639a1
150 changed files with 1816 additions and 1800 deletions

View File

@@ -37,13 +37,13 @@ int32_t BME680Sensor::runOnce()
checkStatus("updateSubscription");
status = 0;
}
LOG_INFO("Init sensor: %s with the BSEC Library version %d.%d.%d.%d \n", sensorName, bme680.version.major,
LOG_INFO("Init sensor: %s with the BSEC Library version %d.%d.%d.%d ", sensorName, bme680.version.major,
bme680.version.minor, bme680.version.major_bugfix, bme680.version.minor_bugfix);
} else {
status = 0;
}
if (status == 0)
LOG_DEBUG("BME680Sensor::runOnce: bme680.status %d\n", bme680.status);
LOG_DEBUG("BME680Sensor::runOnce: bme680.status %d", bme680.status);
return initI2CSensor();
}
@@ -80,12 +80,12 @@ void BME680Sensor::loadState()
file.read((uint8_t *)&bsecState, BSEC_MAX_STATE_BLOB_SIZE);
file.close();
bme680.setState(bsecState);
LOG_INFO("%s state read from %s.\n", sensorName, bsecConfigFileName);
LOG_INFO("%s state read from %s.", sensorName, bsecConfigFileName);
} else {
LOG_INFO("No %s state found (File: %s).\n", sensorName, bsecConfigFileName);
LOG_INFO("No %s state found (File: %s).", sensorName, bsecConfigFileName);
}
#else
LOG_ERROR("ERROR: Filesystem not implemented\n");
LOG_ERROR("ERROR: Filesystem not implemented");
#endif
}
@@ -97,16 +97,16 @@ void BME680Sensor::updateState()
/* First state update when IAQ accuracy is >= 3 */
accuracy = bme680.getData(BSEC_OUTPUT_IAQ).accuracy;
if (accuracy >= 2) {
LOG_DEBUG("%s state update IAQ accuracy %u >= 2\n", sensorName, accuracy);
LOG_DEBUG("%s state update IAQ accuracy %u >= 2", sensorName, accuracy);
update = true;
stateUpdateCounter++;
} else {
LOG_DEBUG("%s not updated, IAQ accuracy is %u < 2\n", sensorName, accuracy);
LOG_DEBUG("%s not updated, IAQ accuracy is %u < 2", sensorName, accuracy);
}
} else {
/* Update every STATE_SAVE_PERIOD minutes */
if ((stateUpdateCounter * STATE_SAVE_PERIOD) < millis()) {
LOG_DEBUG("%s state update every %d minutes\n", sensorName, STATE_SAVE_PERIOD / 60000);
LOG_DEBUG("%s state update every %d minutes", sensorName, STATE_SAVE_PERIOD / 60000);
update = true;
stateUpdateCounter++;
}
@@ -115,34 +115,34 @@ void BME680Sensor::updateState()
if (update) {
bme680.getState(bsecState);
if (FSCom.exists(bsecConfigFileName) && !FSCom.remove(bsecConfigFileName)) {
LOG_WARN("Can't remove old state file\n");
LOG_WARN("Can't remove old state file");
}
auto file = FSCom.open(bsecConfigFileName, FILE_O_WRITE);
if (file) {
LOG_INFO("%s state write to %s.\n", sensorName, bsecConfigFileName);
LOG_INFO("%s state write to %s.", sensorName, bsecConfigFileName);
file.write((uint8_t *)&bsecState, BSEC_MAX_STATE_BLOB_SIZE);
file.flush();
file.close();
} else {
LOG_INFO("Can't write %s state (File: %s).\n", sensorName, bsecConfigFileName);
LOG_INFO("Can't write %s state (File: %s).", sensorName, bsecConfigFileName);
}
}
#else
LOG_ERROR("ERROR: Filesystem not implemented\n");
LOG_ERROR("ERROR: Filesystem not implemented");
#endif
}
void BME680Sensor::checkStatus(String functionName)
{
if (bme680.status < BSEC_OK)
LOG_ERROR("%s BSEC2 code: %s\n", functionName.c_str(), String(bme680.status).c_str());
LOG_ERROR("%s BSEC2 code: %s", functionName.c_str(), String(bme680.status).c_str());
else if (bme680.status > BSEC_OK)
LOG_WARN("%s BSEC2 code: %s\n", functionName.c_str(), String(bme680.status).c_str());
LOG_WARN("%s BSEC2 code: %s", functionName.c_str(), String(bme680.status).c_str());
if (bme680.sensor.status < BME68X_OK)
LOG_ERROR("%s BME68X code: %s\n", functionName.c_str(), String(bme680.sensor.status).c_str());
LOG_ERROR("%s BME68X code: %s", functionName.c_str(), String(bme680.sensor.status).c_str());
else if (bme680.sensor.status > BME68X_OK)
LOG_WARN("%s BME68X code: %s\n", functionName.c_str(), String(bme680.sensor.status).c_str());
LOG_WARN("%s BME68X code: %s", functionName.c_str(), String(bme680.sensor.status).c_str());
}
#endif