[logging] fix benign typecast issue in otDump (#5198)

Fixes a benign typecast issue found when using the IAR compiler.
diff --git a/src/core/common/logging.cpp b/src/core/common/logging.cpp
index aa5b85d..7d5136e 100644
--- a/src/core/common/logging.cpp
+++ b/src/core/common/logging.cpp
@@ -123,7 +123,7 @@
         cur += strlen(cur);
     }
 
-    snprintf(cur, sizeof(buf) - static_cast<size_t>(cur - buf), "[%s len=%03u]", aId, static_cast<uint16_t>(aLength));
+    snprintf(cur, sizeof(buf) - static_cast<size_t>(cur - buf), "[%s len=%03u]", aId, static_cast<unsigned>(aLength));
     cur += strlen(cur);
 
     for (size_t i = 0; i < (width - idlen) / 2 - 4; i++)