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/16 07:14:15 UTC

[GitHub] [incubator-pegasus] empiredan commented on a diff in pull request #1312: refactor(log): use LOG_FATAL_F instead of LOG_FATAL

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


##########
src/runtime/task/simple_task_queue.cpp:
##########
@@ -78,7 +78,7 @@ void simple_timer_service::add_timer(task *task)
         if (!ec) {
             task->enqueue();
         } else if (ec != ::boost::asio::error::operation_aborted) {
-            LOG_FATAL("timer failed for task %s, err = %u", task->spec().name.c_str(), ec.value());
+            LOG_FATAL_F("timer failed for task {}, err = {}", task->spec().name, ec.value());

Review Comment:
   ```suggestion
               LOG_FATAL_F("timer failed for task {}, err = {}", task->spec().name, ec.message());
   ```



##########
src/test/kill_test/data_verifier.cpp:
##########
@@ -202,30 +202,30 @@ void do_get_range(int thread_id, int round_id, long long start_id, long long end
         if (ret == PERR_OK || ret == PERR_NOT_FOUND) {
             long cur_time = get_time();
             if (ret == PERR_NOT_FOUND) {
-                LOG_FATAL("GetThread[%d]: round(%d): get not found: id=%lld, try=%d, time=%ld "
-                          "(gpid=%d.%d, server=%s), and exit",
-                          thread_id,
-                          round_id,
-                          id,
-                          try_count,
-                          (cur_time - last_time),
-                          info.app_id,
-                          info.partition_index,
-                          info.server.c_str());
+                LOG_FATAL_F("GetThread[{}]: round({}): get not found: id={}, try={}, time={} "
+                            "(gpid={}.{}, server={}), and exit",
+                            thread_id,
+                            round_id,
+                            id,
+                            try_count,
+                            (cur_time - last_time),

Review Comment:
   ```suggestion
                               cur_time - last_time,
   ```



##########
src/test/kill_test/data_verifier.cpp:
##########
@@ -202,30 +202,30 @@ void do_get_range(int thread_id, int round_id, long long start_id, long long end
         if (ret == PERR_OK || ret == PERR_NOT_FOUND) {
             long cur_time = get_time();
             if (ret == PERR_NOT_FOUND) {
-                LOG_FATAL("GetThread[%d]: round(%d): get not found: id=%lld, try=%d, time=%ld "
-                          "(gpid=%d.%d, server=%s), and exit",
-                          thread_id,
-                          round_id,
-                          id,
-                          try_count,
-                          (cur_time - last_time),
-                          info.app_id,
-                          info.partition_index,
-                          info.server.c_str());
+                LOG_FATAL_F("GetThread[{}]: round({}): get not found: id={}, try={}, time={} "
+                            "(gpid={}.{}, server={}), and exit",
+                            thread_id,
+                            round_id,
+                            id,
+                            try_count,
+                            (cur_time - last_time),
+                            info.app_id,
+                            info.partition_index,
+                            info.server);
                 exit(-1);
             } else if (value != get_value) {
-                LOG_FATAL("GetThread[%d]: round(%d): get mismatched: id=%lld, try=%d, time=%ld, "
-                          "expect_value=%s, real_value=%s (gpid=%d.%d, server=%s), and exit",
-                          thread_id,
-                          round_id,
-                          id,
-                          try_count,
-                          (cur_time - last_time),
-                          value.c_str(),
-                          get_value.c_str(),
-                          info.app_id,
-                          info.partition_index,
-                          info.server.c_str());
+                LOG_FATAL_F("GetThread[{}]: round({}): get mismatched: id={}, try={}, time={}, "
+                            "expect_value={}, real_value={} (gpid={}.{}, server={}), and exit",
+                            thread_id,
+                            round_id,
+                            id,
+                            try_count,
+                            (cur_time - last_time),

Review Comment:
   ```suggestion
                               cur_time - last_time,
   ```



-- 
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