You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2023/01/19 14:05:19 UTC

[GitHub] [incubator-pegasus] empiredan commented on a diff in pull request #1320: refactor(log): use LOG_ERROR_F instead of LOG_ERROR (2/2)

empiredan commented on code in PR #1320:
URL: https://github.com/apache/incubator-pegasus/pull/1320#discussion_r1081246338


##########
src/runtime/rpc/network.cpp:
##########
@@ -418,8 +418,8 @@ bool rpc_session::on_recv_message(message_ex *msg, int delay_ms)
         // - the remote address is not listened, which means the remote port is not occupied
         // - operating system chooses the remote port as client's ephemeral port
         if (is_client() && msg->header->from_address == _net.engine()->primary_address()) {
-            LOG_ERROR("self connection detected, address = %s",
-                      msg->header->from_address.to_string());
+            LOG_ERROR_F("self connection detected, address = {}",
+                        msg->header->from_address.to_string());

Review Comment:
   ```suggestion
                           msg->header->from_address);
   ```



##########
src/utils/filesystem.cpp:
##########
@@ -747,10 +746,10 @@ error_code md5sum(const std::string &file_path, /*out*/ std::string &result)
                 break;
             } else {
                 int err = ferror(fp);
-                LOG_ERROR("md5sum error: read file %s failed: errno = %d (%s)",
-                          file_path.c_str(),
-                          err,
-                          safe_strerror(err).c_str());
+                LOG_ERROR_F("md5sum error: read file {} failed: errno = %d ({})",

Review Comment:
   ```suggestion
                   LOG_ERROR_F("md5sum error: read file {} failed: errno = {} ({})",
   ```



##########
src/meta/meta_data.cpp:
##########
@@ -424,22 +424,21 @@ bool config_context::check_order()
         return true;
     for (unsigned int i = 0; i < dropped.size() - 1; ++i) {
         if (dropped_cmp(dropped[i], dropped[i + 1]) > 0) {
-            LOG_ERROR("check dropped order for gpid(%d.%d) failed, [%s,%llu,%lld,%lld,%lld@%d] vs "
-                      "[%s,%llu,%lld,%lld,%lld@%d]",
-                      config_owner->pid.get_app_id(),
-                      config_owner->pid.get_partition_index(),
-                      dropped[i].node.to_string(),
-                      dropped[i].time,
-                      dropped[i].ballot,
-                      dropped[i].last_committed_decree,
-                      dropped[i].last_prepared_decree,
-                      i,
-                      dropped[i].node.to_string(),
-                      dropped[i].time,
-                      dropped[i].ballot,
-                      dropped[i].last_committed_decree,
-                      dropped[i].last_prepared_decree,
-                      i + 1);
+            LOG_ERROR_F("check dropped order for gpid({}) failed, [{},{},{},{},{}@{}] vs "
+                        "[{},{},{},{},{}@{}]",
+                        config_owner->pid,
+                        dropped[i].node,
+                        dropped[i].time,
+                        dropped[i].ballot,
+                        dropped[i].last_committed_decree,
+                        dropped[i].last_prepared_decree,
+                        i,
+                        dropped[i].node,
+                        dropped[i].time,
+                        dropped[i].ballot,
+                        dropped[i].last_committed_decree,
+                        dropped[i].last_prepared_decree,

Review Comment:
   ```suggestion
                           dropped[i + 1].node,
                           dropped[i + 1].time,
                           dropped[i + 1].ballot,
                           dropped[i + 1].last_committed_decree,
                           dropped[i + 1].last_prepared_decree,
   ```



##########
src/nfs/nfs_server_impl.cpp:
##########
@@ -33,6 +33,7 @@
 
 #include "aio/disk_engine.h"
 #include "runtime/task/async_calls.h"
+#include "utils/safe_strerror_posix.h"
 #include "utils/filesystem.h"
 #include "utils/string_conv.h"

Review Comment:
   ```suggestion
   #include "utils/filesystem.h"
   #include "utils/safe_strerror_posix.h"
   #include "utils/string_conv.h"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org