pw_kvs::flash: Update logs for flash operations

Update flash-related log messages to use the PW_LOG_MODULE_NAME of
"PW_FLASH" instead of "KVS". Update the error log in
FlashPartition::CheckBounds() to be more clear what the error is.

Change-Id: If35a914162a45aaec1fd029dc4ec09bc05c5ea37
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/65340
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: David Rogers <davidrogers@google.com>
This commit is contained in:
David Rogers 2021-10-12 15:24:48 -07:00 committed by CQ Bot Account
parent e4dd0d71f0
commit eb05d88e81
3 changed files with 7 additions and 5 deletions

View File

@ -12,7 +12,7 @@
// License for the specific language governing permissions and limitations under
// the License.
#define PW_LOG_MODULE_NAME "KVS"
#define PW_LOG_MODULE_NAME "PW_FLASH"
#define PW_LOG_LEVEL PW_KVS_LOG_LEVEL
#include "pw_kvs/fake_flash_memory.h"

View File

@ -12,7 +12,7 @@
// License for the specific language governing permissions and limitations under
// the License.
#define PW_LOG_MODULE_NAME "KVS"
#define PW_LOG_MODULE_NAME "PW_FLASH"
#define PW_LOG_LEVEL PW_KVS_LOG_LEVEL
#include "pw_kvs/flash_memory.h"
@ -150,9 +150,11 @@ bool FlashPartition::AppearsErased(std::span<const byte> data) const {
Status FlashPartition::CheckBounds(Address address, size_t length) const {
if (address + length > size_bytes()) {
PW_LOG_ERROR(
"Attempted out-of-bound flash memory access (address: %u length: %u)",
"FlashPartition - Attempted access (address: %u length: %u), exceeds "
"partition size %u bytes",
unsigned(address),
unsigned(length));
unsigned(length),
unsigned(size_bytes()));
return Status::OutOfRange();
}
return OkStatus();

View File

@ -12,7 +12,7 @@
// License for the specific language governing permissions and limitations under
// the License.
#define PW_LOG_MODULE_NAME "KVS"
#define PW_LOG_MODULE_NAME "PW_FLASH"
#define PW_LOG_LEVEL PW_KVS_LOG_LEVEL
#include "pw_kvs/flash_partition_with_stats.h"