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>
diff --git a/pw_kvs/fake_flash_memory.cc b/pw_kvs/fake_flash_memory.cc
index 4c30913..ba3decc 100644
--- a/pw_kvs/fake_flash_memory.cc
+++ b/pw_kvs/fake_flash_memory.cc
@@ -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"
diff --git a/pw_kvs/flash_memory.cc b/pw_kvs/flash_memory.cc
index 142e7eb..4f28e07 100644
--- a/pw_kvs/flash_memory.cc
+++ b/pw_kvs/flash_memory.cc
@@ -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 @@
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();
diff --git a/pw_kvs/flash_partition_with_stats.cc b/pw_kvs/flash_partition_with_stats.cc
index 26b0eee..48560fd 100644
--- a/pw_kvs/flash_partition_with_stats.cc
+++ b/pw_kvs/flash_partition_with_stats.cc
@@ -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"