You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by tw...@apache.org on 2025/12/21 11:54:16 UTC

(kvrocks) branch unstable updated: build: bump C++ standard to 20 (#3300)

This is an automated email from the ASF dual-hosted git repository.

twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 81115726b build: bump C++ standard to 20 (#3300)
81115726b is described below

commit 81115726b1ae2cebb703db5e8bf27a3ad89a436e
Author: Twice <tw...@gmail.com>
AuthorDate: Sun Dec 21 19:54:10 2025 +0800

    build: bump C++ standard to 20 (#3300)
    
    Since rocksdb now requires c++20, we'd better to bump the c++ standard
    too so that it's easy to upgrade rocksdb.
    
    Some changes:
    - logging functions now implemented in macros. due to some changes
    related to fmt and c++20.
    - now gcc 11+ or clang 12+ is required. all released in 2021 (4 yrs
    ago).
---
 .clang-tidy                            |   2 +-
 CMakeLists.txt                         |  17 ++--
 cmake/cpptrace.cmake                   |   1 +
 cmake/rangev3.cmake                    |   2 +-
 src/cli/daemon_util.h                  |  14 ++--
 src/cli/main.cc                        |  12 +--
 src/cli/signal_util.h                  |   6 +-
 src/cluster/cluster.cc                 |  24 +++---
 src/cluster/replication.cc             | 141 +++++++++++++++++----------------
 src/cluster/slot_migrate.cc            | 114 +++++++++++++-------------
 src/cluster/sync_migrate_context.cc    |   2 +-
 src/commands/cmd_replication.cc        |  26 +++---
 src/commands/cmd_script.cc             |   4 +-
 src/commands/cmd_server.cc             |  34 ++++----
 src/commands/cmd_timeseries.cc         |  12 +--
 src/common/bitfield_util.h             |   5 --
 src/common/logging.h                   |  58 ++++----------
 src/common/task_runner.cc              |   2 +-
 src/config/config.cc                   |   8 +-
 src/search/executors/filter_executor.h |   4 +-
 src/search/indexer.cc                  |   4 +-
 src/search/ir_pass.h                   |   2 +-
 src/search/ir_sema_checker.h           |   2 +-
 src/search/passes/cost_model.h         |   2 +-
 src/search/passes/index_selection.h    |   4 +-
 src/search/plan_executor.cc            |   2 +-
 src/server/redis_connection.cc         |  19 ++---
 src/server/redis_request.cc            |   2 +-
 src/server/server.cc                   |  72 ++++++++---------
 src/server/tls_util.cc                 |  23 +++---
 src/server/worker.cc                   |  35 ++++----
 src/stats/log_collector.cc             |   2 +-
 src/storage/batch_debugger.h           |   2 +-
 src/storage/batch_extractor.cc         |  30 +++----
 src/storage/compact_filter.cc          |  24 +++---
 src/storage/compaction_checker.cc      |  20 ++---
 src/storage/event_listener.cc          |  26 +++---
 src/storage/rdb/rdb.cc                 |  38 ++++-----
 src/storage/scripting.cc               |   4 +-
 src/storage/storage.cc                 |  90 ++++++++++-----------
 src/types/redis_hash.cc                |   2 +-
 src/types/redis_tdigest.cc             |  12 +--
 src/types/redis_timeseries.cc          |  10 +--
 src/types/timeseries.cc                |   6 +-
 utils/kvrocks2redis/main.cc            |   8 +-
 utils/kvrocks2redis/parser.cc          |   2 +-
 utils/kvrocks2redis/redis_writer.cc    |  22 ++---
 utils/kvrocks2redis/sync.cc            |  22 ++---
 48 files changed, 475 insertions(+), 500 deletions(-)

diff --git a/.clang-tidy b/.clang-tidy
index d1719f51e..9c77ca094 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,5 +1,5 @@
 # refer to https://clang.llvm.org/extra/clang-tidy/checks/list.html
-Checks: -*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, -clang-analyzer-cplusplus.InnerPointer, clang-analyzer-deadcode.*, clang-analyzer-nullability.*, clang-analyzer-security.*, clang-analyzer-unix.*, clang-analyzer-valist.*, cppcoreguidelines-init-variables, cppcoreguidelines-macro-usage, cppcoreguidelines-interfaces-global-init, cppcoreguidelines-narrowing-conversions, cppcoreguidelines-no-malloc, cppcoreguidelines-prefer-member-initializer, cppcoreguidelines-special-member-fu [...]
+Checks: -*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, -clang-analyzer-cplusplus.InnerPointer, clang-analyzer-deadcode.*, clang-analyzer-nullability.*, clang-analyzer-security.*, clang-analyzer-unix.*, clang-analyzer-valist.*, cppcoreguidelines-init-variables, cppcoreguidelines-macro-usage, cppcoreguidelines-interfaces-global-init, cppcoreguidelines-narrowing-conversions, cppcoreguidelines-no-malloc, cppcoreguidelines-prefer-member-initializer, cppcoreguidelines-special-member-fu [...]
 
 WarningsAsErrors: clang-analyzer-*, -clang-analyzer-security.insecureAPI.rand, google-*, performance-*, cppcoreguidelines-*, modernize-*, readability-*, bugprone-*
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e69a65ae1..11beb3a28 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,20 +45,20 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
 endif()
 
 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
-        message(FATAL_ERROR "It is expected to build kvrocks with GCC 8 or above")
+    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11)
+        message(FATAL_ERROR "It is expected to build kvrocks with GCC 11 or above")
     endif()
 elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
-    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
-        message(FATAL_ERROR "It is expected to build kvrocks with Clang 9 or above")
+    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12)
+        message(FATAL_ERROR "It is expected to build kvrocks with Clang 12 or above")
     endif()
 elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
-    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11)
-        message(FATAL_ERROR "It is expected to build kvrocks with Xcode toolchains 11 or above")
+    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13)
+        message(FATAL_ERROR "It is expected to build kvrocks with Xcode toolchains 13 or above")
     endif()
 else()
     message(WARNING "The compiler you are currently using is not officially supported,
-        so you can try switching to GCC>=8 or Clang>=8 if you encounter problems")
+        so you can try switching to GCC>=11 or Clang>=12 if you encounter problems")
 endif()
 
 if(CMAKE_GENERATOR STREQUAL "Ninja")
@@ -69,7 +69,7 @@ else()
     set(MAKE_COMMAND $(MAKE))
 endif()
 
-set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD 20)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
 set(DEPS_FETCH_PROXY "" CACHE STRING
@@ -269,6 +269,7 @@ target_compile_features(kvrocks_objs PUBLIC cxx_std_17)
 target_compile_options(kvrocks_objs PUBLIC -Wall -Wpedantic -Wsign-compare -Wreturn-type -fno-omit-frame-pointer)
 target_compile_options(kvrocks_objs PUBLIC -Werror=unused-parameter)
 target_compile_options(kvrocks_objs PUBLIC -Werror=unused-result)
+target_compile_definitions(kvrocks_objs PUBLIC span_CONFIG_SELECT_SPAN=1)
 
 # disable unused-variable check on GCC < 8 due to the structure bindings
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?format=multiple&id=81767
diff --git a/cmake/cpptrace.cmake b/cmake/cpptrace.cmake
index 3ed9d7f82..8c2c176a3 100644
--- a/cmake/cpptrace.cmake
+++ b/cmake/cpptrace.cmake
@@ -34,4 +34,5 @@ endif ()
 
 FetchContent_MakeAvailableWithArgs(cpptrace
   ${CPPTRACE_BACKEND_OPTION}
+  CPPTRACE_DISABLE_CXX_20_MODULES=ON
 )
diff --git a/cmake/rangev3.cmake b/cmake/rangev3.cmake
index c30a1468e..198716cba 100644
--- a/cmake/rangev3.cmake
+++ b/cmake/rangev3.cmake
@@ -41,7 +41,7 @@ else()
 endif()
 
 FetchContent_MakeAvailableWithArgs(rangev3
-  RANGES_CXX_STD=17
+  RANGES_CXX_STD=20
   RANGES_BUILD_CALENDAR_EXAMPLE=OFF
   RANGES_DEBUG_INFO=${WITH_DEBUG_INFO}
   RANGES_NATIVE=${ARG_RANGES_NATIVE}
diff --git a/src/cli/daemon_util.h b/src/cli/daemon_util.h
index ca406062b..1898fddce 100644
--- a/src/cli/daemon_util.h
+++ b/src/cli/daemon_util.h
@@ -34,10 +34,10 @@
 inline bool SupervisedUpstart() {
   const char *upstart_job = getenv("UPSTART_JOB");
   if (!upstart_job) {
-    warn("upstart supervision requested, but UPSTART_JOB not found");
+    WARN("upstart supervision requested, but UPSTART_JOB not found");
     return false;
   }
-  info("supervised by upstart, will stop to signal readiness");
+  INFO("supervised by upstart, will stop to signal readiness");
   raise(SIGSTOP);
   unsetenv("UPSTART_JOB");
   return true;
@@ -46,13 +46,13 @@ inline bool SupervisedUpstart() {
 inline bool SupervisedSystemd() {
   const char *notify_socket = getenv("NOTIFY_SOCKET");
   if (!notify_socket) {
-    warn("systemd supervision requested, but NOTIFY_SOCKET not found");
+    WARN("systemd supervision requested, but NOTIFY_SOCKET not found");
     return false;
   }
 
   auto fd = UniqueFD(socket(AF_UNIX, SOCK_DGRAM, 0));
   if (!fd) {
-    warn("Cannot connect to systemd socket {}", notify_socket);
+    WARN("Cannot connect to systemd socket {}", notify_socket);
     return false;
   }
 
@@ -79,7 +79,7 @@ inline bool SupervisedSystemd() {
   sendto_flags |= MSG_NOSIGNAL;
 #endif
   if (sendmsg(*fd, &hdr, sendto_flags) < 0) {
-    warn("Cannot send notification to systemd");
+    WARN("Cannot send notification to systemd");
     return false;
   }
   return true;
@@ -106,7 +106,7 @@ inline bool IsSupervisedMode(SupervisedMode mode) {
 inline void Daemonize() {
   pid_t pid = fork();
   if (pid < 0) {
-    error("Failed to fork the process, error: {}", strerror(errno));
+    ERROR("Failed to fork the process, error: {}", strerror(errno));
     exit(1);
   }
 
@@ -114,7 +114,7 @@ inline void Daemonize() {
   // change the file mode
   umask(0);
   if (setsid() < 0) {
-    error("Failed to setsid, error: {}", strerror(errno));
+    ERROR("Failed to setsid, error: {}", strerror(errno));
     exit(1);
   }
 
diff --git a/src/cli/main.cc b/src/cli/main.cc
index 6ad03c03e..53c951c55 100644
--- a/src/cli/main.cc
+++ b/src/cli/main.cc
@@ -50,7 +50,7 @@ Server *srv = nullptr;
 
 extern "C" void SignalHandler(int sig) {
   if (srv && !srv->IsStopped()) {
-    info("Signal {} ({}) received, stopping the server", strsignal(sig), sig);
+    INFO("Signal {} ({}) received, stopping the server", strsignal(sig), sig);
     srv->Stop();
   }
 }
@@ -165,7 +165,7 @@ int main(int argc, char *argv[]) {
     std::cout << "Failed to initialize logging system. Error: " << s.Msg() << std::endl;
     return 1;
   }
-  info("kvrocks {}", PrintVersion());
+  INFO("kvrocks {}", PrintVersion());
   // Tricky: We don't expect that different instances running on the same port,
   // but the server use REUSE_PORT to support the multi listeners. So we connect
   // the listen port to check if the port has already listened or not.
@@ -173,7 +173,7 @@ int main(int argc, char *argv[]) {
     uint32_t ports[] = {config.port, config.tls_port, 0};
     for (uint32_t *port = ports; *port; ++port) {
       if (util::IsPortInUse(*port)) {
-        error("Could not create the server since the specified port {} is already in use", *port);
+        ERROR("Could not create the server since the specified port {} is already in use", *port);
         return 1;
       }
     }
@@ -182,7 +182,7 @@ int main(int argc, char *argv[]) {
   if (config.daemonize && !is_supervised) Daemonize();
   s = CreatePidFile(config.pidfile);
   if (!s.IsOK()) {
-    error("Failed to create pidfile: {}", s.Msg());
+    ERROR("Failed to create pidfile: {}", s.Msg());
     return 1;
   }
   auto pidfile_exit = MakeScopeExit([&config] { RemovePidFile(config.pidfile); });
@@ -197,14 +197,14 @@ int main(int argc, char *argv[]) {
   engine::Storage storage(&config);
   s = storage.Open();
   if (!s.IsOK()) {
-    error("Failed to open the database: {}", s.Msg());
+    ERROR("Failed to open the database: {}", s.Msg());
     return 1;
   }
   Server server(&storage, &config);
   srv = &server;
   s = srv->Start();
   if (!s.IsOK()) {
-    error("Failed to start server: {}", s.Msg());
+    ERROR("Failed to start server: {}", s.Msg());
     return 1;
   }
   srv->Join();
diff --git a/src/cli/signal_util.h b/src/cli/signal_util.h
index 0ca21d628..dce85e6ce 100644
--- a/src/cli/signal_util.h
+++ b/src/cli/signal_util.h
@@ -31,15 +31,15 @@
 #include "version_util.h"
 
 extern "C" inline void SegvHandler(int sig, [[maybe_unused]] siginfo_t *info, [[maybe_unused]] void *secret) {
-  error("Ooops! Apache Kvrocks {} got signal: {} ({})", PrintVersion(), strsignal(sig), sig);
+  ERROR("Ooops! Apache Kvrocks {} got signal: {} ({})", PrintVersion(), strsignal(sig), sig);
   auto trace = cpptrace::generate_trace();
 
   std::string trace_str;
   std::ostringstream os(trace_str);
   trace.print(os);
 
-  error("{}", os.str());
-  error(
+  ERROR("{}", os.str());
+  ERROR(
       "It would be greatly appreciated if you could submit this crash to https://github.com/apache/kvrocks/issues "
       "along with the stacktrace above, logs and any relevant information.");
 
diff --git a/src/cluster/cluster.cc b/src/cluster/cluster.cc
index 20fe3d362..8579cbf0e 100644
--- a/src/cluster/cluster.cc
+++ b/src/cluster/cluster.cc
@@ -130,7 +130,7 @@ Status Cluster::SetSlotRanges(const std::vector<SlotRange> &slot_ranges, const s
         if (migrated_slots_.count(slot) > 0) {
           auto s = srv_->slot_migrator->ClearKeysOfSlotRange(ctx, kDefaultNamespace, SlotRange::GetPoint(slot));
           if (!s.ok()) {
-            error("failed to clear data of migrated slot: {}", s.ToString());
+            ERROR("failed to clear data of migrated slot: {}", s.ToString());
           }
           migrated_slots_.erase(slot);
         }
@@ -213,7 +213,7 @@ Status Cluster::SetClusterNodes(const std::string &nodes_str, int64_t version, b
       if (slots_nodes_[slot] != myself_) {
         auto s = srv_->slot_migrator->ClearKeysOfSlotRange(ctx, kDefaultNamespace, SlotRange::GetPoint(slot));
         if (!s.ok()) {
-          error("failed to clear data of migrated slots: {}", s.ToString());
+          ERROR("failed to clear data of migrated slots: {}", s.ToString());
         }
       }
     }
@@ -246,11 +246,11 @@ Status Cluster::SetMasterSlaveRepl() {
     if (!s.IsOK()) {
       return s.Prefixed("failed to remove master");
     }
-    info("MASTER MODE enabled by cluster topology setting");
+    INFO("MASTER MODE enabled by cluster topology setting");
     if (srv_->slot_migrator && is_cluster_enabled && is_slave) {
       // Slave -> Master
       srv_->slot_migrator->SetStopMigrationFlag(false);
-      info("Change server role to master, restart migration task");
+      INFO("Change server role to master, restart migration task");
     }
     return Status::OK();
   }
@@ -261,16 +261,16 @@ Status Cluster::SetMasterSlaveRepl() {
     std::shared_ptr<ClusterNode> master = it->second;
     auto s = srv_->AddMaster(master->host, master->port, false);
     if (!s.IsOK()) {
-      warn("SLAVE OF {}:{} wasn't enabled by cluster topology setting, encounter error: {}", master->host, master->port,
+      WARN("SLAVE OF {}:{} wasn't enabled by cluster topology setting, encounter error: {}", master->host, master->port,
            s.Msg());
       return s.Prefixed("failed to add master");
     }
     if (srv_->slot_migrator && is_cluster_enabled && !is_slave) {
       // Master -> Slave
       srv_->slot_migrator->SetStopMigrationFlag(true);
-      info("Change server role to slave, stop migration task");
+      INFO("Change server role to slave, stop migration task");
     }
-    info("SLAVE OF {}:{} enabled by cluster topology setting", master->host, master->port);
+    INFO("SLAVE OF {}:{} enabled by cluster topology setting", master->host, master->port);
   }
 
   return Status::OK();
@@ -374,7 +374,7 @@ Status Cluster::ImportSlotRange(redis::Connection *conn, const SlotRange &slot_r
       conn->close_cb = [object_ptr = srv_->slot_import.get(), slot_range]([[maybe_unused]] int fd) {
         auto s = object_ptr->StopForLinkError();
         if (!s.IsOK()) {
-          error("[import] Failed to stop importing slot(s) {}: {}", slot_range.String(), s.Msg());
+          ERROR("[import] Failed to stop importing slot(s) {}: {}", slot_range.String(), s.Msg());
         }
       };  // Stop forbidding writing slot to accept write commands
       if (slot_range.HasOverlap(srv_->slot_migrator->GetForbiddenSlotRange())) {
@@ -384,17 +384,17 @@ Status Cluster::ImportSlotRange(redis::Connection *conn, const SlotRange &slot_r
         // supported in the future.
         srv_->slot_migrator->ReleaseForbiddenSlotRange();
       }
-      info("[import] Start importing slot(s) {}", slot_range.String());
+      INFO("[import] Start importing slot(s) {}", slot_range.String());
       break;
     case kImportSuccess:
       s = srv_->slot_import->Success(slot_range);
       if (!s.IsOK()) return s;
-      info("[import] Mark the importing slot(s) {} as succeed", slot_range.String());
+      INFO("[import] Mark the importing slot(s) {} as succeed", slot_range.String());
       break;
     case kImportFailed:
       s = srv_->slot_import->Fail(slot_range);
       if (!s.IsOK()) return s;
-      info("[import] Mark the importing slot(s) {} as failed", slot_range.String());
+      INFO("[import] Mark the importing slot(s) {} as failed", slot_range.String());
       break;
     default:
       return {Status::NotOK, errInvalidImportState};
@@ -691,7 +691,7 @@ Status Cluster::DumpClusterNodes(const std::string &file) {
 
 Status Cluster::LoadClusterNodes(const std::string &file_path) {
   if (rocksdb::Env::Default()->FileExists(file_path).IsNotFound()) {
-    info("The cluster nodes file {} is not found. Use CLUSTERX subcommands to specify it.", file_path);
+    INFO("The cluster nodes file {} is not found. Use CLUSTERX subcommands to specify it.", file_path);
     return Status::OK();
   }
 
diff --git a/src/cluster/replication.cc b/src/cluster/replication.cc
index aaeab93ae..bb211095c 100644
--- a/src/cluster/replication.cc
+++ b/src/cluster/replication.cc
@@ -37,6 +37,7 @@
 #include "commands/error_constants.h"
 #include "event_util.h"
 #include "fmt/format.h"
+#include "fmt/ostream.h"
 #include "io_util.h"
 #include "logging.h"
 #include "rocksdb/write_batch.h"
@@ -75,7 +76,7 @@ Status FeedSlaveThread::Start() {
     pthread_sigmask(SIG_BLOCK, &mask, &omask);
     auto s = util::SockSend(conn_->GetFD(), redis::RESP_OK, conn_->GetBufferEvent());
     if (!s.IsOK()) {
-      error("failed to send OK response to the replica: {}", s.Msg());
+      ERROR("failed to send OK response to the replica: {}", s.Msg());
       return;
     }
     this->loop();
@@ -97,12 +98,12 @@ Status FeedSlaveThread::Start() {
 
 void FeedSlaveThread::Stop() {
   stop_ = true;
-  warn("Slave thread was terminated, would stop feeding the slave: {}", conn_->GetAddr());
+  WARN("Slave thread was terminated, would stop feeding the slave: {}", conn_->GetAddr());
 }
 
 void FeedSlaveThread::Join() {
   if (auto s = util::ThreadJoin(t_); !s) {
-    warn("Slave thread operation failed: {}", s.Msg());
+    WARN("Slave thread operation failed: {}", s.Msg());
   }
 }
 
@@ -111,7 +112,7 @@ void FeedSlaveThread::checkLivenessIfNeed() {
   const auto ping_command = redis::BulkString("ping");
   auto s = util::SockSend(conn_->GetFD(), ping_command, conn_->GetBufferEvent());
   if (!s.IsOK()) {
-    error("Ping slave [{}] err: {}, would stop the thread", conn_->GetAddr(), s.Msg());
+    ERROR("Ping slave [{}] err: {}, would stop the thread", conn_->GetAddr(), s.Msg());
     Stop();
   }
 }
@@ -127,7 +128,7 @@ void FeedSlaveThread::readCallback(bufferevent *bev, [[maybe_unused]] void *ctx)
   auto input = bufferevent_get_input(bev);
   auto s = req_.Tokenize(input);
   if (!s.IsOK()) {
-    error("[replication] failed to tokenize request: {}", s.Msg());
+    ERROR("[replication] failed to tokenize request: {}", s.Msg());
     return;
   }
 
@@ -136,13 +137,13 @@ void FeedSlaveThread::readCallback(bufferevent *bev, [[maybe_unused]] void *ctx)
   for (const auto &command : *commands) {
     // Validate replconf ack command format
     if (command.size() != 3 || command[0] != "replconf" || command[1] != "ack") {
-      error("[replication] invalid command: {}", util::StringJoin(command, std::string_view(",")));
+      ERROR("[replication] invalid command: {}", util::StringJoin(command, std::string_view(",")));
       continue;
     }
 
     auto seq = ParseInt<rocksdb::SequenceNumber>(command[2], 10);
     if (!seq) {
-      error("[replication] invalid sequence number: {}", util::StringJoin(command, std::string_view(",")));
+      ERROR("[replication] invalid sequence number: {}", util::StringJoin(command, std::string_view(",")));
       continue;
     }
 
@@ -184,7 +185,7 @@ void FeedSlaveThread::loop() {
     auto curr_seq = next_repl_seq_.load();
 
     if (!iter_ || !iter_->Valid()) {
-      if (iter_) info("WAL was rotated, would reopen again");
+      if (iter_) INFO("WAL was rotated, would reopen again");
       if (!srv_->storage->WALHasNewData(curr_seq) || !srv_->storage->GetWALIter(curr_seq, &iter_).IsOK()) {
         iter_ = nullptr;
         usleep(yield_microseconds);
@@ -195,7 +196,7 @@ void FeedSlaveThread::loop() {
     // iter_ would be always valid here
     auto batch = iter_->GetBatch();
     if (batch.sequence != curr_seq) {
-      error(
+      ERROR(
           "Fatal error encountered, WAL iterator is discrete, some seq might be lost, sequence {} expected, but got {}",
           curr_seq, batch.sequence);
       Stop();
@@ -223,7 +224,7 @@ void FeedSlaveThread::loop() {
       // Send entire bulk which contain multiple batches
       auto s = util::SockSend(conn_->GetFD(), batches_bulk, conn_->GetBufferEvent());
       if (!s.IsOK()) {
-        error("Write error while sending batch to slave: {}. batches: 0x{}", s.Msg(), util::StringToHex(batches_bulk));
+        ERROR("Write error while sending batch to slave: {}. batches: 0x{}", s.Msg(), util::StringToHex(batches_bulk));
         Stop();
         return;
       }
@@ -258,7 +259,7 @@ void ReplicationThread::CallbacksStateMachine::ConnEventCB(bufferevent *bev, int
     return;
   }
   if (events & (BEV_EVENT_ERROR | BEV_EVENT_EOF)) {
-    error("[replication] connection error/eof, reconnect the master");
+    ERROR("[replication] connection error/eof, reconnect the master");
     // Wait a bit and reconnect
     repl_->repl_state_.store(kReplConnecting, std::memory_order_relaxed);
     std::this_thread::sleep_for(std::chrono::seconds(1));
@@ -280,7 +281,7 @@ void ReplicationThread::CallbacksStateMachine::SetWriteCB(bufferevent *bev, buff
 void ReplicationThread::CallbacksStateMachine::ReadWriteCB(bufferevent *bev) {
 LOOP_LABEL:
   assert(handler_idx_ <= handlers_.size());
-  debug("[replication] Execute handler[{}]", getHandlerName(handler_idx_));
+  DEBUG("[replication] Execute handler[{}]", getHandlerName(handler_idx_));
   auto st = getHandlerFunc(handler_idx_)(repl_, bev);
   repl_->last_io_time_secs_.store(util::GetTimeStamp(), std::memory_order_relaxed);
   switch (st) {
@@ -307,11 +308,11 @@ LOOP_LABEL:
     case CBState::RESTART:  // state that can be retried some time later
       Stop();
       if (repl_->stop_flag_) {
-        info("[replication] Wouldn't restart while the replication thread was stopped");
+        INFO("[replication] Wouldn't restart while the replication thread was stopped");
         break;
       }
       repl_->repl_state_.store(kReplConnecting, std::memory_order_relaxed);
-      info("[replication] Retry in 10 seconds");
+      INFO("[replication] Retry in 10 seconds");
       std::this_thread::sleep_for(std::chrono::seconds(10));
       Start();
   }
@@ -341,7 +342,7 @@ void ReplicationThread::CallbacksStateMachine::Start() {
     last_connect_timestamp = util::GetTimeStampMS();
     auto cfd = util::SockConnect(repl_->host_, repl_->port_, repl_->srv_->GetConfig()->replication_connect_timeout_ms);
     if (!cfd) {
-      error("[replication] Failed to connect the master, err: {}", cfd.Msg());
+      ERROR("[replication] Failed to connect the master, err: {}", cfd.Msg());
       continue;
     }
 #ifdef ENABLE_OPENSSL
@@ -349,7 +350,7 @@ void ReplicationThread::CallbacksStateMachine::Start() {
     if (repl_->srv_->GetConfig()->tls_replication) {
       ssl = SSL_new(repl_->srv_->ssl_ctx.get());
       if (!ssl) {
-        error("Failed to construct SSL structure for new connection: {}", fmt::streamed(SSLErrors{}));
+        ERROR("Failed to construct SSL structure for new connection: {}", fmt::streamed(SSLErrors{}));
         evutil_closesocket(*cfd);
         return;
       }
@@ -365,7 +366,7 @@ void ReplicationThread::CallbacksStateMachine::Start() {
       if (ssl) SSL_free(ssl);
 #endif
       close(*cfd);
-      error("[replication] Failed to create the event socket");
+      ERROR("[replication] Failed to create the event socket");
       continue;
     }
 #ifdef ENABLE_OPENSSL
@@ -427,9 +428,9 @@ Status ReplicationThread::Start(std::function<bool()> &&pre_fullsync_cb, std::fu
   // Clean synced checkpoint from old master because replica starts to follow new master
   auto s = rocksdb::DestroyDB(srv_->GetConfig()->sync_checkpoint_dir, rocksdb::Options());
   if (!s.ok()) {
-    warn("Can't clean synced checkpoint from master, error: {}", s.ToString());
+    WARN("Can't clean synced checkpoint from master, error: {}", s.ToString());
   } else {
-    warn("Clean old synced checkpoint successfully");
+    WARN("Clean old synced checkpoint successfully");
   }
 
   // cleanup the old backups, so we can start replication in a clean state
@@ -449,9 +450,9 @@ void ReplicationThread::Stop() {
   stop_flag_ = true;  // Stopping procedure is asynchronous,
                       // handled by timer
   if (auto s = util::ThreadJoin(t_); !s) {
-    warn("Replication thread operation failed: {}", s.Msg());
+    WARN("Replication thread operation failed: {}", s.Msg());
   }
-  info("[replication] Stopped");
+  INFO("[replication] Stopped");
 }
 
 /*
@@ -465,7 +466,7 @@ void ReplicationThread::Stop() {
 void ReplicationThread::run() {
   base_ = event_base_new();
   if (base_ == nullptr) {
-    error("[replication] Failed to create new ev base");
+    ERROR("[replication] Failed to create new ev base");
     return;
   }
   psync_steps_.Start();
@@ -481,7 +482,7 @@ void ReplicationThread::run() {
 
 ReplicationThread::CBState ReplicationThread::authWriteCB(bufferevent *bev) {
   SendString(bev, redis::ArrayOfBulkStrings({"AUTH", srv_->GetConfig()->masterauth}));
-  info("[replication] Auth request was sent, waiting for response");
+  INFO("[replication] Auth request was sent, waiting for response");
   repl_state_.store(kReplSendAuth, std::memory_order_relaxed);
   return CBState::NEXT;
 }
@@ -494,17 +495,17 @@ ReplicationThread::CBState ReplicationThread::authReadCB(bufferevent *bev) {  //
   if (!line) return CBState::AGAIN;
   if (!ResponseLineIsOK(line.View())) {
     // Auth failed
-    error("[replication] Auth failed: {}", line.get());
+    ERROR("[replication] Auth failed: {}", line.get());
     return CBState::RESTART;
   }
-  info("[replication] Auth response was received, continue...");
+  INFO("[replication] Auth response was received, continue...");
   return CBState::NEXT;
 }
 
 ReplicationThread::CBState ReplicationThread::checkDBNameWriteCB(bufferevent *bev) {
   SendString(bev, redis::ArrayOfBulkStrings({"_db_name"}));
   repl_state_.store(kReplCheckDBName, std::memory_order_relaxed);
-  info("[replication] Check db name request was sent, waiting for response");
+  INFO("[replication] Check db name request was sent, waiting for response");
   return CBState::NEXT;
 }
 
@@ -515,19 +516,19 @@ ReplicationThread::CBState ReplicationThread::checkDBNameReadCB(bufferevent *bev
 
   if (line[0] == '-') {
     if (isRestoringError(line.View())) {
-      warn("The master was restoring the db, retry later");
+      WARN("The master was restoring the db, retry later");
     } else {
-      error("Failed to get the db name, {}", line.get());
+      ERROR("Failed to get the db name, {}", line.get());
     }
     return CBState::RESTART;
   }
   std::string db_name = storage_->GetName();
   if (line.length == db_name.size() && !strncmp(line.get(), db_name.data(), line.length)) {
     // DB name match, we should continue to next step: TryPsync
-    info("[replication] DB name is valid, continue...");
+    INFO("[replication] DB name is valid, continue...");
     return CBState::NEXT;
   }
-  error("[replication] Mismatched the db name, local: {}, remote: {}", db_name, line.get());
+  ERROR("[replication] Mismatched the db name, local: {}, remote: {}", db_name, line.get());
   return CBState::RESTART;
 }
 
@@ -542,7 +543,7 @@ ReplicationThread::CBState ReplicationThread::replConfWriteCB(bufferevent *bev)
   }
   SendString(bev, redis::ArrayOfBulkStrings(data_to_send));
   repl_state_.store(kReplReplConf, std::memory_order_relaxed);
-  info("[replication] replconf request was sent, waiting for response");
+  INFO("[replication] replconf request was sent, waiting for response");
   return CBState::NEXT;
 }
 
@@ -554,20 +555,20 @@ ReplicationThread::CBState ReplicationThread::replConfReadCB(bufferevent *bev) {
   // on unknown option: first try without announce ip, if it fails again - do nothing (to prevent infinite loop)
   if (isUnknownOption(line.View()) && !next_try_without_announce_ip_address_) {
     next_try_without_announce_ip_address_ = true;
-    warn("The old version master, can't handle ip-address, try without it again");
+    WARN("The old version master, can't handle ip-address, try without it again");
     // Retry previous state, i.e. send replconf again
     return CBState::PREV;
   }
   if (line[0] == '-' && isRestoringError(line.View())) {
-    warn("The master was restoring the db, retry later");
+    WARN("The master was restoring the db, retry later");
     return CBState::RESTART;
   }
   if (!ResponseLineIsOK(line.View())) {
-    warn("[replication] Failed to replconf: {}", line.get() + 1);
+    WARN("[replication] Failed to replconf: {}", line.get() + 1);
     //  backward compatible with old version that doesn't support replconf cmd
     return CBState::NEXT;
   } else {
-    info("[replication] replconf is ok, start psync");
+    INFO("[replication] replconf is ok, start psync");
     return CBState::NEXT;
   }
 }
@@ -597,11 +598,11 @@ ReplicationThread::CBState ReplicationThread::tryPSyncWriteCB(bufferevent *bev)
   if (!srv_->GetConfig()->use_rsid_psync || next_try_old_psync_ || replid.length() != kReplIdLength) {
     next_try_old_psync_ = false;  // Reset next_try_old_psync_
     SendString(bev, redis::ArrayOfBulkStrings({"PSYNC", std::to_string(next_seq)}));
-    info("[replication] Try to use psync, next seq: {}", next_seq);
+    INFO("[replication] Try to use psync, next seq: {}", next_seq);
   } else {
     // NEW PSYNC "Unique Replication Sequence ID": replication id and sequence id
     SendString(bev, redis::ArrayOfBulkStrings({"PSYNC", replid, std::to_string(next_seq)}));
-    info("[replication] Try to use new psync, current unique replication sequence id: {}:{}", replid, cur_seq);
+    INFO("[replication] Try to use new psync, current unique replication sequence id: {}:{}", replid, cur_seq);
   }
   repl_state_.store(kReplSendPSync, std::memory_order_relaxed);
   return CBState::NEXT;
@@ -613,13 +614,13 @@ ReplicationThread::CBState ReplicationThread::tryPSyncReadCB(bufferevent *bev) {
   if (!line) return CBState::AGAIN;
 
   if (line[0] == '-' && isRestoringError(line.View())) {
-    warn("The master was restoring the db, retry later");
+    WARN("The master was restoring the db, retry later");
     return CBState::RESTART;
   }
 
   if (line[0] == '-' && isWrongPsyncNum(line.View())) {
     next_try_old_psync_ = true;
-    warn("The old version master, can't handle new PSYNC, try old PSYNC again");
+    WARN("The old version master, can't handle new PSYNC, try old PSYNC again");
     // Retry previous state, i.e. send PSYNC again
     return CBState::PREV;
   }
@@ -628,11 +629,11 @@ ReplicationThread::CBState ReplicationThread::tryPSyncReadCB(bufferevent *bev) {
     // PSYNC isn't OK, we should use FullSync
     // Switch to fullsync state machine
     fullsync_steps_.Start();
-    info("[replication] Failed to psync, error: {}, switch to fullsync", line.get());
+    INFO("[replication] Failed to psync, error: {}, switch to fullsync", line.get());
     return CBState::QUIT;
   } else {
     // PSYNC is OK, use IncrementBatchLoop
-    info("[replication] PSync is ok, start increment batch loop");
+    INFO("[replication] PSync is ok, start increment batch loop");
     return CBState::NEXT;
   }
 }
@@ -645,7 +646,7 @@ void ReplicationThread::sendReplConfAck(bufferevent *bev, bool force) {
     if (replication_group_sync_) {
       auto s = storage_->SyncWAL();
       if (!s.IsOK()) {
-        error("[replication] Failed to sync WAL before ack: {}", s.Msg());
+        ERROR("[replication] Failed to sync WAL before ack: {}", s.Msg());
         return;
       }
     }
@@ -688,7 +689,7 @@ ReplicationThread::CBState ReplicationThread::incrementBatchLoopCB(bufferevent *
         }
         incr_bulk_len_ = line.length > 0 ? std::strtoull(line.get() + 1, nullptr, 10) : 0;
         if (incr_bulk_len_ == 0) {
-          error("[replication] Invalid increment data size");
+          ERROR("[replication] Invalid increment data size");
           return CBState::RESTART;
         }
         incr_state_ = Incr_batch_data;
@@ -734,7 +735,7 @@ ReplicationThread::CBState ReplicationThread::incrementBatchLoopCB(bufferevent *
 
         auto s = storage_->ReplicaApplyWriteBatch(&batch, write_opts);
         if (!s.IsOK()) {
-          error("[replication] CRITICAL - Failed to write batch to local, {}. batch: 0x{}", s.Msg(),
+          ERROR("[replication] CRITICAL - Failed to write batch to local, {}. batch: 0x{}", s.Msg(),
                 util::StringToHex(batch.Data()));
           return CBState::RESTART;
         }
@@ -742,7 +743,7 @@ ReplicationThread::CBState ReplicationThread::incrementBatchLoopCB(bufferevent *
 
         s = parseWriteBatch(batch);
         if (!s.IsOK()) {
-          error("[replication] CRITICAL - failed to parse write batch 0x{}: {}", util::StringToHex(batch.Data()),
+          ERROR("[replication] CRITICAL - failed to parse write batch 0x{}: {}", util::StringToHex(batch.Data()),
                 s.Msg());
           return CBState::RESTART;
         }
@@ -755,7 +756,7 @@ ReplicationThread::CBState ReplicationThread::incrementBatchLoopCB(bufferevent *
 ReplicationThread::CBState ReplicationThread::fullSyncWriteCB(bufferevent *bev) {
   SendString(bev, redis::ArrayOfBulkStrings({"_fetch_meta"}));
   repl_state_.store(kReplFetchMeta, std::memory_order_relaxed);
-  info("[replication] Start syncing data with fullsync");
+  INFO("[replication] Start syncing data with fullsync");
   return CBState::NEXT;
 }
 
@@ -771,31 +772,31 @@ ReplicationThread::CBState ReplicationThread::fullSyncReadCB(bufferevent *bev) {
       UniqueEvbufReadln line(input, EVBUFFER_EOL_CRLF_STRICT);
       if (!line) return CBState::AGAIN;
       if (line[0] == '-') {
-        error("[replication] Failed to fetch meta id: {}", line.get());
+        ERROR("[replication] Failed to fetch meta id: {}", line.get());
         return CBState::RESTART;
       }
       fullsync_meta_id_ = static_cast<rocksdb::BackupID>(line.length > 0 ? std::strtoul(line.get(), nullptr, 10) : 0);
       if (fullsync_meta_id_ == 0) {
-        error("[replication] Invalid meta id received");
+        ERROR("[replication] Invalid meta id received");
         return CBState::RESTART;
       }
       fullsync_state_ = kFetchMetaSize;
-      info("[replication] Succeed fetching meta id: {}", fullsync_meta_id_);
+      INFO("[replication] Succeed fetching meta id: {}", fullsync_meta_id_);
     }
     case kFetchMetaSize: {
       UniqueEvbufReadln line(input, EVBUFFER_EOL_CRLF_STRICT);
       if (!line) return CBState::AGAIN;
       if (line[0] == '-') {
-        error("[replication] Failed to fetch meta size: {}", line.get());
+        ERROR("[replication] Failed to fetch meta size: {}", line.get());
         return CBState::RESTART;
       }
       fullsync_filesize_ = line.length > 0 ? std::strtoull(line.get(), nullptr, 10) : 0;
       if (fullsync_filesize_ == 0) {
-        error("[replication] Invalid meta file size received");
+        ERROR("[replication] Invalid meta file size received");
         return CBState::RESTART;
       }
       fullsync_state_ = kFetchMetaContent;
-      info("[replication] Succeed fetching meta size: {}", fullsync_filesize_);
+      INFO("[replication] Succeed fetching meta size: {}", fullsync_filesize_);
     }
     case kFetchMetaContent: {
       std::string target_dir;
@@ -807,7 +808,7 @@ ReplicationThread::CBState ReplicationThread::fullSyncReadCB(bufferevent *bev) {
         }
         auto s = engine::Storage::ReplDataManager::ParseMetaAndSave(storage_, fullsync_meta_id_, input, &meta);
         if (!s.IsOK()) {
-          error("[replication] Failed to parse meta and save: {}", s.Msg());
+          ERROR("[replication] Failed to parse meta and save: {}", s.Msg());
           return CBState::AGAIN;
         }
         target_dir = srv_->GetConfig()->backup_sync_dir;
@@ -816,7 +817,7 @@ ReplicationThread::CBState ReplicationThread::fullSyncReadCB(bufferevent *bev) {
         UniqueEvbufReadln line(input, EVBUFFER_EOL_CRLF_STRICT);
         if (!line) return CBState::AGAIN;
         if (line[0] == '-') {
-          error("[replication] Failed to fetch meta info: {}", line.get());
+          ERROR("[replication] Failed to fetch meta info: {}", line.get());
           return CBState::RESTART;
         }
         std::vector<std::string> need_files = util::Split(std::string(line.get()), ",");
@@ -832,17 +833,17 @@ ReplicationThread::CBState ReplicationThread::fullSyncReadCB(bufferevent *bev) {
         if (iter != need_files.end()) need_files.erase(iter);
         auto s = engine::Storage::ReplDataManager::CleanInvalidFiles(storage_, target_dir, need_files);
         if (!s.IsOK()) {
-          warn("[replication] Failed to clean up invalid files of the old checkpoint, error: {}", s.Msg());
-          warn("[replication] Try to clean all checkpoint files");
+          WARN("[replication] Failed to clean up invalid files of the old checkpoint, error: {}", s.Msg());
+          WARN("[replication] Try to clean all checkpoint files");
           auto s = rocksdb::DestroyDB(target_dir, rocksdb::Options());
           if (!s.ok()) {
-            warn("[replication] Failed to clean all checkpoint files, error: {}", s.ToString());
+            WARN("[replication] Failed to clean all checkpoint files, error: {}", s.ToString());
           }
         }
       }
       assert(evbuffer_get_length(input) == 0);
       fullsync_state_ = kFetchMetaID;
-      info("[replication] Succeeded fetching full data files info, fetching files in parallel");
+      INFO("[replication] Succeeded fetching full data files info, fetching files in parallel");
 
       bool pre_fullsync_done = false;
       // If 'slave-empty-db-before-fullsync' is yes, we call 'pre_fullsync_cb_'
@@ -858,10 +859,10 @@ ReplicationThread::CBState ReplicationThread::fullSyncReadCB(bufferevent *bev) {
       auto s = parallelFetchFile(target_dir, meta.files);
       if (!s.IsOK()) {
         if (pre_fullsync_done) post_fullsync_cb_();
-        error("[replication] Failed to parallel fetch files while {}", s.Msg());
+        ERROR("[replication] Failed to parallel fetch files while {}", s.Msg());
         return CBState::RESTART;
       }
-      info("[replication] Succeeded fetching files in parallel, restoring the backup");
+      INFO("[replication] Succeeded fetching files in parallel, restoring the backup");
 
       // Don't need to call 'pre_fullsync_cb_' again if it was called before
       if (!pre_fullsync_done && !pre_fullsync_cb_()) return CBState::RESTART;
@@ -873,18 +874,18 @@ ReplicationThread::CBState ReplicationThread::fullSyncReadCB(bufferevent *bev) {
         s = storage_->RestoreFromCheckpoint();
       }
       if (!s.IsOK()) {
-        error("[replication] Failed to restore backup while {}, restart fullsync", s.Msg());
+        ERROR("[replication] Failed to restore backup while {}, restart fullsync", s.Msg());
         post_fullsync_cb_();
         return CBState::RESTART;
       }
-      info("[replication] Succeeded restoring the backup, fullsync was finish");
+      INFO("[replication] Succeeded restoring the backup, fullsync was finish");
       post_fullsync_cb_();
 
       // It needs to reload namespaces from DB after the full sync is done,
       // or namespaces are not visible in the replica.
       s = srv_->GetNamespace()->LoadAndRewrite();
       if (!s.IsOK()) {
-        error("[replication] Failed to load and rewrite namespace: {}", s.Msg());
+        ERROR("[replication] Failed to load and rewrite namespace: {}", s.Msg());
       }
 
       // Switch to psync state machine again
@@ -892,7 +893,7 @@ ReplicationThread::CBState ReplicationThread::fullSyncReadCB(bufferevent *bev) {
       return CBState::QUIT;
     }
   }
-  unreachable();
+  UNREACHABLE();
 }
 
 Status ReplicationThread::parallelFetchFile(const std::string &dir,
@@ -943,7 +944,7 @@ Status ReplicationThread::parallelFetchFile(const std::string &dir,
               skip_cnt.fetch_add(1);
               uint32_t cur_skip_cnt = skip_cnt.load();
               uint32_t cur_fetch_cnt = fetch_cnt.load();
-              info("[skip] {} {}, skip count: {}, fetch count: {}, progress: {} / {}", f_name, f_crc, cur_skip_cnt,
+              INFO("[skip] {} {}, skip count: {}, fetch count: {}, progress: {} / {}", f_name, f_crc, cur_skip_cnt,
                    cur_fetch_cnt, (cur_skip_cnt + cur_fetch_cnt), files.size());
               continue;
             }
@@ -956,7 +957,7 @@ Status ReplicationThread::parallelFetchFile(const std::string &dir,
             fetch_cnt.fetch_add(1);
             uint32_t cur_skip_cnt = skip_cnt.load();
             uint32_t cur_fetch_cnt = fetch_cnt.load();
-            info("[fetch] Fetched {}, crc32 {}, skip count: {}, fetch count: {}, progress: {} / {}", fetch_file,
+            INFO("[fetch] Fetched {}, crc32 {}, skip count: {}, fetch count: {}, progress: {} / {}", fetch_file,
                  fetch_crc, cur_skip_cnt, cur_fetch_cnt, cur_skip_cnt + cur_fetch_cnt, files_count);
           };
           // For master using old version, it only supports to fetch a single file by one
@@ -1095,14 +1096,14 @@ Status ReplicationThread::fetchFiles(int sock_fd, const std::string &dir, const
 
   UniqueEvbuf evbuf;
   for (unsigned i = 0; i < files.size(); i++) {
-    debug("[fetch] Start to fetch file {}", files[i]);
+    DEBUG("[fetch] Start to fetch file {}", files[i]);
     s = fetchFile(sock_fd, evbuf.get(), dir, files[i], crcs[i], fn, ssl);
     if (!s.IsOK()) {
       s = Status(Status::NotOK, "fetch file err: " + s.Msg());
-      warn("[fetch] Fail to fetch file {}, err: {}", files[i], s.Msg());
+      WARN("[fetch] Fail to fetch file {}, err: {}", files[i], s.Msg());
       break;
     }
-    debug("[fetch] Succeed fetching file {}", files[i]);
+    DEBUG("[fetch] Succeed fetching file {}", files[i]);
 
     // Just for tests
     if (srv_->GetConfig()->fullsync_recv_file_delay) {
@@ -1116,7 +1117,7 @@ Status ReplicationThread::fetchFiles(int sock_fd, const std::string &dir, const
 void ReplicationThread::TimerCB(int, int16_t) {
   // DLOG(INFO) << "[replication] timer";
   if (stop_flag_) {
-    info("[replication] Stop ev loop");
+    INFO("[replication] Stop ev loop");
     event_base_loopbreak(base_);
     psync_steps_.Stop();
     fullsync_steps_.Stop();
diff --git a/src/cluster/slot_migrate.cc b/src/cluster/slot_migrate.cc
index 684f7f6c4..3edf8a3e4 100644
--- a/src/cluster/slot_migrate.cc
+++ b/src/cluster/slot_migrate.cc
@@ -122,7 +122,7 @@ Status SlotMigrator::PerformSlotRangeMigration(const std::string &node_id, std::
     migration_job_ = std::move(job);
     job_cv_.notify_one();
   }
-  info("[migrate] Start migrating slot(s) {} to {}:{}", slot_range.String(), dst_ip, dst_port);
+  INFO("[migrate] Start migrating slot(s) {} to {}:{}", slot_range.String(), dst_ip, dst_port);
 
   return Status::OK();
 }
@@ -133,7 +133,7 @@ SlotMigrator::~SlotMigrator() {
     thread_state_ = ThreadState::Terminated;
     job_cv_.notify_all();
     if (auto s = util::ThreadJoin(t_); !s) {
-      warn("Slot migrating thread operation failed: {}", s.Msg());
+      WARN("Slot migrating thread operation failed: {}", s.Msg());
     }
   }
 }
@@ -158,7 +158,7 @@ void SlotMigrator::loop() {
       clean();
       return;
     }
-    info("[migrate] Migrating slot(s): {}, dst_ip: {}, dst_port: {}, max_speed: {}, max_pipeline_size: {}",
+    INFO("[migrate] Migrating slot(s): {}, dst_ip: {}, dst_port: {}, max_speed: {}, max_pipeline_size: {}",
          migration_job_->slot_range.String(), migration_job_->dst_ip, migration_job_->dst_port,
          migration_job_->max_speed, migration_job_->max_pipeline_size);
 
@@ -177,7 +177,7 @@ void SlotMigrator::runMigrationProcess() {
 
   while (true) {
     if (isTerminated()) {
-      warn("[migrate] Will stop state machine, because the thread was terminated");
+      WARN("[migrate] Will stop state machine, because the thread was terminated");
       clean();
       return;
     }
@@ -186,10 +186,10 @@ void SlotMigrator::runMigrationProcess() {
       case SlotMigrationStage::kStart: {
         auto s = startMigration();
         if (s.IsOK()) {
-          info("[migrate] Succeed to start migrating slot(s) {}", slot_range_.load().String());
+          INFO("[migrate] Succeed to start migrating slot(s) {}", slot_range_.load().String());
           current_stage_ = SlotMigrationStage::kSnapshot;
         } else {
-          error("[migrate] Failed to start migrating slot(s) {}. Error: {}", slot_range_.load().String(), s.Msg());
+          ERROR("[migrate] Failed to start migrating slot(s) {}. Error: {}", slot_range_.load().String(), s.Msg());
           current_stage_ = SlotMigrationStage::kFailed;
           resumeSyncCtx(s);
         }
@@ -200,7 +200,7 @@ void SlotMigrator::runMigrationProcess() {
         if (s.IsOK()) {
           current_stage_ = SlotMigrationStage::kWAL;
         } else {
-          error("[migrate] Failed to send snapshot of slot(s) {}. Error: {}", slot_range_.load().String(), s.Msg());
+          ERROR("[migrate] Failed to send snapshot of slot(s) {}. Error: {}", slot_range_.load().String(), s.Msg());
           current_stage_ = SlotMigrationStage::kFailed;
           resumeSyncCtx(s);
         }
@@ -209,10 +209,10 @@ void SlotMigrator::runMigrationProcess() {
       case SlotMigrationStage::kWAL: {
         auto s = syncWAL();
         if (s.IsOK()) {
-          info("[migrate] Succeed to sync from WAL for slot(s) {}", slot_range_.load().String());
+          INFO("[migrate] Succeed to sync from WAL for slot(s) {}", slot_range_.load().String());
           current_stage_ = SlotMigrationStage::kSuccess;
         } else {
-          error("[migrate] Failed to sync from WAL for slot(s) {}. Error: {}", slot_range_.load().String(), s.Msg());
+          ERROR("[migrate] Failed to sync from WAL for slot(s) {}. Error: {}", slot_range_.load().String(), s.Msg());
           current_stage_ = SlotMigrationStage::kFailed;
           resumeSyncCtx(s);
         }
@@ -221,12 +221,12 @@ void SlotMigrator::runMigrationProcess() {
       case SlotMigrationStage::kSuccess: {
         auto s = finishSuccessfulMigration();
         if (s.IsOK()) {
-          info("[migrate] Succeed to migrate slot(s) {}", slot_range_.load().String());
+          INFO("[migrate] Succeed to migrate slot(s) {}", slot_range_.load().String());
           current_stage_ = SlotMigrationStage::kClean;
           migration_state_ = MigrationState::kSuccess;
           resumeSyncCtx(s);
         } else {
-          error("[migrate] Failed to finish a successful migration of slot(s) {}. Error: {}",
+          ERROR("[migrate] Failed to finish a successful migration of slot(s) {}. Error: {}",
                 slot_range_.load().String(), s.Msg());
           current_stage_ = SlotMigrationStage::kFailed;
           resumeSyncCtx(s);
@@ -236,10 +236,10 @@ void SlotMigrator::runMigrationProcess() {
       case SlotMigrationStage::kFailed: {
         auto s = finishFailedMigration();
         if (!s.IsOK()) {
-          error("[migrate] Failed to finish a failed migration of slot(s) {}. Error: {}", slot_range_.load().String(),
+          ERROR("[migrate] Failed to finish a failed migration of slot(s) {}. Error: {}", slot_range_.load().String(),
                 s.Msg());
         }
-        info("[migrate] Failed to migrate a slot(s) {}", slot_range_.load().String());
+        INFO("[migrate] Failed to migrate a slot(s) {}", slot_range_.load().String());
         migration_state_ = MigrationState::kFailed;
         current_stage_ = SlotMigrationStage::kClean;
         break;
@@ -249,7 +249,7 @@ void SlotMigrator::runMigrationProcess() {
         return;
       }
       default:
-        error("[migrate] Unexpected state for the state machine: {}", static_cast<int>(current_stage_));
+        ERROR("[migrate] Unexpected state for the state machine: {}", static_cast<int>(current_stage_));
         clean();
         return;
     }
@@ -296,11 +296,11 @@ Status SlotMigrator::startMigration() {
   if (migration_type_ == MigrationType::kRawKeyValue) {
     bool supported = GET_OR_RET(supportedApplyBatchCommandOnDstNode(*dst_fd_));
     if (!supported) {
-      info("APPLYBATCH command is not supported, use redis command for migration");
+      INFO("APPLYBATCH command is not supported, use redis command for migration");
       migration_type_ = MigrationType::kRedisCommand;
     }
   }
-  info("[migrate] Start migrating slot(s) {}, connect destination fd {}", slot_range_.load().String(), *dst_fd_);
+  INFO("[migrate] Start migrating slot(s) {}, connect destination fd {}", slot_range_.load().String(), *dst_fd_);
 
   return Status::OK();
 }
@@ -329,11 +329,11 @@ Status SlotMigrator::sendSnapshotByCmd() {
   uint64_t empty_key_cnt = 0;
   std::string restore_cmds;
   SlotRange slot_range = slot_range_;
-  info("[migrate] Start migrating snapshot of slot(s): {}", slot_range.String());
+  INFO("[migrate] Start migrating snapshot of slot(s): {}", slot_range.String());
 
   // Construct key prefix to iterate the keys belong to the target slot
   std::string prefix = ComposeSlotKeyPrefix(namespace_, slot_range.start);
-  info("[migrate] Iterate keys of slot(s), key's prefix: {}", prefix);
+  INFO("[migrate] Iterate keys of slot(s), key's prefix: {}", prefix);
 
   std::string upper_bound = ComposeSlotKeyUpperBound(namespace_, slot_range.end);
   rocksdb::ReadOptions read_options = storage_->DefaultScanOptions();
@@ -370,23 +370,23 @@ Status SlotMigrator::sendSnapshotByCmd() {
     }
 
     if (*result == KeyMigrationResult::kMigrated) {
-      info("[migrate] The key {} successfully migrated", user_key);
+      INFO("[migrate] The key {} successfully migrated", user_key);
       migrated_key_cnt++;
     } else if (*result == KeyMigrationResult::kExpired) {
-      info("[migrate] The key {} is expired", user_key);
+      INFO("[migrate] The key {} is expired", user_key);
       expired_key_cnt++;
     } else if (*result == KeyMigrationResult::kUnderlyingStructEmpty) {
-      info("[migrate] The key {} has no elements", user_key);
+      INFO("[migrate] The key {} has no elements", user_key);
       empty_key_cnt++;
     } else {
-      error("[migrate] Migrated a key {} with unexpected result: {}", user_key, static_cast<int>(*result));
+      ERROR("[migrate] Migrated a key {} with unexpected result: {}", user_key, static_cast<int>(*result));
       return {Status::NotOK};
     }
   }
 
   if (auto s = iter->status(); !s.ok()) {
     auto err_str = s.ToString();
-    error("[migrate] Failed to iterate keys of slot {}: {}", current_slot, err_str);
+    ERROR("[migrate] Failed to iterate keys of slot {}: {}", current_slot, err_str);
     return {Status::NotOK, fmt::format("failed to iterate keys of slot {}: {}", current_slot, err_str)};
   }
 
@@ -396,7 +396,7 @@ Status SlotMigrator::sendSnapshotByCmd() {
   if (!s.IsOK()) {
     return s.Prefixed(errFailedToSendCommands);
   }
-  info(
+  INFO(
       "[migrate] Succeed to migrate slot(s) snapshot, slot(s): {}, Migrated keys: {}, Expired keys: {}, Empty keys: {}",
       slot_range.String(), migrated_key_cnt, expired_key_cnt, empty_key_cnt);
 
@@ -459,7 +459,7 @@ Status SlotMigrator::finishFailedMigration() {
 }
 
 void SlotMigrator::clean() {
-  info("[migrate] Clean resources of migrating slot(s) {}", slot_range_.load().String());
+  INFO("[migrate] Clean resources of migrating slot(s) {}", slot_range_.load().String());
   if (slot_snapshot_) {
     storage_->GetDB()->ReleaseSnapshot(slot_snapshot_);
     slot_snapshot_ = nullptr;
@@ -593,7 +593,7 @@ Status SlotMigrator::checkMultipleResponses(int sock_fd, int total) {
         case ParserState::ArrayLen: {
           UniqueEvbufReadln line(evbuf.get(), EVBUFFER_EOL_CRLF_STRICT);
           if (!line) {
-            info("[migrate] Event buffer is empty, read socket again");
+            INFO("[migrate] Event buffer is empty, read socket again");
             run = false;
             break;
           }
@@ -625,7 +625,7 @@ Status SlotMigrator::checkMultipleResponses(int sock_fd, int total) {
         // Handle bulk string response
         case ParserState::BulkData: {
           if (evbuffer_get_length(evbuf.get()) < bulk_or_array_len + 2) {
-            info("[migrate] Bulk data in event buffer is not complete, read socket again");
+            INFO("[migrate] Bulk data in event buffer is not complete, read socket again");
             run = false;
             break;
           }
@@ -639,7 +639,7 @@ Status SlotMigrator::checkMultipleResponses(int sock_fd, int total) {
           while (run && bulk_or_array_len > 0) {
             evbuffer_ptr ptr = evbuffer_search_eol(evbuf.get(), nullptr, nullptr, EVBUFFER_EOL_CRLF_STRICT);
             if (ptr.pos < 0) {
-              info("[migrate] Array data in event buffer is not complete, read socket again");
+              INFO("[migrate] Array data in event buffer is not complete, read socket again");
               run = false;
               break;
             }
@@ -1006,7 +1006,7 @@ Status SlotMigrator::sendCmdsPipelineIfNeed(std::string *commands, bool need) {
   }
 
   if (current_pipeline_size_ == 0) {
-    info("[migrate] No commands to send");
+    INFO("[migrate] No commands to send");
     return Status::OK();
   }
 
@@ -1032,7 +1032,7 @@ Status SlotMigrator::sendCmdsPipelineIfNeed(std::string *commands, bool need) {
 }
 
 void SlotMigrator::setForbiddenSlotRange(const SlotRange &slot_range) {
-  info("[migrate] Setting forbidden slot(s) {}", slot_range.String());
+  INFO("[migrate] Setting forbidden slot(s) {}", slot_range.String());
   // Block server to set forbidden slot
   uint64_t during = util::GetTimeStampUS();
   {
@@ -1040,11 +1040,11 @@ void SlotMigrator::setForbiddenSlotRange(const SlotRange &slot_range) {
     forbidden_slot_range_ = slot_range;
   }
   during = util::GetTimeStampUS() - during;
-  info("[migrate] To set forbidden slot, server was blocked for {} us", during);
+  INFO("[migrate] To set forbidden slot, server was blocked for {} us", during);
 }
 
 void SlotMigrator::ReleaseForbiddenSlotRange() {
-  info("[migrate] Release forbidden slot(s) {}", forbidden_slot_range_.load().String());
+  INFO("[migrate] Release forbidden slot(s) {}", forbidden_slot_range_.load().String());
   forbidden_slot_range_ = {-1, -1};
 }
 
@@ -1057,7 +1057,7 @@ void SlotMigrator::applyMigrationSpeedLimit() const {
     }
     if (last_send_time_ + per_request_time > current_time) {
       uint64_t during = last_send_time_ + per_request_time - current_time;
-      info("[migrate] Sleep to limit migration speed for: {}", during);
+      INFO("[migrate] Sleep to limit migration speed for: {}", during);
       std::this_thread::sleep_for(std::chrono::microseconds(during));
     }
   }
@@ -1068,7 +1068,7 @@ Status SlotMigrator::generateCmdsFromBatch(rocksdb::BatchResult *batch, std::str
   WriteBatchExtractor write_batch_extractor(storage_->IsSlotIdEncoded(), slot_range_, false);
   rocksdb::Status status = batch->writeBatchPtr->Iterate(&write_batch_extractor);
   if (!status.ok()) {
-    error("[migrate] Failed to parse write batch, Err: {}", status.ToString());
+    ERROR("[migrate] Failed to parse write batch, Err: {}", status.ToString());
     return {Status::NotOK};
   }
 
@@ -1086,7 +1086,7 @@ Status SlotMigrator::generateCmdsFromBatch(rocksdb::BatchResult *batch, std::str
 
 Status SlotMigrator::migrateIncrementData(std::unique_ptr<rocksdb::TransactionLogIterator> *iter, uint64_t end_seq) {
   if (!(*iter) || !(*iter)->Valid()) {
-    error("[migrate] WAL iterator is invalid");
+    ERROR("[migrate] WAL iterator is invalid");
     return {Status::NotOK};
   }
 
@@ -1095,13 +1095,13 @@ Status SlotMigrator::migrateIncrementData(std::unique_ptr<rocksdb::TransactionLo
 
   while (true) {
     if (stop_migration_) {
-      error("[migrate] Migration task end during migrating WAL data");
+      ERROR("[migrate] Migration task end during migrating WAL data");
       return {Status::NotOK};
     }
 
     auto batch = (*iter)->GetBatch();
     if (batch.sequence != next_seq) {
-      error("[migrate] WAL iterator is discrete, some seq might be lost, expected sequence: {}, but got sequence: {}",
+      ERROR("[migrate] WAL iterator is discrete, some seq might be lost, expected sequence: {}, but got sequence: {}",
             next_seq, batch.sequence);
       return {Status::NotOK};
     }
@@ -1109,26 +1109,26 @@ Status SlotMigrator::migrateIncrementData(std::unique_ptr<rocksdb::TransactionLo
     // Generate commands by iterating write batch
     auto s = generateCmdsFromBatch(&batch, &commands);
     if (!s.IsOK()) {
-      error("[migrate] Failed to generate commands from write batch");
+      ERROR("[migrate] Failed to generate commands from write batch");
       return {Status::NotOK};
     }
 
     // Check whether command pipeline should be sent
     s = sendCmdsPipelineIfNeed(&commands, false);
     if (!s.IsOK()) {
-      error("[migrate] Failed to send WAL commands pipeline");
+      ERROR("[migrate] Failed to send WAL commands pipeline");
       return {Status::NotOK};
     }
 
     next_seq = batch.sequence + batch.writeBatchPtr->Count();
     if (next_seq > end_seq) {
-      info("[migrate] Migrate incremental data an epoch OK, seq from {}, to {}", wal_begin_seq_, end_seq);
+      INFO("[migrate] Migrate incremental data an epoch OK, seq from {}, to {}", wal_begin_seq_, end_seq);
       break;
     }
 
     (*iter)->Next();
     if (!(*iter)->Valid()) {
-      error("[migrate] WAL iterator is invalid, expected end seq: {}, next seq: {}", end_seq, next_seq);
+      ERROR("[migrate] WAL iterator is invalid, expected end seq: {}, next seq: {}", end_seq, next_seq);
       return {Status::NotOK};
     }
   }
@@ -1136,7 +1136,7 @@ Status SlotMigrator::migrateIncrementData(std::unique_ptr<rocksdb::TransactionLo
   // Send the left data of this epoch
   auto s = sendCmdsPipelineIfNeed(&commands, true);
   if (!s.IsOK()) {
-    error("[migrate] Failed to send WAL last commands in pipeline");
+    ERROR("[migrate] Failed to send WAL last commands in pipeline");
     return {Status::NotOK};
   }
 
@@ -1150,7 +1150,7 @@ Status SlotMigrator::syncWalBeforeForbiddingSlot() {
     uint64_t latest_seq = storage_->GetDB()->GetLatestSequenceNumber();
     uint64_t gap = latest_seq - wal_begin_seq_;
     if (gap <= static_cast<uint64_t>(seq_gap_limit_)) {
-      info("[migrate] Incremental data sequence: {}, less than limit: {}, go to set forbidden slot", gap,
+      INFO("[migrate] Incremental data sequence: {}, less than limit: {}, go to set forbidden slot", gap,
            seq_gap_limit_);
       break;
     }
@@ -1158,21 +1158,21 @@ Status SlotMigrator::syncWalBeforeForbiddingSlot() {
     std::unique_ptr<rocksdb::TransactionLogIterator> iter = nullptr;
     auto s = storage_->GetWALIter(wal_begin_seq_ + 1, &iter);
     if (!s.IsOK()) {
-      error("[migrate] Failed to generate WAL iterator before setting forbidden slot, Err: {}", s.Msg());
+      ERROR("[migrate] Failed to generate WAL iterator before setting forbidden slot, Err: {}", s.Msg());
       return {Status::NotOK};
     }
 
     // Iterate wal and migrate data
     s = migrateIncrementData(&iter, latest_seq);
     if (!s.IsOK()) {
-      error("[migrate] Failed to migrate WAL data before setting forbidden slot");
+      ERROR("[migrate] Failed to migrate WAL data before setting forbidden slot");
       return {Status::NotOK};
     }
 
     wal_begin_seq_ = latest_seq;
     count++;
   }
-  info("[migrate] Succeed to migrate incremental data before setting forbidden slot, end epoch: {}", count);
+  INFO("[migrate] Succeed to migrate incremental data before setting forbidden slot, end epoch: {}", count);
   return Status::OK();
 }
 
@@ -1186,14 +1186,14 @@ Status SlotMigrator::syncWalAfterForbiddingSlot() {
   std::unique_ptr<rocksdb::TransactionLogIterator> iter = nullptr;
   auto s = storage_->GetWALIter(wal_begin_seq_ + 1, &iter);
   if (!s.IsOK()) {
-    error("[migrate] Failed to generate WAL iterator after setting forbidden slot, Err: {}", s.Msg());
+    ERROR("[migrate] Failed to generate WAL iterator after setting forbidden slot, Err: {}", s.Msg());
     return {Status::NotOK};
   }
 
   // Send incremental data
   s = migrateIncrementData(&iter, latest_seq);
   if (!s.IsOK()) {
-    error("[migrate] Failed to migrate WAL data after setting forbidden slot");
+    ERROR("[migrate] Failed to migrate WAL data after setting forbidden slot");
     return {Status::NotOK};
   }
 
@@ -1258,7 +1258,7 @@ Status SlotMigrator::sendMigrationBatch(BatchSender *batch) {
 Status SlotMigrator::sendSnapshotByRawKV() {
   uint64_t start_ts = util::GetTimeStampMS();
   auto slot_range = slot_range_.load();
-  info("[migrate] Migrating snapshot of slot(s) {} by raw key value", slot_range.String());
+  INFO("[migrate] Migrating snapshot of slot(s) {} by raw key value", slot_range.String());
 
   auto prefix = ComposeSlotKeyPrefix(namespace_, slot_range.start);
   auto upper_bound = ComposeSlotKeyUpperBound(namespace_, slot_range.end);
@@ -1326,7 +1326,7 @@ Status SlotMigrator::sendSnapshotByRawKV() {
   GET_OR_RET(sendMigrationBatch(&batch_sender));
 
   auto elapsed = util::GetTimeStampMS() - start_ts;
-  info(
+  INFO(
       "[migrate] Succeed to migrate snapshot range, slot(s): {}, elapsed: {} ms, sent: {} bytes, rate: {:.2f} kb/s, "
       "batches: {}, entries: {}",
       slot_range.String(), elapsed, batch_sender.GetSentBytes(), batch_sender.GetRate(start_ts),
@@ -1337,7 +1337,7 @@ Status SlotMigrator::sendSnapshotByRawKV() {
 
 Status SlotMigrator::syncWALByRawKV() {
   uint64_t start_ts = util::GetTimeStampMS();
-  info("[migrate] Syncing WAL of slot(s) {} by raw key value", slot_range_.load().String());
+  INFO("[migrate] Syncing WAL of slot(s) {} by raw key value", slot_range_.load().String());
   BatchSender batch_sender(*dst_fd_, migrate_batch_size_bytes_, migrate_batch_bytes_per_sec_);
 
   int epoch = 1;
@@ -1352,7 +1352,7 @@ Status SlotMigrator::syncWALByRawKV() {
     if (!s.IsOK()) {
       return {Status::NotOK, fmt::format("migrate incremental data failed, {}", s.Msg())};
     }
-    info("[migrate] Migrated incremental data, epoch: {}, seq from {} to {}", epoch, wal_begin_seq_,
+    INFO("[migrate] Migrated incremental data, epoch: {}, seq from {} to {}", epoch, wal_begin_seq_,
          wal_incremental_seq);
     wal_begin_seq_ = wal_incremental_seq;
     epoch++;
@@ -1366,12 +1366,12 @@ Status SlotMigrator::syncWALByRawKV() {
     if (!s.IsOK()) {
       return {Status::NotOK, fmt::format("migrate last incremental data failed, {}", s.Msg())};
     }
-    info("[migrate] Migrated last incremental data after set forbidden slot, seq from {} to {}", wal_begin_seq_,
+    INFO("[migrate] Migrated last incremental data after set forbidden slot, seq from {} to {}", wal_begin_seq_,
          wal_incremental_seq);
   }
 
   auto elapsed = util::GetTimeStampMS() - start_ts;
-  info(
+  INFO(
       "[migrate] Succeed to migrate incremental data, slot(s): {}, elapsed: {} ms, "
       "sent: {} bytes, rate: {:.2f} kb/s, batches: {}, entries: {}",
       slot_range_.load().String(), elapsed, batch_sender.GetSentBytes(), batch_sender.GetRate(start_ts),
@@ -1383,7 +1383,7 @@ Status SlotMigrator::syncWALByRawKV() {
 bool SlotMigrator::catchUpIncrementalWAL() {
   uint64_t gap = storage_->GetDB()->GetLatestSequenceNumber() - wal_begin_seq_;
   if (gap <= seq_gap_limit_) {
-    info("[migrate] Incremental data sequence gap: {}, less than limit: {}, set forbidden slot(s): {}", gap,
+    INFO("[migrate] Incremental data sequence gap: {}, less than limit: {}, set forbidden slot(s): {}", gap,
          seq_gap_limit_, slot_range_.load().String());
     return true;
   }
@@ -1405,7 +1405,7 @@ Status SlotMigrator::migrateIncrementalDataByRawKV(uint64_t end_seq, BatchSender
       }
       case engine::WALItem::Type::kTypePut: {
         if (item.column_family_id > kMaxColumnFamilyID) {
-          info("[migrate] Invalid put column family id: {}", item.column_family_id);
+          INFO("[migrate] Invalid put column family id: {}", item.column_family_id);
           continue;
         }
         GET_OR_RET(batch_sender->Put(storage_->GetCFHandle(static_cast<ColumnFamilyID>(item.column_family_id)),
@@ -1414,7 +1414,7 @@ Status SlotMigrator::migrateIncrementalDataByRawKV(uint64_t end_seq, BatchSender
       }
       case engine::WALItem::Type::kTypeDelete: {
         if (item.column_family_id > kMaxColumnFamilyID) {
-          info("[migrate] Invalid delete column family id: {}", item.column_family_id);
+          INFO("[migrate] Invalid delete column family id: {}", item.column_family_id);
           continue;
         }
         GET_OR_RET(
diff --git a/src/cluster/sync_migrate_context.cc b/src/cluster/sync_migrate_context.cc
index 6a4e532f6..7f4546930 100644
--- a/src/cluster/sync_migrate_context.cc
+++ b/src/cluster/sync_migrate_context.cc
@@ -35,7 +35,7 @@ void SyncMigrateContext::Resume(const Status &migrate_result) {
   migrate_result_ = migrate_result;
   auto s = conn_->Owner()->EnableWriteEvent(conn_->GetFD());
   if (!s.IsOK()) {
-    error("[server] Failed to enable write event on the sync migrate connection {}: {}", conn_->GetFD(), s.Msg());
+    ERROR("[server] Failed to enable write event on the sync migrate connection {}: {}", conn_->GetFD(), s.Msg());
   }
 }
 
diff --git a/src/commands/cmd_replication.cc b/src/commands/cmd_replication.cc
index 097286e45..73fbca830 100644
--- a/src/commands/cmd_replication.cc
+++ b/src/commands/cmd_replication.cc
@@ -58,7 +58,7 @@ class CommandPSync : public Commander {
   }
 
   Status Execute([[maybe_unused]] engine::Context &ctx, Server *srv, Connection *conn, std::string *output) override {
-    info(
+    INFO(
         "Slave {}, listening port: {}, announce ip: {} asks for synchronization "
         "with next sequence: {}, replication id: {}, and local sequence: {}",
         conn->GetAddr(), conn->GetListeningPort(), conn->GetAnnounceIP(), next_repl_seq_,
@@ -68,7 +68,7 @@ class CommandPSync : public Commander {
     // Check replication id of the last sequence log
     if (new_psync_ && srv->GetConfig()->use_rsid_psync) {
       std::string replid_in_wal = srv->storage->GetReplIdFromWalBySeq(next_repl_seq_ - 1);
-      info("Replication id in WAL: {}", replid_in_wal);
+      INFO("Replication id in WAL: {}", replid_in_wal);
 
       // We check replication id only when WAL has this sequence, since there may be no WAL,
       // Or WAL may have nothing when starting from db of old version kvrocks.
@@ -105,12 +105,12 @@ class CommandPSync : public Commander {
       std::string err = redis::Error(s);
       s = util::SockSend(conn->GetFD(), err, conn->GetBufferEvent());
       if (!s.IsOK()) {
-        warn("failed to send error message to the replica: {}", s.Msg());
+        WARN("failed to send error message to the replica: {}", s.Msg());
       }
       conn->EnableFlag(redis::Connection::kCloseAsync);
-      warn("Failed to add replica: {} to start incremental syncing", conn->GetAddr());
+      WARN("Failed to add replica: {} to start incremental syncing", conn->GetAddr());
     } else {
-      info("New replica: {} was added, start incremental syncing", conn->GetAddr());
+      INFO("New replica: {} was added, start incremental syncing", conn->GetAddr());
     }
     return s;
   }
@@ -138,7 +138,7 @@ class CommandPSync : public Commander {
       auto batch = iter->GetBatch();
       if (seq != batch.sequence) {
         if (seq > batch.sequence) {
-          error("checkWALBoundary with sequence: {}, but GetWALIter return older sequence: {}", seq, batch.sequence);
+          ERROR("checkWALBoundary with sequence: {}, but GetWALIter return older sequence: {}", seq, batch.sequence);
         }
         return {Status::NotOK};
       }
@@ -231,18 +231,18 @@ class CommandFetchMeta : public Commander {
       std::string files;
       auto s = engine::Storage::ReplDataManager::GetFullReplDataInfo(srv->storage, &files);
       if (!s.IsOK()) {
-        warn("[replication] Failed to get full data file info: {}", s.Msg());
+        WARN("[replication] Failed to get full data file info: {}", s.Msg());
         s = util::SockSend(repl_fd, redis::Error({Status::RedisErrorNoPrefix, "can't create db checkpoint"}), bev);
         if (!s.IsOK()) {
-          warn("[replication] Failed to send error response: {}", s.Msg());
+          WARN("[replication] Failed to send error response: {}", s.Msg());
         }
         return;
       }
       // Send full data file info
       if (auto s = util::SockSend(repl_fd, files + CRLF, bev)) {
-        info("[replication] Succeed sending full data file info to {}", ip);
+        INFO("[replication] Succeed sending full data file info to {}", ip);
       } else {
-        warn("[replication] Fail to send full data file info {}, error: {}", ip, s.Msg());
+        WARN("[replication] Fail to send full data file info {}, error: {}", ip, s.Msg());
       }
       auto now_secs = static_cast<time_t>(util::GetTimeStamp());
       srv->storage->SetCheckpointAccessTimeSecs(now_secs);
@@ -299,9 +299,9 @@ class CommandFetchFile : public Commander {
           s = util::SockSendFile(repl_fd, *fd, file_size, bev);
         }
         if (s) {
-          info("[replication] Succeed sending file {} to {}", file, ip);
+          INFO("[replication] Succeed sending file {} to {}", file, ip);
         } else {
-          warn("[replication] Fail to send file {} to {}, error: {}", file, ip, s.Msg());
+          WARN("[replication] Fail to send file {} to {}, error: {}", file, ip, s.Msg());
           break;
         }
         fd.Close();
@@ -313,7 +313,7 @@ class CommandFetchFile : public Commander {
           auto shortest = static_cast<uint64_t>(static_cast<double>(file_size) /
                                                 static_cast<double>(max_replication_bytes) * (1000 * 1000));
           if (duration < shortest) {
-            info("[replication] Need to sleep {} ms since of sending files too quickly", (shortest - duration) / 1000);
+            INFO("[replication] Need to sleep {} ms since of sending files too quickly", (shortest - duration) / 1000);
             usleep(shortest - duration);
           }
         }
diff --git a/src/commands/cmd_script.cc b/src/commands/cmd_script.cc
index e9a05fecc..3f8ee38eb 100644
--- a/src/commands/cmd_script.cc
+++ b/src/commands/cmd_script.cc
@@ -75,12 +75,12 @@ class CommandScript : public Commander {
     if (args_.size() == 2 && subcommand_ == "flush") {
       auto s = srv->ScriptFlush();
       if (!s) {
-        error("Failed to flush scripts: {}", s.Msg());
+        ERROR("Failed to flush scripts: {}", s.Msg());
         return s;
       }
       s = srv->Propagate(engine::kPropagateScriptCommand, args_);
       if (!s) {
-        error("Failed to propagate script command: {}", s.Msg());
+        ERROR("Failed to propagate script command: {}", s.Msg());
         return s;
       }
       *output = redis::RESP_OK;
diff --git a/src/commands/cmd_server.cc b/src/commands/cmd_server.cc
index 63dca1775..04c30ea68 100644
--- a/src/commands/cmd_server.cc
+++ b/src/commands/cmd_server.cc
@@ -96,15 +96,15 @@ class CommandNamespace : public Commander {
     } else if (args_.size() == 4 && sub_command == "set") {
       Status s = srv->GetNamespace()->Set(args_[2], args_[3]);
       *output = s.IsOK() ? redis::RESP_OK : redis::Error(s);
-      warn("Updated namespace: {} with token: {}, addr: {}, result: {}", args_[2], args_[3], conn->GetAddr(), s.Msg());
+      WARN("Updated namespace: {} with token: {}, addr: {}, result: {}", args_[2], args_[3], conn->GetAddr(), s.Msg());
     } else if (args_.size() == 4 && sub_command == "add") {
       Status s = srv->GetNamespace()->Add(args_[2], args_[3]);
       *output = s.IsOK() ? redis::RESP_OK : redis::Error(s);
-      warn("New namespace: {} with token: {}, addr: {}, result: {}", args_[2], args_[3], conn->GetAddr(), s.Msg());
+      WARN("New namespace: {} with token: {}, addr: {}, result: {}", args_[2], args_[3], conn->GetAddr(), s.Msg());
     } else if (args_.size() == 3 && sub_command == "del") {
       Status s = srv->GetNamespace()->Del(args_[2]);
       *output = s.IsOK() ? redis::RESP_OK : redis::Error(s);
-      warn("Deleted namespace: {}, addr: {}, result: {}", args_[2], conn->GetAddr(), s.Msg());
+      WARN("Deleted namespace: {}, addr: {}, result: {}", args_[2], conn->GetAddr(), s.Msg());
     } else if (args_.size() == 2 && sub_command == "current") {
       *output = redis::BulkString(conn->GetNamespace());
     } else {
@@ -148,13 +148,13 @@ class CommandFlushDB : public Commander {
     if (srv->GetConfig()->cluster_enabled) {
       if (srv->slot_migrator->IsMigrationInProgress()) {
         srv->slot_migrator->SetStopMigrationFlag(true);
-        info("Stop migration task for flushdb");
+        INFO("Stop migration task for flushdb");
       }
     }
     redis::Database redis(srv->storage, conn->GetNamespace());
 
     auto s = redis.FlushDB(ctx);
-    warn("DB keys in namespace: {} was flushed, addr: {}", conn->GetNamespace(), conn->GetAddr());
+    WARN("DB keys in namespace: {} was flushed, addr: {}", conn->GetNamespace(), conn->GetAddr());
     if (s.ok()) {
       *output = redis::RESP_OK;
       return Status::OK();
@@ -170,7 +170,7 @@ class CommandFlushAll : public Commander {
     if (srv->GetConfig()->cluster_enabled) {
       if (srv->slot_migrator->IsMigrationInProgress()) {
         srv->slot_migrator->SetStopMigrationFlag(true);
-        info("Stop migration task for flushall");
+        INFO("Stop migration task for flushall");
       }
     }
 
@@ -178,7 +178,7 @@ class CommandFlushAll : public Commander {
 
     auto s = redis.FlushAll(ctx);
     if (s.ok()) {
-      warn("All DB keys was flushed, addr: {}", conn->GetAddr());
+      WARN("All DB keys was flushed, addr: {}", conn->GetAddr());
       *output = redis::RESP_OK;
       return Status::OK();
     }
@@ -249,7 +249,7 @@ class CommandConfig : public Commander {
       if (!s.IsOK()) return s;
 
       *output = redis::RESP_OK;
-      info("# CONFIG REWRITE executed with success");
+      INFO("# CONFIG REWRITE executed with success");
     } else if (args_.size() == 3 && sub_command == "get") {
       std::vector<std::string> values;
       config->Get(args_[2], &values);
@@ -642,7 +642,7 @@ class CommandShutdown : public Commander {
   Status Execute([[maybe_unused]] engine::Context &ctx, Server *srv, [[maybe_unused]] Connection *conn,
                  [[maybe_unused]] std::string *output) override {
     if (!srv->IsStopped()) {
-      info("SHUTDOWN command received, stopping the server");
+      INFO("SHUTDOWN command received, stopping the server");
       srv->Stop();
     }
     return Status::OK();
@@ -992,7 +992,7 @@ class CommandCompact : public Commander {
     if (!s.IsOK()) return s;
 
     *output = redis::RESP_OK;
-    info("Compact was triggered by manual with executed success");
+    INFO("Compact was triggered by manual with executed success");
     return Status::OK();
   }
 };
@@ -1005,7 +1005,7 @@ class CommandBGSave : public Commander {
     if (!s.IsOK()) return s;
 
     *output = redis::RESP_OK;
-    info("BGSave was triggered by manual with executed success");
+    INFO("BGSave was triggered by manual with executed success");
     return Status::OK();
   }
 };
@@ -1018,7 +1018,7 @@ class CommandFlushBackup : public Commander {
     if (!s.IsOK()) return s;
 
     *output = redis::RESP_OK;
-    info("flushbackup was triggered by manual with executed success");
+    INFO("flushbackup was triggered by manual with executed success");
     return Status::OK();
   }
 };
@@ -1076,7 +1076,7 @@ class CommandSlaveOf : public Commander {
       }
 
       *output = redis::RESP_OK;
-      warn("MASTER MODE enabled (user request from '{}')", conn->GetAddr());
+      WARN("MASTER MODE enabled (user request from '{}')", conn->GetAddr());
       return Status::OK();
     }
 
@@ -1085,9 +1085,9 @@ class CommandSlaveOf : public Commander {
     s = srv->AddMaster(host_, port_, false);
     if (s.IsOK()) {
       *output = redis::RESP_OK;
-      warn("SLAVE OF {}:{} enabled (user request from '{}')", host_, port_, conn->GetAddr());
+      WARN("SLAVE OF {}:{} enabled (user request from '{}')", host_, port_, conn->GetAddr());
     } else {
-      error("SLAVE OF {}:{} (user request from '{}') encounter error: {}", host_, port_, conn->GetAddr(), s.Msg());
+      ERROR("SLAVE OF {}:{} (user request from '{}') encounter error: {}", host_, port_, conn->GetAddr(), s.Msg());
     }
 
     return s;
@@ -1555,7 +1555,7 @@ class CommandFlushMemTable : public Commander {
     if (!s.ok()) return {Status::RedisExecErr, s.ToString()};
 
     *output = redis::RESP_OK;
-    info("FLUSHMEMTABLE is triggered and executed successfully");
+    INFO("FLUSHMEMTABLE is triggered and executed successfully");
     return Status::OK();
   }
 
@@ -1570,7 +1570,7 @@ class CommandFlushBlockCache : public Commander {
     srv->storage->FlushBlockCache();
 
     *output = redis::RESP_OK;
-    info("FLUSHBLOCKCACHE is triggered and executed successfully");
+    INFO("FLUSHBLOCKCACHE is triggered and executed successfully");
     return Status::OK();
   }
 };
diff --git a/src/commands/cmd_timeseries.cc b/src/commands/cmd_timeseries.cc
index 39e5becde..c0901d0a0 100644
--- a/src/commands/cmd_timeseries.cc
+++ b/src/commands/cmd_timeseries.cc
@@ -77,7 +77,7 @@ std::string FormatAddResultAsRedisReply(TSChunk::AddResult res) {
     case AddResultType::kBlock:
       return redis::Error({Status::NotOK, errDupBlock});
     default:
-      unreachable();
+      UNREACHABLE();
   }
   return "";
 }
@@ -92,7 +92,7 @@ std::string FormatTSSampleAsRedisReply(TSSample sample) {
 std::string_view FormatChunkTypeAsRedisReply(ChunkType chunk_type) {
   auto it = kChunkTypeMap.find(chunk_type);
   if (it == kChunkTypeMap.end()) {
-    unreachable();
+    UNREACHABLE();
   }
   return it->second;
 }
@@ -100,7 +100,7 @@ std::string_view FormatChunkTypeAsRedisReply(ChunkType chunk_type) {
 std::string_view FormatDuplicatePolicyAsRedisReply(DuplicatePolicy policy) {
   auto it = kDuplicatePolicyMap.find(policy);
   if (it == kDuplicatePolicyMap.end()) {
-    unreachable();
+    UNREACHABLE();
   }
   return it->second;
 }
@@ -108,7 +108,7 @@ std::string_view FormatDuplicatePolicyAsRedisReply(DuplicatePolicy policy) {
 std::string_view FormatAggregatorTypeAsRedisReply(TSAggregatorType aggregator) {
   auto it = kAggregatorTypeMap.find(aggregator);
   if (it == kAggregatorTypeMap.end()) {
-    unreachable();
+    UNREACHABLE();
   }
   return it->second;
 }
@@ -116,7 +116,7 @@ std::string_view FormatAggregatorTypeAsRedisReply(TSAggregatorType aggregator) {
 std::string_view GroupReducerTypeToString(GroupReducerType reducer) {
   auto it = kGroupReducerTypeMap.find(reducer);
   if (it == kGroupReducerTypeMap.end()) {
-    unreachable();
+    UNREACHABLE();
   }
   return it->second;
 }
@@ -153,7 +153,7 @@ std::string FormatCreateRuleResAsRedisReply(TSCreateRuleResult res) {
     case TSCreateRuleResult::kDstHasDestRule:
       return redis::Error({Status::NotOK, "the destination key already has a dst rule"});
     default:
-      unreachable();
+      UNREACHABLE();
   }
   return "";
 }
diff --git a/src/common/bitfield_util.h b/src/common/bitfield_util.h
index 5eae2c23a..51718db8c 100644
--- a/src/common/bitfield_util.h
+++ b/src/common/bitfield_util.h
@@ -146,11 +146,6 @@ class BitfieldValue {
     return value_ == static_cast<uint64_t>(rhs);
   }
 
-  template <class T>
-  friend bool operator==(T lhs, const BitfieldValue &rhs) {
-    return rhs == lhs;
-  }
-
   BitfieldEncoding Encoding() const noexcept { return encoding_; }
 
   uint64_t Value() const noexcept { return value_; }
diff --git a/src/common/logging.h b/src/common/logging.h
index 6ddda6d93..b5acc04ca 100644
--- a/src/common/logging.h
+++ b/src/common/logging.h
@@ -21,65 +21,39 @@
 #pragma once
 
 #include <cstdlib>
-#include <iterator>
 
-#include "fmt/base.h"
-#include "fmt/ostream.h"
-#include "spdlog/common.h"
 #include "spdlog/spdlog.h"
 
 // just like std::source_location::current() in C++20 and __builtin_source_location(),
 // but works in lower version compilers (GCC and Clang)
+// NOTE: even now we use C++20, it is not supported until libstdc++ 11 and libc++ 16.
 inline constexpr spdlog::source_loc CurrentLocation(const char *filename = __builtin_FILE(),
                                                     int lineno = __builtin_LINE(),
                                                     const char *funcname = __builtin_FUNCTION()) {
   return {filename, lineno, funcname};
 }
 
-struct FormatMessageWithLoc {
-  template <typename T>
-  constexpr FormatMessageWithLoc(const T &v, spdlog::source_loc loc = CurrentLocation())  // NOLINT
-      : fmt(v), current_loc(loc) {}
-
-  std::string_view fmt;
-  spdlog::source_loc current_loc;
-};
-
-template <typename... Args>
-inline void log(spdlog::level::level_enum lvl, FormatMessageWithLoc fmt, Args &&...args) {  // NOLINT
-  spdlog::default_logger_raw()->log(fmt.current_loc, lvl, fmt.fmt, std::forward<Args>(args)...);
-}
+// NOLINTNEXTLINE
+#define LOG(...) spdlog::log(CurrentLocation(), __VA_ARGS__)
 
-template <typename... Args>
-inline void debug(FormatMessageWithLoc fmt, Args &&...args) {  // NOLINT
-  spdlog::default_logger_raw()->log(fmt.current_loc, spdlog::level::debug, fmt.fmt, std::forward<Args>(args)...);
-}
+// NOLINTNEXTLINE
+#define DEBUG(...) spdlog::log(CurrentLocation(), spdlog::level::debug, __VA_ARGS__)
 
-template <typename... Args>
-inline void info(FormatMessageWithLoc fmt, Args &&...args) {  // NOLINT
-  spdlog::default_logger_raw()->log(fmt.current_loc, spdlog::level::info, fmt.fmt, std::forward<Args>(args)...);
-}
+// NOLINTNEXTLINE
+#define INFO(...) spdlog::log(CurrentLocation(), spdlog::level::info, __VA_ARGS__)
 
-template <typename... Args>
-inline void warn(FormatMessageWithLoc fmt, Args &&...args) {  // NOLINT
-  spdlog::default_logger_raw()->log(fmt.current_loc, spdlog::level::warn, fmt.fmt, std::forward<Args>(args)...);
-}
+// NOLINTNEXTLINE
+#define WARN(...) spdlog::log(CurrentLocation(), spdlog::level::warn, __VA_ARGS__)
 
-template <typename... Args>
-inline void error(FormatMessageWithLoc fmt, Args &&...args) {  // NOLINT
-  spdlog::default_logger_raw()->log(fmt.current_loc, spdlog::level::err, fmt.fmt, std::forward<Args>(args)...);
-}
+// NOLINTNEXTLINE
+#define ERROR(...) spdlog::log(CurrentLocation(), spdlog::level::err, __VA_ARGS__)
 
-template <typename... Args>
-[[noreturn]] inline void fatal(FormatMessageWithLoc fmt, Args &&...args) {  // NOLINT
-  spdlog::default_logger_raw()->log(fmt.current_loc, spdlog::level::critical, fmt.fmt, std::forward<Args>(args)...);
-  std::abort();
-}
+// NOLINTNEXTLINE
+#define FATAL(...) (spdlog::log(CurrentLocation(), spdlog::level::critical, __VA_ARGS__), std::abort())
 
-[[noreturn]] inline void unreachable(spdlog::source_loc loc = CurrentLocation()) {  // NOLINT
-  fatal({"UNREACHABLE REACHED: please submit a bug report with the stacktrace below.", loc});
-}
+// NOLINTNEXTLINE
+#define UNREACHABLE(...) FATAL("UNREACHABLE REACHED: please submit a bug report with the stacktrace below.")
 
 // NOLINTNEXTLINE
 #define CHECK(cond) \
-  if (!(cond)) fatal("Check `{}` failed.", #cond);
+  if (!(cond)) FATAL("Check `{}` failed.", #cond);
diff --git a/src/common/task_runner.cc b/src/common/task_runner.cc
index 6556d2493..168516fda 100644
--- a/src/common/task_runner.cc
+++ b/src/common/task_runner.cc
@@ -45,7 +45,7 @@ Status TaskRunner::Join() {
 
   for (auto &thread : threads_) {
     if (auto s = util::ThreadJoin(thread); !s) {
-      warn("Failed to join thread: {}", s.Msg());
+      WARN("Failed to join thread: {}", s.Msg());
       continue;
     }
   }
diff --git a/src/config/config.cc b/src/config/config.cc
index 0241b4847..863bdd432 100644
--- a/src/config/config.cc
+++ b/src/config/config.cc
@@ -507,8 +507,8 @@ void Config::initFieldCallback() {
                backup_dir = v;
              }
              if (!previous_backup.empty() && srv != nullptr && !srv->IsLoading()) {
-               // info() should be called after log is initialized and server is loaded.
-               info("change backup dir from {} to {}", previous_backup, v);
+               // INFO() should be called after log is initialized and server is loaded.
+               INFO("change backup dir from {} to {}", previous_backup, v);
              }
              return Status::OK();
            }},
@@ -830,7 +830,7 @@ void Config::SetMaster(const std::string &host, uint32_t port) {
   if (iter != fields_.end()) {
     auto s = iter->second->Set(master_host + " " + std::to_string(master_port));
     if (!s.IsOK()) {
-      error("Failed to set the value of 'slaveof' setting: {}", s.Msg());
+      ERROR("Failed to set the value of 'slaveof' setting: {}", s.Msg());
     }
   }
 }
@@ -842,7 +842,7 @@ void Config::ClearMaster() {
   if (iter != fields_.end()) {
     auto s = iter->second->Set("no one");
     if (!s.IsOK()) {
-      error("Failed to clear the value of 'slaveof' setting: {}", s.Msg());
+      ERROR("Failed to clear the value of 'slaveof' setting: {}", s.Msg());
     }
   }
 }
diff --git a/src/search/executors/filter_executor.h b/src/search/executors/filter_executor.h
index dfce82f2e..aeab850a7 100644
--- a/src/search/executors/filter_executor.h
+++ b/src/search/executors/filter_executor.h
@@ -55,7 +55,7 @@ struct QueryExprEvaluator {
       return Visit(v);
     }
 
-    unreachable();
+    UNREACHABLE();
   }
 
   StatusOr<bool> Visit(AndExpr *v) const {
@@ -114,7 +114,7 @@ struct QueryExprEvaluator {
       case NumericCompareExpr::GET:
         return l >= r;
       default:
-        unreachable();
+        UNREACHABLE();
     }
   }
 
diff --git a/src/search/indexer.cc b/src/search/indexer.cc
index e7089e54c..730a59089 100644
--- a/src/search/indexer.cc
+++ b/src/search/indexer.cc
@@ -53,9 +53,9 @@ StatusOr<FieldValueRetriever> FieldValueRetriever::Create(IndexOnDataType type,
     JsonValue value;
     auto s = db.read(ctx, ns_key, &metadata, &value);
     if (!s.ok()) return {s.IsNotFound() ? Status::NotFound : Status::NotOK, s.ToString()};
-    return FieldValueRetriever(value);
+    return FieldValueRetriever(value);  // NOLINT
   } else {
-    unreachable();
+    UNREACHABLE();
   }
 }
 
diff --git a/src/search/ir_pass.h b/src/search/ir_pass.h
index 312095415..900154435 100644
--- a/src/search/ir_pass.h
+++ b/src/search/ir_pass.h
@@ -98,7 +98,7 @@ struct Visitor : Pass {
       return Visit(std::move(v));
     }
 
-    unreachable();
+    UNREACHABLE();
   }
 
   template <typename T>
diff --git a/src/search/ir_sema_checker.h b/src/search/ir_sema_checker.h
index 8d18cd843..003121777 100644
--- a/src/search/ir_sema_checker.h
+++ b/src/search/ir_sema_checker.h
@@ -101,7 +101,7 @@ struct SemaChecker {
       GET_OR_RET(Check(v->inner.get()));
     } else if (auto v = dynamic_cast<TagContainExpr *>(node)) {
       if (auto iter = current_index->fields.find(v->field->name); iter == current_index->fields.end()) {
-        return {Status::NotOK, fmt::format("field `{}` not found in index `{}`", v->field->name)};
+        return {Status::NotOK, fmt::format("field `{}` not found in index `{}`", v->field->name, current_index->name)};
       } else if (auto meta = iter->second.MetadataAs<redis::TagFieldMetadata>(); !meta) {
         return {Status::NotOK, fmt::format("field `{}` is not a tag field", v->field->name)};
       } else {
diff --git a/src/search/passes/cost_model.h b/src/search/passes/cost_model.h
index 17b26ee63..3d1f5e3e5 100644
--- a/src/search/passes/cost_model.h
+++ b/src/search/passes/cost_model.h
@@ -56,7 +56,7 @@ struct CostModel {
     }
 
     // plan operator type not supported
-    unreachable();
+    UNREACHABLE();
   }
 
   static size_t Visit([[maybe_unused]] const FullIndexScan *node) { return 100; }
diff --git a/src/search/passes/index_selection.h b/src/search/passes/index_selection.h
index c7cde7faf..6ecfd83ab 100644
--- a/src/search/passes/index_selection.h
+++ b/src/search/passes/index_selection.h
@@ -78,7 +78,7 @@ struct IndexSelection : Visitor {
       return std::make_unique<NumericFieldScan>(order->field->CloneAs<FieldRef>(), Interval::Full(), order->order);
     } else {
       // current only numeric field is supported for ordering
-      unreachable();
+      UNREACHABLE();
     }
   }
 
@@ -131,7 +131,7 @@ struct IndexSelection : Visitor {
       return VisitExpr(v);
     }
 
-    unreachable();
+    UNREACHABLE();
   }
 
   std::unique_ptr<PlanOperator> MakeFullIndexFilter(QueryExpr *node) const {
diff --git a/src/search/plan_executor.cc b/src/search/plan_executor.cc
index 07d98f437..76cad005e 100644
--- a/src/search/plan_executor.cc
+++ b/src/search/plan_executor.cc
@@ -99,7 +99,7 @@ struct ExecutorContextVisitor {
       return Visit(v);
     }
 
-    unreachable();
+    UNREACHABLE();
   }
 
   void Visit(Limit *op) {
diff --git a/src/server/redis_connection.cc b/src/server/redis_connection.cc
index 01789290f..5ff4948e0 100644
--- a/src/server/redis_connection.cc
+++ b/src/server/redis_connection.cc
@@ -22,13 +22,14 @@
 #include <rocksdb/perf_context.h>
 
 #include <mutex>
+#include <nonstd/span.hpp>
 #include <shared_mutex>
 
 #include "commands/commander.h"
 #include "commands/error_constants.h"
 #include "fmt/format.h"
+#include "fmt/ostream.h"
 #include "logging.h"
-#include "nonstd/span.hpp"
 #include "search/indexer.h"
 #include "server/redis_reply.h"
 #include "string_util.h"
@@ -107,7 +108,7 @@ void Connection::OnRead([[maybe_unused]] struct bufferevent *bev) {
   if (!s.IsOK()) {
     EnableFlag(redis::Connection::kCloseAfterReply);
     Reply(redis::Error(s));
-    info("[connection] Failed to tokenize the request. Error: {}", s.Msg());
+    INFO("[connection] Failed to tokenize the request. Error: {}", s.Msg());
     return;
   }
 
@@ -126,11 +127,11 @@ void Connection::OnWrite([[maybe_unused]] bufferevent *bev) {
 void Connection::OnEvent(bufferevent *bev, int16_t events) {
   if (events & BEV_EVENT_ERROR) {
 #ifdef ENABLE_OPENSSL
-    error("[connection] Removing client: {}, error: {}, SSL Error: {}", GetAddr(),
+    ERROR("[connection] Removing client: {}, error: {}, SSL Error: {}", GetAddr(),
           evutil_socket_error_to_string(EVUTIL_SOCKET_ERROR()),
           fmt::streamed(SSLError(bufferevent_get_openssl_error(bev))));  // NOLINT
 #else
-    error("[connection] Removing client: {}, error: {}", GetAddr(),
+    ERROR("[connection] Removing client: {}, error: {}", GetAddr(),
           evutil_socket_error_to_string(EVUTIL_SOCKET_ERROR()));
 #endif
     Close();
@@ -138,13 +139,13 @@ void Connection::OnEvent(bufferevent *bev, int16_t events) {
   }
 
   if (events & BEV_EVENT_EOF) {
-    debug("[connection] Going to remove the client: {}, while closed by client", GetAddr());
+    DEBUG("[connection] Going to remove the client: {}, while closed by client", GetAddr());
     Close();
     return;
   }
 
   if (events & BEV_EVENT_TIMEOUT) {
-    debug("[connection] The client: {} reached timeout", GetAddr());
+    DEBUG("[connection] The client: {} reached timeout", GetAddr());
     bufferevent_enable(bev, EV_READ | EV_WRITE);
   }
 }
@@ -425,7 +426,7 @@ void Connection::ExecuteCommands(std::deque<CommandTokens> *to_process_cmds) {
     if (!cmd_s.IsOK()) {
       auto cmd_name = cmd_tokens.front();
       if (util::EqualICase(cmd_name, "host:") || util::EqualICase(cmd_name, "post")) {
-        warn(
+        WARN(
             "[connection] A likely HTTP request is detected in the RESP connection, indicating a potential "
             "Cross-Protocol Scripting attack. Connection aborted.");
         EnableFlag(kCloseAsync);
@@ -574,7 +575,7 @@ void Connection::ExecuteCommands(std::deque<CommandTokens> *to_process_cmds) {
                     if (res.IsOK()) {
                       index_records.push_back(*res);
                     } else if (!res.Is<Status::NoPrefixMatched>() && !res.Is<Status::TypeMismatched>()) {
-                      warn("[connection] index recording failed for key: {}", key);
+                      WARN("[connection] index recording failed for key: {}", key);
                     }
                   },
                   args);
@@ -586,7 +587,7 @@ void Connection::ExecuteCommands(std::deque<CommandTokens> *to_process_cmds) {
       for (const auto &record : index_records) {
         auto s = GlobalIndexer::Update(ctx, record);
         if (!s.IsOK() && !s.Is<Status::TypeMismatched>()) {
-          warn("[connection] index updating failed for key: {}", record.key);
+          WARN("[connection] index updating failed for key: {}", record.key);
         }
       }
     }
diff --git a/src/server/redis_request.cc b/src/server/redis_request.cc
index 2d6399368..6fcce764c 100644
--- a/src/server/redis_request.cc
+++ b/src/server/redis_request.cc
@@ -54,7 +54,7 @@ Status Request::Tokenize(evbuffer *input) {
 
         if (!line || line.length <= 0) {
           if (pipeline_size > 128) {
-            info("[request] Large pipeline detected: {}", pipeline_size);
+            INFO("[request] Large pipeline detected: {}", pipeline_size);
           }
           if (line) {
             continue;
diff --git a/src/server/server.cc b/src/server/server.cc
index a952cdadd..e3a5ec33e 100644
--- a/src/server/server.cc
+++ b/src/server/server.cc
@@ -107,10 +107,10 @@ Server::Server(engine::Storage *storage, Config *config)
     if (!config->unixsocket.empty() && i == 0) {
       Status s = worker->ListenUnixSocket(config->unixsocket, config->unixsocketperm, config->backlog);
       if (!s.IsOK()) {
-        error("[server] Failed to listen on unix socket: {}. Error: {}", config->unixsocket, s.Msg());
+        ERROR("[server] Failed to listen on unix socket: {}. Error: {}", config->unixsocket, s.Msg());
         exit(1);
       }
-      info("[server] Listening on unix socket: {}", config->unixsocket);
+      INFO("[server] Listening on unix socket: {}", config->unixsocket);
     }
     worker_threads_.emplace_back(std::make_unique<WorkerThread>(std::move(worker)));
   }
@@ -128,7 +128,7 @@ Server::~Server() {
   while (GetFetchFileThreadNum() != 0) {
     usleep(100000);
     if (++counter == 600) {
-      warn("[server] Will force destroy the server after waiting 60s, leave {} fetch file threads are still running",
+      WARN("[server] Will force destroy the server after waiting 60s, leave {} fetch file threads are still running",
            GetFetchFileThreadNum());
       break;
     }
@@ -202,7 +202,7 @@ Status Server::Start() {
   }
 
   if (auto s = task_runner_.Start(); !s) {
-    warn("Failed to start task runner: {}", s.Msg());
+    WARN("Failed to start task runner: {}", s.Msg());
   }
   // setup server cron thread
   cron_thread_ = GET_OR_RET(util::CreateThread("server-cron", [this] { this->cron(); }));
@@ -242,7 +242,7 @@ Status Server::Start() {
   }));
 
   memory_startup_use_.store(Stats::GetMemoryRSS(), std::memory_order_relaxed);
-  info("[server] Ready to accept connections");
+  INFO("[server] Ready to accept connections");
 
   return Status::OK();
 }
@@ -263,13 +263,13 @@ void Server::Stop() {
 
 void Server::Join() {
   if (auto s = util::ThreadJoin(cron_thread_); !s) {
-    warn("Cron thread operation failed: {}", s.Msg());
+    WARN("Cron thread operation failed: {}", s.Msg());
   }
   if (auto s = util::ThreadJoin(compaction_checker_thread_); !s) {
-    warn("Compaction checker thread operation failed: {}", s.Msg());
+    WARN("Compaction checker thread operation failed: {}", s.Msg());
   }
   if (auto s = task_runner_.Join(); !s) {
-    warn("{}", s.Msg());
+    WARN("{}", s.Msg());
   }
   for (const auto &worker : worker_threads_) {
     worker->Join();
@@ -300,7 +300,7 @@ Status Server::AddMaster(const std::string &host, uint32_t port, bool force_reco
                                       [this]() {
                                         this->is_loading_ = false;
                                         if (auto s = task_runner_.Start(); !s) {
-                                          warn("Failed to start task runner: {}", s.Msg());
+                                          WARN("Failed to start task runner: {}", s.Msg());
                                         }
                                       });
   if (s.IsOK()) {
@@ -708,7 +708,7 @@ void Server::WakeupBlockingConns(const std::string &key, size_t n_conns) {
     auto conn_ctx = iter->second.front();
     auto s = conn_ctx.owner->EnableWriteEvent(conn_ctx.fd);
     if (!s.IsOK()) {
-      error("[server] Failed to enable write event on blocked client {}: {}", conn_ctx.fd, s.Msg());
+      ERROR("[server] Failed to enable write event on blocked client {}: {}", conn_ctx.fd, s.Msg());
     }
     iter->second.pop_front();
   }
@@ -727,7 +727,7 @@ void Server::OnEntryAddedToStream(const std::string &ns, const std::string &key,
     if (consumer->ns == ns && entry_id > consumer->last_consumed_id) {
       auto s = consumer->owner->EnableWriteEvent(consumer->fd);
       if (!s.IsOK()) {
-        error("[server] Failed to enable write event on blocked stream consumer {}: {}", consumer->fd, s.Msg());
+        ERROR("[server] Failed to enable write event on blocked stream consumer {}: {}", consumer->fd, s.Msg());
       }
       it = iter->second.erase(it);
     } else {
@@ -759,7 +759,7 @@ void Server::WakeupWaitConnections(rocksdb::SequenceNumber seq) {
 
       auto s = it->second.conn->Owner()->EnableWriteEvent(it->second.conn->GetFD());
       if (!s.IsOK()) {
-        error("[server] Failed to enable write event on WAIT connection {}: {}", it->second.conn->GetFD(), s.Msg());
+        ERROR("[server] Failed to enable write event on WAIT connection {}: {}", it->second.conn->GetFD(), s.Msg());
       }
       it = wait_contexts_.erase(it);
       DecrBlockedClientNum();
@@ -778,7 +778,7 @@ void Server::WakeupWaitConnection(redis::Connection *conn, rocksdb::SequenceNumb
 
   auto s = conn->Owner()->EnableWriteEvent(conn->GetFD());
   if (!s.IsOK()) {
-    error("[server] Failed to enable write event on WAIT connection {}: {}", conn->GetFD(), s.Msg());
+    ERROR("[server] Failed to enable write event on WAIT connection {}: {}", conn->GetFD(), s.Msg());
   }
 }
 
@@ -805,7 +805,7 @@ void Server::cleanupWaitConnection(redis::Connection *conn) {
   }
 
   if (erased_count > 1) {
-    warn("[server] {} wait contexts found for connection with fd {}, expect 1", erased_count, conn->GetFD());
+    WARN("[server] {} wait contexts found for connection with fd {}, expect 1", erased_count, conn->GetFD());
   }
 }
 
@@ -917,11 +917,11 @@ void Server::cron() {
       if (!config_->compaction_checker_cron.IsEnabled() && config_->compact_cron.IsEnabled() &&
           config_->compact_cron.IsTimeMatch(&now)) {
         Status s = AsyncCompactDB();
-        info("[server] Schedule to compact the db, result: {}", s.Msg());
+        INFO("[server] Schedule to compact the db, result: {}", s.Msg());
       }
       if (config_->bgsave_cron.IsEnabled() && config_->bgsave_cron.IsTimeMatch(&now)) {
         Status s = AsyncBgSaveDB();
-        info("[server] Schedule to bgsave the db, result: {}", s.Msg());
+        INFO("[server] Schedule to bgsave the db, result: {}", s.Msg());
       }
       if (config_->dbsize_scan_cron.IsEnabled() && config_->dbsize_scan_cron.IsTimeMatch(&now)) {
         auto tokens = namespace_.List();
@@ -938,7 +938,7 @@ void Server::cron() {
 
         for (auto &ns : namespaces) {
           Status s = AsyncScanDBSize(ns);
-          info("[server] Schedule to recalculate the db size on namespace: {}, result: {}", ns, s.Msg());
+          INFO("[server] Schedule to recalculate the db size on namespace: {}, result: {}", ns, s.Msg());
         }
       }
     }
@@ -965,9 +965,9 @@ void Server::cron() {
             (now_secs - create_time_secs > 24 * 60 * 60)) {
           auto s = rocksdb::DestroyDB(config_->checkpoint_dir, rocksdb::Options());
           if (!s.ok()) {
-            warn("[server] Fail to clean checkpoint, error: {}", s.ToString());
+            WARN("[server] Fail to clean checkpoint, error: {}", s.ToString());
           } else {
-            info("[server] Clean checkpoint successfully");
+            INFO("[server] Clean checkpoint successfully");
           }
         }
       }
@@ -981,9 +981,9 @@ void Server::cron() {
     if (counter != 0 && counter % 600 == 0 && storage->IsDBInRetryableIOError()) {
       auto s = storage->GetDB()->Resume();
       if (s.ok()) {
-        warn("[server] Successfully resumed DB after retryable IO error");
+        WARN("[server] Successfully resumed DB after retryable IO error");
       } else {
-        error("[server] Failed to resume DB after retryable IO error: {}", s.ToString());
+        ERROR("[server] Failed to resume DB after retryable IO error: {}", s.ToString());
       }
       storage->SetDBInRetryableIOError(false);
     }
@@ -1504,7 +1504,7 @@ std::string Server::GetRocksDBStatsJson() const {
 // guarantee other threads don't access DB and its column families, then close db.
 bool Server::PrepareRestoreDB() {
   // Stop feeding slaves thread
-  info("[server] Disconnecting slaves...");
+  INFO("[server] Disconnecting slaves...");
   DisconnectSlaves();
 
   // If the DB is restored, the object 'db_' will be destroyed, but
@@ -1520,7 +1520,7 @@ bool Server::PrepareRestoreDB() {
   // To guarantee work threads don't access DB, we should release 'ExclusivityGuard'
   // ASAP to avoid user can't receive responses for long time, because the following
   // 'CloseDB' may cost much time to acquire DB mutex.
-  info("[server] Waiting workers for finishing executing commands...");
+  INFO("[server] Waiting workers for finishing executing commands...");
   while (!works_concurrency_rw_lock_.try_lock()) {
     if (replication_thread_->IsStopped()) {
       is_loading_ = false;
@@ -1531,22 +1531,22 @@ bool Server::PrepareRestoreDB() {
   works_concurrency_rw_lock_.unlock();
 
   // Stop task runner
-  info("[server] Stopping the task runner and clear task queue...");
+  INFO("[server] Stopping the task runner and clear task queue...");
   task_runner_.Cancel();
   if (auto s = task_runner_.Join(); !s) {
-    warn("[server] {}", s.Msg());
+    WARN("[server] {}", s.Msg());
   }
 
   // Cron thread, compaction checker thread, full synchronization thread
   // may always run in the background, we need to close db, so they don't actually work.
-  info("[server] Waiting for closing DB...");
+  INFO("[server] Waiting for closing DB...");
   storage->CloseDB();
   return true;
 }
 
 void Server::WaitNoMigrateProcessing() {
   if (config_->cluster_enabled) {
-    info("[server] Waiting until no migration task is running...");
+    INFO("[server] Waiting until no migration task is running...");
     slot_migrator->SetStopMigrationFlag(true);
     while (slot_migrator->GetCurrentSlotMigrationStage() != SlotMigrationStage::kNone) {
       usleep(500);
@@ -1573,7 +1573,7 @@ Status Server::AsyncCompactDB(const std::string &begin_key, const std::string &e
 
     auto s = storage->Compact(nullptr, begin.get(), end.get());
     if (!s.ok()) {
-      error("[task runner] Failed to do compaction: {}", s.ToString());
+      ERROR("[task runner] Failed to do compaction: {}", s.ToString());
     }
 
     std::lock_guard<std::mutex> lg(db_job_mu_);
@@ -1628,7 +1628,7 @@ Status Server::AsyncScanDBSize(const std::string &ns) {
     engine::Context ctx(storage);
     auto s = db.GetKeyNumStats(ctx, "", &stats);
     if (!s.ok()) {
-      error("failed to retrieve key num stats: {}", s.ToString());
+      ERROR("failed to retrieve key num stats: {}", s.ToString());
     }
 
     std::lock_guard<std::mutex> lg(db_job_mu_);
@@ -1758,7 +1758,7 @@ void Server::KillClient(int64_t *killed, const std::string &addr, uint64_t id, u
       (type & kTypeMaster || (!addr.empty() && addr == master_host_ + ":" + std::to_string(master_port_)))) {
     // Stop replication thread and start a new one to replicate
     if (auto s = AddMaster(master_host_, master_port_, true); !s.IsOK()) {
-      error("[server] Failed to add master {}:{} with error: {}", master_host_, master_port_, s.Msg());
+      ERROR("[server] Failed to add master {}:{} with error: {}", master_host_, master_port_, s.Msg());
     }
     (*killed)++;
   }
@@ -1937,24 +1937,24 @@ void Server::AdjustOpenFilesLimit() {
 
   if (best_limit < max_files) {
     if (best_limit <= static_cast<int>(min_reserved_fds)) {
-      warn(
+      WARN(
           "[server] Your current 'ulimit -n' of {} is not enough for the server to start. "
           "Please increase your open file limit to at least {}. Exiting.",
           old_limit, max_files);
       exit(1);
     }
 
-    warn(
+    WARN(
         "[server] You requested max clients of {} and RocksDB max open files of {} "
         "requiring at least {} max file descriptors.",
         max_clients, rocksdb_max_open_file, max_files);
 
-    warn(
+    WARN(
         "[server] Server can't set maximum open files to {} "
         "because of OS error: {}",
         max_files, strerror(setrlimit_error));
   } else {
-    warn("[server] Increased maximum number of open files to {} (it's originally set to {})", max_files, old_limit);
+    WARN("[server] Increased maximum number of open files to {} (it's originally set to {})", max_files, old_limit);
   }
 }
 
@@ -1967,12 +1967,12 @@ void Server::AdjustWorkerThreads() {
   if (new_worker_threads > worker_threads_.size()) {
     delta = new_worker_threads - worker_threads_.size();
     increaseWorkerThreads(delta);
-    info("[server] Increase worker threads from {} to {}", worker_threads_.size(), new_worker_threads);
+    INFO("[server] Increase worker threads from {} to {}", worker_threads_.size(), new_worker_threads);
     return;
   }
 
   delta = worker_threads_.size() - new_worker_threads;
-  info("[server] Decrease worker threads from {} to {}", worker_threads_.size(), new_worker_threads);
+  INFO("[server] Decrease worker threads from {} to {}", worker_threads_.size(), new_worker_threads);
   decreaseWorkerThreads(delta);
 }
 
diff --git a/src/server/tls_util.cc b/src/server/tls_util.cc
index 95a7a3ab6..33a90f5ae 100644
--- a/src/server/tls_util.cc
+++ b/src/server/tls_util.cc
@@ -22,6 +22,7 @@
 
 #include "tls_util.h"
 
+#include <fmt/ostream.h>
 #include <openssl/err.h>
 #include <openssl/opensslv.h>
 #include <openssl/rand.h>
@@ -45,7 +46,7 @@ void InitSSL() {
   ERR_load_crypto_strings();
 
   if (!RAND_poll()) {
-    error("OpenSSL failed to generate random seed");
+    ERROR("OpenSSL failed to generate random seed");
     exit(1);
   }
 
@@ -117,19 +118,19 @@ StatusOr<unsigned long> ParseSSLProtocols(const std::string &protocols) {  // NO
 
 UniqueSSLContext CreateSSLContext(const Config *config, const SSL_METHOD *method) {
   if (config->tls_cert_file.empty() || config->tls_key_file.empty()) {
-    error("Both tls-cert-file and tls-key-file must be specified while TLS is enabled");
+    ERROR("Both tls-cert-file and tls-key-file must be specified while TLS is enabled");
     return nullptr;
   }
 
   auto ssl_ctx = UniqueSSLContext(method);
   if (!ssl_ctx) {
-    error("Failed to construct SSL context: {}", fmt::streamed(SSLErrors{}));
+    ERROR("Failed to construct SSL context: {}", fmt::streamed(SSLErrors{}));
     return nullptr;
   }
 
   auto proto_status = ParseSSLProtocols(config->tls_protocols);
   if (!proto_status) {
-    error("{}", proto_status.Msg());
+    ERROR("{}", proto_status.Msg());
     return nullptr;
   }
 
@@ -176,16 +177,16 @@ UniqueSSLContext CreateSSLContext(const Config *config, const SSL_METHOD *method
   auto ca_dir = config->tls_ca_cert_dir.empty() ? nullptr : config->tls_ca_cert_dir.c_str();
   if (ca_file || ca_dir) {
     if (SSL_CTX_load_verify_locations(ssl_ctx.get(), ca_file, ca_dir) != 1) {
-      error("Failed to load CA certificates: {}", fmt::streamed(SSLErrors{}));
+      ERROR("Failed to load CA certificates: {}", fmt::streamed(SSLErrors{}));
       return nullptr;
     }
   } else if (config->tls_auth_clients != TLS_AUTH_CLIENTS_NO) {
-    error("Either tls-ca-cert-file or tls-ca-cert-dir must be specified while tls-auth-clients is enabled");
+    ERROR("Either tls-ca-cert-file or tls-ca-cert-dir must be specified while tls-auth-clients is enabled");
     return nullptr;
   }
 
   if (SSL_CTX_use_certificate_chain_file(ssl_ctx.get(), config->tls_cert_file.c_str()) != 1) {
-    error("Failed to load SSL certificate file: {}", fmt::streamed(SSLErrors{}));
+    ERROR("Failed to load SSL certificate file: {}", fmt::streamed(SSLErrors{}));
     return nullptr;
   }
 
@@ -199,23 +200,23 @@ UniqueSSLContext CreateSSLContext(const Config *config, const SSL_METHOD *method
   }
 
   if (SSL_CTX_use_PrivateKey_file(ssl_ctx.get(), config->tls_key_file.c_str(), SSL_FILETYPE_PEM) != 1) {
-    error("Failed to load SSL private key file: {}", fmt::streamed(SSLErrors{}));
+    ERROR("Failed to load SSL private key file: {}", fmt::streamed(SSLErrors{}));
     return nullptr;
   }
 
   if (SSL_CTX_check_private_key(ssl_ctx.get()) != 1) {
-    error("Failed to check the loaded private key: {}", fmt::streamed(SSLErrors{}));
+    ERROR("Failed to check the loaded private key: {}", fmt::streamed(SSLErrors{}));
     return nullptr;
   }
 
   if (!config->tls_ciphers.empty() && !SSL_CTX_set_cipher_list(ssl_ctx.get(), config->tls_ciphers.c_str())) {
-    error("Failed to set SSL ciphers: {}", fmt::streamed(SSLErrors{}));
+    ERROR("Failed to set SSL ciphers: {}", fmt::streamed(SSLErrors{}));
     return nullptr;
   }
 
 #ifdef SSL_OP_NO_TLSv1_3
   if (!config->tls_ciphersuites.empty() && !SSL_CTX_set_ciphersuites(ssl_ctx.get(), config->tls_ciphersuites.c_str())) {
-    error("Failed to set SSL ciphersuites: {}", fmt::streamed(SSLErrors{}));
+    ERROR("Failed to set SSL ciphersuites: {}", fmt::streamed(SSLErrors{}));
     return nullptr;
   }
 #endif
diff --git a/src/server/worker.cc b/src/server/worker.cc
index dcba89c11..5078546e5 100644
--- a/src/server/worker.cc
+++ b/src/server/worker.cc
@@ -28,6 +28,7 @@
 #include <string>
 
 #include "event2/bufferevent.h"
+#include "fmt/ostream.h"
 #include "io_util.h"
 #include "logging.h"
 #include "scope_exit.h"
@@ -61,7 +62,7 @@ Worker::Worker(Server *srv, Config *config) : srv(srv), base_(event_base_new())
 
   if (config->socket_fd != -1) {
     if (const Status s = listenFD(config->socket_fd, config->port, config->backlog); !s.IsOK()) {
-      error("[worker] Failed to listen to socket with fd: {}, Error: {}", config->socket_fd, s.Msg());
+      ERROR("[worker] Failed to listen to socket with fd: {}, Error: {}", config->socket_fd, s.Msg());
       exit(1);
     }
   } else {
@@ -70,10 +71,10 @@ Worker::Worker(Server *srv, Config *config) : srv(srv), base_(event_base_new())
     for (const uint32_t *port = ports; *port; ++port) {
       for (const auto &bind : config->binds) {
         if (const Status s = listenTCP(bind, *port, config->backlog); !s.IsOK()) {
-          error("[worker] Failed to listen on: {}:{}, Error: {}", bind, *port, s.Msg());
+          ERROR("[worker] Failed to listen on: {}:{}, Error: {}", bind, *port, s.Msg());
           exit(1);
         }
-        info("[worker] Listening on: {}:{}", bind, *port);
+        INFO("[worker] Listening on: {}:{}", bind, *port);
       }
     }
   }
@@ -114,18 +115,18 @@ void Worker::TimerCB(int, [[maybe_unused]] int16_t events) {
 void Worker::newTCPConnection(evconnlistener *listener, evutil_socket_t fd, [[maybe_unused]] sockaddr *address,
                               [[maybe_unused]] int socklen) {
   int local_port = util::GetLocalPort(fd);  // NOLINT
-  debug("[worker] New connection: fd={} from port: {} thread #{}", fd, local_port, fmt::streamed(tid_));
+  DEBUG("[worker] New connection: fd={} from port: {} thread #{}", fd, local_port, fmt::streamed(tid_));
 
   auto s = util::SockSetTcpKeepalive(fd, 120);
   if (!s.IsOK()) {
-    error("[worker] Failed to set tcp-keepalive on socket. Error: {}", s.Msg());
+    ERROR("[worker] Failed to set tcp-keepalive on socket. Error: {}", s.Msg());
     evutil_closesocket(fd);
     return;
   }
 
   s = util::SockSetTcpNoDelay(fd, 1);
   if (!s.IsOK()) {
-    error("[worker] Failed to set tcp-nodelay on socket. Error: {}", s.Msg());
+    ERROR("[worker] Failed to set tcp-nodelay on socket. Error: {}", s.Msg());
     evutil_closesocket(fd);
     return;
   }
@@ -140,7 +141,7 @@ void Worker::newTCPConnection(evconnlistener *listener, evutil_socket_t fd, [[ma
   if (uint32_t(local_port) == srv->GetConfig()->tls_port) {
     ssl = SSL_new(srv->ssl_ctx.get());
     if (!ssl) {
-      error("[worker] Failed to construct SSL structure for new connection: {}", fmt::streamed(SSLErrors{}));
+      ERROR("[worker] Failed to construct SSL structure for new connection: {}", fmt::streamed(SSLErrors{}));
       evutil_closesocket(fd);
       return;
     }
@@ -154,11 +155,11 @@ void Worker::newTCPConnection(evconnlistener *listener, evutil_socket_t fd, [[ma
   if (!bev) {
     auto socket_err = evutil_socket_error_to_string(EVUTIL_SOCKET_ERROR());
 #ifdef ENABLE_OPENSSL
-    error("[worker] Failed to construct socket for new connection: {}, SSL error: {}", socket_err,
+    ERROR("[worker] Failed to construct socket for new connection: {}, SSL error: {}", socket_err,
           fmt::streamed(SSLErrors{}));
     if (ssl) SSL_free(ssl);
 #else
-    error("[worker] Failed to construct socket for new connection: {}", socket_err);
+    ERROR("[worker] Failed to construct socket for new connection: {}", socket_err);
 #endif
     evutil_closesocket(fd);
     return;
@@ -177,7 +178,7 @@ void Worker::newTCPConnection(evconnlistener *listener, evutil_socket_t fd, [[ma
     std::string err_msg = redis::Error({Status::NotOK, s.Msg()});
     s = util::SockSend(fd, err_msg, ssl);
     if (!s.IsOK()) {
-      warn("[worker] Failed to send error response to socket: {}", s.Msg());
+      WARN("[worker] Failed to send error response to socket: {}", s.Msg());
     }
     conn->Close();
     return;
@@ -195,7 +196,7 @@ void Worker::newTCPConnection(evconnlistener *listener, evutil_socket_t fd, [[ma
 
 void Worker::newUnixSocketConnection(evconnlistener *listener, evutil_socket_t fd, [[maybe_unused]] sockaddr *address,
                                      [[maybe_unused]] int socklen) {
-  debug("[worker] New connection: fd={} from unixsocket: {} thread #{}", fd, srv->GetConfig()->unixsocket,
+  DEBUG("[worker] New connection: fd={} from unixsocket: {} thread #{}", fd, srv->GetConfig()->unixsocket,
         fmt::streamed(tid_));
   event_base *base = evconnlistener_get_base(listener);
   auto ev_thread_safe_flags =
@@ -210,7 +211,7 @@ void Worker::newUnixSocketConnection(evconnlistener *listener, evutil_socket_t f
   if (!s.IsOK()) {
     s = util::SockSend(fd, redis::Error(s));
     if (!s.IsOK()) {
-      warn("[worker] Failed to send error response to socket: {}", s.Msg());
+      WARN("[worker] Failed to send error response to socket: {}", s.Msg());
     }
     conn->Close();
     return;
@@ -234,7 +235,7 @@ Status Worker::listenFD(int fd, uint32_t expected_port, int backlog) {
   evconnlistener *lev =
       NewEvconnlistener<&Worker::newTCPConnection>(base_, LEV_OPT_THREADSAFE | LEV_OPT_CLOSE_ON_FREE, backlog, dup_fd);
   listen_events_.emplace_back(lev);
-  info("[worker] Listening on dup'ed fd: {}", dup_fd);
+  INFO("[worker] Listening on dup'ed fd: {}", dup_fd);
   return Status::OK();
 }
 
@@ -314,7 +315,7 @@ Status Worker::ListenUnixSocket(const std::string &path, int perm, int backlog)
 void Worker::Run(std::thread::id tid) {
   tid_ = tid;
   if (event_base_dispatch(base_) != 0) {
-    error("[worker] Failed to run server, err: {}", strerror(errno));
+    ERROR("[worker] Failed to run server, err: {}", strerror(errno));
   }
   is_terminated_ = true;
 }
@@ -589,17 +590,17 @@ void WorkerThread::Start() {
   if (s) {
     t_ = std::move(*s);
   } else {
-    error("[worker] Failed to start worker thread, err: {}", s.Msg());
+    ERROR("[worker] Failed to start worker thread, err: {}", s.Msg());
     return;
   }
 
-  info("[worker] Thread #{} started", fmt::streamed(t_.get_id()));
+  INFO("[worker] Thread #{} started", fmt::streamed(t_.get_id()));
 }
 
 void WorkerThread::Stop(uint32_t wait_seconds) { worker_->Stop(wait_seconds); }
 
 void WorkerThread::Join() {
   if (auto s = util::ThreadJoin(t_); !s) {
-    warn("[worker] {}", s.Msg());
+    WARN("[worker] {}", s.Msg());
   }
 }
diff --git a/src/stats/log_collector.cc b/src/stats/log_collector.cc
index 74be9b118..9d622ce3a 100644
--- a/src/stats/log_collector.cc
+++ b/src/stats/log_collector.cc
@@ -50,7 +50,7 @@ void SlowEntry::DumpToLogFile(spdlog::level::level_enum level) const {
     }
     cmd.pop_back();
   }
-  log(level, "[slowlog] id: {}, timestamp: {}, duration: {}, cmd: {}, ip: {}, port: {}, client_name: {}", id, time,
+  LOG(level, "[slowlog] id: {}, timestamp: {}, duration: {}, cmd: {}, ip: {}, port: {}, client_name: {}", id, time,
       duration, cmd, ip, port, client_name);
 }
 
diff --git a/src/storage/batch_debugger.h b/src/storage/batch_debugger.h
index 4160c6159..6d96ee654 100644
--- a/src/storage/batch_debugger.h
+++ b/src/storage/batch_debugger.h
@@ -28,7 +28,7 @@
 /// ```
 /// WriteBatchInspector inspector;
 /// status = write_batch.Iterate(&inspector);
-/// info("{}, cnt: {}", inspector.seen, inspector.cnt);
+/// INFO("{}, cnt: {}", inspector.seen, inspector.cnt);
 /// ```
 struct WriteBatchInspector : public rocksdb::WriteBatch::Handler {
   std::string seen;
diff --git a/src/storage/batch_extractor.cc b/src/storage/batch_extractor.cc
index f0b633b3e..8dfd4258e 100644
--- a/src/storage/batch_extractor.cc
+++ b/src/storage/batch_extractor.cc
@@ -37,7 +37,7 @@ void WriteBatchExtractor::LogData(const rocksdb::Slice &blob) {
   } else {
     // Redis type log data
     if (auto s = log_data_.Decode(blob); !s.IsOK()) {
-      warn("Failed to decode Redis type log: {}", s.Msg());
+      WARN("Failed to decode Redis type log: {}", s.Msg());
     }
   }
 }
@@ -139,7 +139,7 @@ rocksdb::Status WriteBatchExtractor::PutCF(uint32_t column_family_id, const Slic
       case kRedisList: {
         auto args = log_data_.GetArguments();
         if (args->empty()) {
-          error("Failed to parse write_batch in PutCF. Type=List: no arguments, at least should contain a command");
+          ERROR("Failed to parse write_batch in PutCF. Type=List: no arguments, at least should contain a command");
           return rocksdb::Status::OK();
         }
 
@@ -153,7 +153,7 @@ rocksdb::Status WriteBatchExtractor::PutCF(uint32_t column_family_id, const Slic
         switch (cmd) {
           case kRedisCmdLSet:
             if (args->size() < 2) {
-              error(
+              ERROR(
                   "Failed to parse write_batch in PutCF. Command=LSET: no enough arguments, at least should contain an "
                   "index");
               return rocksdb::Status::OK();
@@ -164,7 +164,7 @@ rocksdb::Status WriteBatchExtractor::PutCF(uint32_t column_family_id, const Slic
           case kRedisCmdLInsert:
             if (first_seen_) {
               if (args->size() < 4) {
-                error(
+                ERROR(
                     "Failed to parse write_batch in PutCF. Command=LINSERT: no enough arguments, should contain before "
                     "pivot values");
                 return rocksdb::Status::OK();
@@ -187,7 +187,7 @@ rocksdb::Status WriteBatchExtractor::PutCF(uint32_t column_family_id, const Slic
             // LMOVE will be parsed in DeleteCF, so ignore it here
             break;
           default:
-            error("Failed to parse write_batch in PutCF. Type=List: unhandled command with code {}", *parse_result);
+            ERROR("Failed to parse write_batch in PutCF. Type=List: unhandled command with code {}", *parse_result);
         }
         break;
       }
@@ -202,7 +202,7 @@ rocksdb::Status WriteBatchExtractor::PutCF(uint32_t column_family_id, const Slic
       case kRedisBitmap: {
         auto args = log_data_.GetArguments();
         if (args->empty()) {
-          error("Failed to parse write_batch in PutCF. Type=Bitmap: no arguments, at least should contain a command");
+          ERROR("Failed to parse write_batch in PutCF. Type=Bitmap: no arguments, at least should contain a command");
           return rocksdb::Status::OK();
         }
 
@@ -216,7 +216,7 @@ rocksdb::Status WriteBatchExtractor::PutCF(uint32_t column_family_id, const Slic
         switch (cmd) {
           case kRedisCmdSetBit: {
             if (args->size() < 2) {
-              error(
+              ERROR(
                   "Failed to parse write_batch in PutCF. Command=SETBIT: no enough arguments, should contain an "
                   "offset");
               return rocksdb::Status::OK();
@@ -234,7 +234,7 @@ rocksdb::Status WriteBatchExtractor::PutCF(uint32_t column_family_id, const Slic
           case kRedisCmdBitOp:
             if (first_seen_) {
               if (args->size() < 4) {
-                error(
+                ERROR(
                     "Failed to parse write_batch in PutCF. Command=BITOP: no enough arguments, at least should contain "
                     "srckey");
                 return rocksdb::Status::OK();
@@ -250,7 +250,7 @@ rocksdb::Status WriteBatchExtractor::PutCF(uint32_t column_family_id, const Slic
             command_args.insert(command_args.end(), args->begin() + 1, args->end());
             break;
           default:
-            error("Failed to parse write_batch in PutCF. Type=Bitmap: unhandled command with code {}", *parsed_cmd);
+            ERROR("Failed to parse write_batch in PutCF. Type=Bitmap: unhandled command with code {}", *parsed_cmd);
             return rocksdb::Status::OK();
         }
         break;
@@ -268,7 +268,7 @@ rocksdb::Status WriteBatchExtractor::PutCF(uint32_t column_family_id, const Slic
   } else if (column_family_id == static_cast<uint32_t>(ColumnFamilyID::Stream)) {
     auto s = ExtractStreamAddCommand(is_slot_id_encoded_, key, value, &command_args);
     if (!s.IsOK()) {
-      error("Failed to parse write_batch in PutCF. Type=Stream: {}", s.Msg());
+      ERROR("Failed to parse write_batch in PutCF. Type=Stream: {}", s.Msg());
       return rocksdb::Status::OK();
     }
   }
@@ -322,7 +322,7 @@ rocksdb::Status WriteBatchExtractor::DeleteCF(uint32_t column_family_id, const S
       case kRedisList: {
         auto args = log_data_.GetArguments();
         if (args->empty()) {
-          error("Failed to parse write_batch in DeleteCF. Type=List: no arguments, at least should contain a command");
+          ERROR("Failed to parse write_batch in DeleteCF. Type=List: no arguments, at least should contain a command");
           return rocksdb::Status::OK();
         }
 
@@ -337,7 +337,7 @@ rocksdb::Status WriteBatchExtractor::DeleteCF(uint32_t column_family_id, const S
           case kRedisCmdLTrim:
             if (first_seen_) {
               if (args->size() < 3) {
-                error(
+                ERROR(
                     "Failed to parse write_batch in DeleteCF; Command=LTRIM: no enough arguments, should contain start "
                     "and stop");
                 return rocksdb::Status::OK();
@@ -350,7 +350,7 @@ rocksdb::Status WriteBatchExtractor::DeleteCF(uint32_t column_family_id, const S
           case kRedisCmdLRem:
             if (first_seen_) {
               if (args->size() < 3) {
-                error(
+                ERROR(
                     "Failed to parse write_batch in DeleteCF. Command=LREM: no enough arguments, should "
                     "contain count and value");
                 return rocksdb::Status::OK();
@@ -369,7 +369,7 @@ rocksdb::Status WriteBatchExtractor::DeleteCF(uint32_t column_family_id, const S
           case kRedisCmdLMove:
             if (first_seen_) {
               if (args->size() < 5) {
-                error(
+                ERROR(
                     "Failed to parse write_batch in DeleteCF; Command=LMOVE: no enough arguments, should "
                     "contain source, destination and where/from arguments");
                 return rocksdb::Status::OK();
@@ -379,7 +379,7 @@ rocksdb::Status WriteBatchExtractor::DeleteCF(uint32_t column_family_id, const S
             }
             break;
           default:
-            error("Failed to parse write_batch in DeleteCF. Type=List: unhandled command with code {}", *parse_result);
+            ERROR("Failed to parse write_batch in DeleteCF. Type=List: unhandled command with code {}", *parse_result);
         }
         break;
       }
diff --git a/src/storage/compact_filter.cc b/src/storage/compact_filter.cc
index a44de631a..946ebf66c 100644
--- a/src/storage/compact_filter.cc
+++ b/src/storage/compact_filter.cc
@@ -42,10 +42,10 @@ bool MetadataFilter::Filter([[maybe_unused]] int level, const Slice &key, const
   rocksdb::Status s = metadata.Decode(value);
   auto [ns, user_key] = ExtractNamespaceKey(key, stor_->IsSlotIdEncoded());
   if (!s.ok()) {
-    warn("[compact_filter/metadata] Failed to decode, namespace: {}, key: {}, err: {}", ns, user_key, s.ToString());
+    WARN("[compact_filter/metadata] Failed to decode, namespace: {}, key: {}, err: {}", ns, user_key, s.ToString());
     return false;
   }
-  debug("[compact_filter/metadata] namespace: {}, key: {}, result: {}", ns, user_key,
+  DEBUG("[compact_filter/metadata] namespace: {}, key: {}, result: {}", ns, user_key,
         (metadata.Expired() ? "deleted" : "reserved"));
   return metadata.Expired();
 }
@@ -106,7 +106,7 @@ rocksdb::CompactionFilter::Decision SubKeyFilter::FilterBlobByKey([[maybe_unused
     return rocksdb::CompactionFilter::Decision::kRemove;
   }
   if (!s.IsOK()) {
-    error("[compact_filter/subkey] Failed to get metadata, namespace: {}, key: {}, err: {}", ikey.GetNamespace(),
+    ERROR("[compact_filter/subkey] Failed to get metadata, namespace: {}, key: {}, err: {}", ikey.GetNamespace(),
           ikey.GetKey(), s.Msg());
     return rocksdb::CompactionFilter::Decision::kKeep;
   }
@@ -128,7 +128,7 @@ bool SubKeyFilter::Filter([[maybe_unused]] int level, const Slice &key, const Sl
     return true;
   }
   if (!s.IsOK()) {
-    error("[compact_filter/subkey] Failed to get metadata, namespace: {}, key: {}, err: {}", ikey.GetNamespace(),
+    ERROR("[compact_filter/subkey] Failed to get metadata, namespace: {}, key: {}, err: {}", ikey.GetNamespace(),
           ikey.GetKey(), s.Msg());
     return false;
   }
@@ -138,7 +138,7 @@ bool SubKeyFilter::Filter([[maybe_unused]] int level, const Slice &key, const Sl
     Slice input(cached_metadata_);
     auto s = ts_metadata.Decode(&input);
     if (!s.ok()) {
-      error("[compact_filter/subkey] Failed to decode timeseries metadata, namespace: {}, key: {}, err: {}",
+      ERROR("[compact_filter/subkey] Failed to decode timeseries metadata, namespace: {}, key: {}, err: {}",
             ikey.GetNamespace(), ikey.GetKey(), s.ToString());
       return false;
     }
@@ -147,7 +147,7 @@ bool SubKeyFilter::Filter([[maybe_unused]] int level, const Slice &key, const Sl
     bool expired = false;
     s = ts_db.IsTSSubKeyExpired(ts_metadata, key, value, expired);
     if (!s.ok()) {
-      error("[compact_filter/subkey] Failed to check if timeseries subkey is expired, namespace: {}, key: {}, err: {}",
+      ERROR("[compact_filter/subkey] Failed to check if timeseries subkey is expired, namespace: {}, key: {}, err: {}",
             ikey.GetNamespace(), ikey.GetKey(), s.ToString());
       return false;
     }
@@ -182,7 +182,7 @@ bool SearchFilter::Filter([[maybe_unused]] int level, const Slice &key, [[maybe_
     // metadata of this field is not found, so we can remove the field data
     return true;
   } else if (!s.ok()) {
-    error("[compact_filter/search] Failed to get field metadata, namespace: {}, index: {}, field: {}, err: {}", ns,
+    ERROR("[compact_filter/search] Failed to get field metadata, namespace: {}, index: {}, field: {}, err: {}", ns,
           index_name, field_name, s.ToString());
     return false;
   }
@@ -190,7 +190,7 @@ bool SearchFilter::Filter([[maybe_unused]] int level, const Slice &key, [[maybe_
   std::unique_ptr<redis::IndexFieldMetadata> field_meta;
   Slice field_meta_slice(field_meta_value);
   if (auto s = redis::IndexFieldMetadata::Decode(&field_meta_slice, field_meta); !s.ok()) {
-    error("[compact_filter/search] Failed to decode field metadata, namespace: {}, index: {}, field: {}, err: {}", ns,
+    ERROR("[compact_filter/search] Failed to decode field metadata, namespace: {}, index: {}, field: {}, err: {}", ns,
           index_name, field_name, s.ToString());
     return false;
   }
@@ -219,14 +219,14 @@ bool SearchFilter::Filter([[maybe_unused]] int level, const Slice &key, [[maybe_
     // metadata of this key is not found, so we can remove the field data
     return true;
   } else if (!s.ok()) {
-    error("[compact_filter/search] Failed to get metadata, namespace: {}, key: {}, err: {}", ns, user_key,
+    ERROR("[compact_filter/search] Failed to get metadata, namespace: {}, key: {}, err: {}", ns, user_key,
           s.ToString());
     return false;
   }
 
   Metadata metadata(kRedisNone, false);
   if (auto s = metadata.Decode(metadata_value); !s.ok()) {
-    error("[compact_filter/search] Failed to decode metadata, namespace: {}, key: {}, err: {}", ns, user_key,
+    ERROR("[compact_filter/search] Failed to decode metadata, namespace: {}, key: {}, err: {}", ns, user_key,
           s.ToString());
   }
 
@@ -257,13 +257,13 @@ bool IndexFilter::Filter([[maybe_unused]] int level, const Slice &key, [[maybe_u
     // metadata of this key is not found, so we can remove the index
     return true;
   } else if (!s.ok()) {
-    error("[compact_filter/index] Failed to get metadata, namespace: {}, key: {}, err: {}", ns, user_key, s.ToString());
+    ERROR("[compact_filter/index] Failed to get metadata, namespace: {}, key: {}, err: {}", ns, user_key, s.ToString());
     return false;
   }
 
   Metadata metadata(kRedisNone, false);
   if (auto s = metadata.Decode(metadata_value); !s.ok()) {
-    error("[compact_filter/index] Failed to decode metadata, namespace: {}, key: {}, err: {}", ns, user_key,
+    ERROR("[compact_filter/index] Failed to decode metadata, namespace: {}, key: {}, err: {}", ns, user_key,
           s.ToString());
   }
 
diff --git a/src/storage/compaction_checker.cc b/src/storage/compaction_checker.cc
index 7f62f2032..0e63cd10f 100644
--- a/src/storage/compaction_checker.cc
+++ b/src/storage/compaction_checker.cc
@@ -32,10 +32,10 @@ void CompactionChecker::CompactPropagateAndPubSubFiles() {
   compact_opts.change_level = !storage_->GetConfig()->rocks_db.level_compaction_dynamic_level_bytes;
   for (const auto &cf :
        {engine::ColumnFamilyConfigs::PubSubColumnFamily(), engine::ColumnFamilyConfigs::PropagateColumnFamily()}) {
-    info("[compaction checker] Start to compact the column family: {}", cf.Name());
+    INFO("[compaction checker] Start to compact the column family: {}", cf.Name());
     auto cf_handle = storage_->GetCFHandle(cf.Id());
     auto s = storage_->GetDB()->CompactRange(compact_opts, cf_handle, nullptr, nullptr);
-    info("[compaction checker] Compact the column family: {} finished, result: {}", cf.Name(), s.ToString());
+    INFO("[compaction checker] Compact the column family: {} finished, result: {}", cf.Name(), s.ToString());
   }
 }
 
@@ -44,7 +44,7 @@ void CompactionChecker::PickCompactionFilesForCf(const engine::ColumnFamilyConfi
   rocksdb::ColumnFamilyHandle *cf = storage_->GetCFHandle(column_family_config.Id());
   auto s = storage_->GetDB()->GetPropertiesOfAllTables(cf, &props);
   if (!s.ok()) {
-    warn("[compaction checker] Failed to get table properties, {}", s.ToString());
+    WARN("[compaction checker] Failed to get table properties, {}", s.ToString());
     return;
   }
   // The main goal of compaction was reclaimed the disk space and removed
@@ -75,7 +75,7 @@ void CompactionChecker::PickCompactionFilesForCf(const engine::ColumnFamilyConfi
       // file_creation_time is 0 which means the unknown condition in rocksdb
       s = rocksdb::Env::Default()->GetFileModificationTime(iter.first, &file_creation_time);
       if (!s.ok()) {
-        info("[compaction checker] Failed to get the file creation time: {}, err: {}", iter.first, s.ToString());
+        INFO("[compaction checker] Failed to get the file creation time: {}, err: {}", iter.first, s.ToString());
         continue;
       }
     }
@@ -84,7 +84,7 @@ void CompactionChecker::PickCompactionFilesForCf(const engine::ColumnFamilyConfi
       if (property_iter.first == "total_keys") {
         auto parse_result = ParseInt<int>(property_iter.second, 10);
         if (!parse_result) {
-          error("[compaction checker] Parse total_keys error: {}", parse_result.Msg());
+          ERROR("[compaction checker] Parse total_keys error: {}", parse_result.Msg());
           continue;
         }
         total_keys = *parse_result;
@@ -92,7 +92,7 @@ void CompactionChecker::PickCompactionFilesForCf(const engine::ColumnFamilyConfi
       if (property_iter.first == "deleted_keys") {
         auto parse_result = ParseInt<int>(property_iter.second, 10);
         if (!parse_result) {
-          error("[compaction checker] Parse deleted_keys error: {}", parse_result.Msg());
+          ERROR("[compaction checker] Parse deleted_keys error: {}", parse_result.Msg());
           continue;
         }
         deleted_keys = *parse_result;
@@ -111,9 +111,9 @@ void CompactionChecker::PickCompactionFilesForCf(const engine::ColumnFamilyConfi
     // pick the file according to force compact policy
     if (file_creation_time < static_cast<uint64_t>(now - force_compact_file_age) &&
         delete_ratio >= force_compact_min_ratio) {
-      info("[compaction checker] Going to compact the key in file (force compact policy): {}", iter.first);
+      INFO("[compaction checker] Going to compact the key in file (force compact policy): {}", iter.first);
       auto s = storage_->Compact(cf, &start_key, &stop_key);
-      info("[compaction checker] Compact the key in file (force compact policy): {} finished, result: {}", iter.first,
+      INFO("[compaction checker] Compact the key in file (force compact policy): {} finished, result: {}", iter.first,
            s.ToString());
       max_files_to_compact--;
       continue;
@@ -133,11 +133,11 @@ void CompactionChecker::PickCompactionFilesForCf(const engine::ColumnFamilyConfi
     }
   }
   if (best_delete_ratio > 0.1 && !best_start_key.empty() && !best_stop_key.empty()) {
-    info("[compaction checker] Going to compact the key in file: {}, delete ratio: {}", best_filename,
+    INFO("[compaction checker] Going to compact the key in file: {}, delete ratio: {}", best_filename,
          best_delete_ratio);
     auto s = storage_->Compact(cf, &best_start_key, &best_stop_key);
     if (!s.ok()) {
-      error("[compaction checker] Failed to do compaction: {}", s.ToString());
+      ERROR("[compaction checker] Failed to do compaction: {}", s.ToString());
     }
   }
 }
diff --git a/src/storage/event_listener.cc b/src/storage/event_listener.cc
index 55d8843f3..df764509f 100644
--- a/src/storage/event_listener.cc
+++ b/src/storage/event_listener.cc
@@ -88,7 +88,7 @@ bool IsDiskQuotaExceeded(const rocksdb::Status &bg_error) {
 }
 
 void EventListener::OnCompactionBegin([[maybe_unused]] rocksdb::DB *db, const rocksdb::CompactionJobInfo &ci) {
-  info(
+  INFO(
       "[event_listener/compaction_begin] column family: {}, job_id: {}, compaction reason: {}, output compression "
       "type: {}, base input level(files): {}({}), output level(files): {}({}), input bytes: {}, output bytes: {}, "
       "is_manual_compaction: {}",
@@ -99,7 +99,7 @@ void EventListener::OnCompactionBegin([[maybe_unused]] rocksdb::DB *db, const ro
 }
 
 void EventListener::OnCompactionCompleted([[maybe_unused]] rocksdb::DB *db, const rocksdb::CompactionJobInfo &ci) {
-  info(
+  INFO(
       "[event_listener/compaction_completed] column family: {}, job_id: {}, compaction reason: {}, output compression "
       "type: {}, base input level(files): {}({}), output level(files): {}({}), input bytes: {}, output bytes: {}, "
       "is_manual_compaction: {}, elapsed(micro): {}",
@@ -112,7 +112,7 @@ void EventListener::OnCompactionCompleted([[maybe_unused]] rocksdb::DB *db, cons
 }
 
 void EventListener::OnSubcompactionBegin(const rocksdb::SubcompactionJobInfo &si) {
-  info(
+  INFO(
       "[event_listener/subcompaction_begin] column family: {}, job_id: {}, compaction reason: {}, output compression "
       "type: {}",
       si.cf_name, si.job_id, rocksdb::GetCompactionReasonString(si.compaction_reason),
@@ -120,7 +120,7 @@ void EventListener::OnSubcompactionBegin(const rocksdb::SubcompactionJobInfo &si
 }
 
 void EventListener::OnSubcompactionCompleted(const rocksdb::SubcompactionJobInfo &si) {
-  info(
+  INFO(
       "[event_listener/subcompaction_completed] column family: {}, job_id: {}, compaction reason: {}, output "
       "compression type: {}, base input level(files): {}, output level(files): {}, input bytes: {}, output bytes: {}, "
       "is_manual_compaction: {}, elapsed(micro): {}",
@@ -130,14 +130,14 @@ void EventListener::OnSubcompactionCompleted(const rocksdb::SubcompactionJobInfo
 }
 
 void EventListener::OnFlushBegin([[maybe_unused]] rocksdb::DB *db, const rocksdb::FlushJobInfo &fi) {
-  info("[event_listener/flush_begin] column family: {}, thread_id: {}, job_id: {}, reason: {}", fi.cf_name,
+  INFO("[event_listener/flush_begin] column family: {}, thread_id: {}, job_id: {}, reason: {}", fi.cf_name,
        fi.thread_id, fi.job_id, rocksdb::GetFlushReasonString(fi.flush_reason));
 }
 
 void EventListener::OnFlushCompleted([[maybe_unused]] rocksdb::DB *db, const rocksdb::FlushJobInfo &fi) {
   storage_->RecordStat(engine::StatType::FlushCount, 1);
   storage_->CheckDBSizeLimit();
-  info(
+  INFO(
       "[event_listener/flush_completed] column family: {}, thread_id: {}, job_id: {}, file: {}, reason: {}, "
       "is_write_slowdown: {}, is_write_stall: {}, largest seqno: {}, smallest seqno: {}",
       fi.cf_name, fi.thread_id, fi.job_id, fi.file_path, rocksdb::GetFlushReasonString(fi.flush_reason),
@@ -160,7 +160,7 @@ void EventListener::OnBackgroundError(rocksdb::BackgroundErrorReason reason, roc
       auto s = storage_->GetDB()->GetLiveFiles(live_files, &manifest_size, false /* flush_memtable */);
       if (s.ok() && std::find(live_files.begin(), live_files.end(), corrupt_sst) == live_files.end()) {
         *bg_error = rocksdb::Status::OK();
-        warn(
+        WARN(
             "[event_listener/background_error] ignore no-fatal background error about sst file, reason: {}, bg_error: "
             "{}",
             reason_str, error_str);
@@ -174,16 +174,16 @@ void EventListener::OnBackgroundError(rocksdb::BackgroundErrorReason reason, roc
     storage_->SetDBInRetryableIOError(true);
   }
 
-  error("[event_listener/background_error] reason: {}, bg_error: {}", reason_str, error_str);
+  ERROR("[event_listener/background_error] reason: {}, bg_error: {}", reason_str, error_str);
 }
 
 void EventListener::OnStallConditionsChanged(const rocksdb::WriteStallInfo &info) {
-  warn("[event_listener/stall_cond_changed] column family: {} write stall condition was changed, from {} to {}",
+  WARN("[event_listener/stall_cond_changed] column family: {} write stall condition was changed, from {} to {}",
        info.cf_name, StallConditionType2String(info.condition.prev), StallConditionType2String(info.condition.cur));
 }
 
 void EventListener::OnTableFileCreated(const rocksdb::TableFileCreationInfo &table_info) {
-  info(
+  INFO(
       "[event_listener/table_file_created] column family: {}, file path: {}, file size: {}, job_id: {}, reason: {}, "
       "status: {}",
       table_info.cf_name, table_info.file_path, table_info.file_size, table_info.job_id,
@@ -191,12 +191,12 @@ void EventListener::OnTableFileCreated(const rocksdb::TableFileCreationInfo &tab
 }
 
 void EventListener::OnTableFileDeleted(const rocksdb::TableFileDeletionInfo &table_info) {
-  info("[event_listener/table_file_deleted] db: {}, sst file: {}, status: {}", table_info.db_name, table_info.file_path,
+  INFO("[event_listener/table_file_deleted] db: {}, sst file: {}, status: {}", table_info.db_name, table_info.file_path,
        table_info.status.ToString());
 }
 
 void EventListener::OnBlobFileCreated(const rocksdb::BlobFileCreationInfo &blob_info) {
-  info(
+  INFO(
       "[event_listener/blob_file_created] column family: {}, file path: {}, blob count: {}, blob bytes: {}, job_id: {}"
       ", reason: {}, status: {}",
       blob_info.cf_name, blob_info.file_path, blob_info.total_blob_count, blob_info.total_blob_bytes, blob_info.job_id,
@@ -204,6 +204,6 @@ void EventListener::OnBlobFileCreated(const rocksdb::BlobFileCreationInfo &blob_
 }
 
 void EventListener::OnBlobFileDeleted(const rocksdb::BlobFileDeletionInfo &blob_info) {
-  info("[event_listener/blob_file_deleted] db: {}, blob file: {}, status: {}", blob_info.db_name, blob_info.file_path,
+  INFO("[event_listener/blob_file_deleted] db: {}, blob file: {}, status: {}", blob_info.db_name, blob_info.file_path,
        blob_info.status.ToString());
 }
diff --git a/src/storage/rdb/rdb.cc b/src/storage/rdb/rdb.cc
index 78c52b0b6..1f646bd75 100644
--- a/src/storage/rdb/rdb.cc
+++ b/src/storage/rdb/rdb.cc
@@ -75,8 +75,8 @@ constexpr const int MinRdbVersionToVerifyChecksum = 5;
 template <typename T>
 T LogWhenError(T &&s) {
   if (!s) {
-    warn("Short read or unsupported type loading DB. Unrecoverable error, aborting now.");
-    error("Unexpected EOF reading RDB file");
+    WARN("Short read or unsupported type loading DB. Unrecoverable error, aborting now.");
+    ERROR("Unexpected EOF reading RDB file");
   }
   return std::forward<T>(s);
 }
@@ -560,13 +560,13 @@ Status RDB::LoadRdb(engine::Context &ctx, uint32_t db_index, bool overwrite_exis
   buf[9] = '\0';
 
   if (memcmp(buf, "REDIS", 5) != 0) {
-    warn("Wrong signature trying to load DB from file");
+    WARN("Wrong signature trying to load DB from file");
     return {Status::NotOK, "Wrong signature trying to load DB from file"};
   }
 
   auto rdb_ver = std::atoi(buf + 5);
   if (rdb_ver < 1 || rdb_ver > SupportedRDBVersion) {
-    warn("Can't handle RDB format version {}", rdb_ver);
+    WARN("Can't handle RDB format version {}", rdb_ver);
     return {Status::NotOK, fmt::format("Can't handle RDB format version {}", rdb_ver)};
   }
 
@@ -611,14 +611,14 @@ Status RDB::LoadRdb(engine::Context &ctx, uint32_t db_index, bool overwrite_exis
       auto value = GET_OR_RET(LogWhenError(LoadStringObject()));
       continue;
     } else if (type == RDBOpcodeModuleAux) {
-      warn("RDB module not supported");
+      WARN("RDB module not supported");
       return {Status::NotOK, "RDB module not supported"};
     } else if (type == RDBOpcodeFunction || type == RDBOpcodeFunction2) {
-      warn("RDB function not supported");
+      WARN("RDB function not supported");
       return {Status::NotOK, "RDB function not supported"};
     } else {
       if (!isObjectType(type)) {
-        warn("Invalid or Not supported object type: {}", (int)type);
+        WARN("Invalid or Not supported object type: {}", (int)type);
         return {Status::NotOK, fmt::format("Invalid or Not supported object type {}", type)};
       }
     }
@@ -636,7 +636,7 @@ Status RDB::LoadRdb(engine::Context &ctx, uint32_t db_index, bool overwrite_exis
        * in an RDB file, instead we will silently discard it and
        * continue loading. */
       if (empty_keys_skipped++ < 10) {  // only log 10 empty keys, just as redis does.
-        warn("skipping empty key: {}", key);
+        WARN("skipping empty key: {}", key);
       }
       continue;
     } else if (expire_time_ms != 0 &&
@@ -651,7 +651,7 @@ Status RDB::LoadRdb(engine::Context &ctx, uint32_t db_index, bool overwrite_exis
       if (!s.IsNotFound()) {
         skip_exist_keys++;  // skip it even it's not okay
         if (!s.ok()) {
-          error("check key {} exist failed: {}", key, s.ToString());
+          ERROR("check key {} exist failed: {}", key, s.ToString());
         }
         continue;
       }
@@ -659,7 +659,7 @@ Status RDB::LoadRdb(engine::Context &ctx, uint32_t db_index, bool overwrite_exis
 
     auto ret = saveRdbObject(ctx, type, key, value, expire_time_ms);
     if (!ret.IsOK()) {
-      warn("save rdb object key {} failed: {}", key, ret.Msg());
+      WARN("save rdb object key {} failed: {}", key, ret.Msg());
     } else {
       load_keys++;
     }
@@ -671,16 +671,16 @@ Status RDB::LoadRdb(engine::Context &ctx, uint32_t db_index, bool overwrite_exis
     auto expected = GET_OR_RET(LogWhenError(stream_->GetCheckSum()));
     GET_OR_RET(LogWhenError(stream_->Read(reinterpret_cast<char *>(&chk_sum), RDBCheckSumLen)));
     if (chk_sum == 0) {
-      warn("RDB file was saved with checksum disabled: no check performed.");
+      WARN("RDB file was saved with checksum disabled: no check performed.");
     } else if (chk_sum != expected) {
-      warn("Wrong RDB checksum expected: {} got: {}", chk_sum, expected);
+      WARN("Wrong RDB checksum expected: {} got: {}", chk_sum, expected);
       return {Status::NotOK, "All objects were processed and loaded but the checksum is unexpected!"};
     }
   }
 
   std::string skip_info = (overwrite_exist_key ? ", exist keys skipped: " + std::to_string(skip_exist_keys) : "");
 
-  info("Done loading RDB, keys loaded: {}, keys expired: {}, empty keys skipped: {}{}", load_keys, expire_keys,
+  INFO("Done loading RDB, keys loaded: {}, keys expired: {}, empty keys skipped: {}{}", load_keys, expire_keys,
        empty_keys_skipped, skip_info);
 
   return Status::OK();
@@ -731,7 +731,7 @@ Status RDB::SaveObjectType(const RedisType type) {
   } else if (type == kRedisZSet) {
     robj_type = RDBTypeZSet2;
   } else {
-    warn("Invalid or Not supported object type: {}", (int)type);
+    WARN("Invalid or Not supported object type: {}", (int)type);
     return {Status::NotOK, "Invalid or Not supported object type"};
   }
   return stream_->Write((const char *)(&robj_type), 1);
@@ -794,7 +794,7 @@ Status RDB::SaveObject(const std::string &key, const RedisType type) {
     }
     return SaveStringObject(value);
   } else {
-    warn("Invalid or Not supported object type: {}", (int)type);
+    WARN("Invalid or Not supported object type: {}", (int)type);
     return {Status::NotOK, "Invalid or Not supported object type"};
   }
 }
@@ -871,7 +871,7 @@ Status RDB::SaveListObject(const std::vector<std::string> &elems) {
       if (!status.IsOK()) return status;
     }
   } else {
-    warn("the size of elems is zero");
+    WARN("the size of elems is zero");
     return {Status::NotOK, "the size of elems is zero"};
   }
   return Status::OK();
@@ -887,7 +887,7 @@ Status RDB::SaveSetObject(const std::vector<std::string> &members) {
       if (!status.IsOK()) return status;
     }
   } else {
-    warn("the size of elems is zero");
+    WARN("the size of elems is zero");
     return {Status::NotOK, "the size of elems is zero"};
   }
   return Status::OK();
@@ -906,7 +906,7 @@ Status RDB::SaveZSetObject(const std::vector<MemberScore> &member_scores) {
       if (!status.IsOK()) return status;
     }
   } else {
-    warn("the size of member_scores is zero");
+    WARN("the size of member_scores is zero");
     return {Status::NotOK, "the size of ZSet is 0"};
   }
   return Status::OK();
@@ -925,7 +925,7 @@ Status RDB::SaveHashObject(const std::vector<FieldValue> &field_values) {
       if (!status.IsOK()) return status;
     }
   } else {
-    warn("the size of field_values is zero");
+    WARN("the size of field_values is zero");
     return {Status::NotOK, "the size of Hash is 0"};
   }
   return Status::OK();
diff --git a/src/storage/scripting.cc b/src/storage/scripting.cc
index c8ddfc667..d1175b04e 100644
--- a/src/storage/scripting.cc
+++ b/src/storage/scripting.cc
@@ -209,10 +209,10 @@ int RedisLogCommand(lua_State *lua) {
   switch (level) {
     case LL_VERBOSE:  // also regard VERBOSE as INFO here since no VERBOSE level
     case LL_NOTICE:
-      info("[Lua] {}", log_message);
+      INFO("[Lua] {}", log_message);
       break;
     case LL_WARNING:
-      warn("[Lua] {}", log_message);
+      WARN("[Lua] {}", log_message);
       break;
   }
   return 0;
diff --git a/src/storage/storage.cc b/src/storage/storage.cc
index aa4dbb1a1..7799e089e 100644
--- a/src/storage/storage.cc
+++ b/src/storage/storage.cc
@@ -395,22 +395,22 @@ Status Storage::Open(DBOpenMode mode) {
       break;
     }
     default:
-      unreachable();
+      UNREACHABLE();
   }
   auto end = std::chrono::high_resolution_clock::now();
   int64_t duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
 
   if (!db_) {
-    info("[storage] Failed to load the data from disk: {} ms", duration);
+    INFO("[storage] Failed to load the data from disk: {} ms", duration);
     return {Status::DBOpenErr};
   }
-  info("[storage] Success to load the data from disk: {} ms", duration);
+  INFO("[storage] Success to load the data from disk: {} ms", duration);
 
   return Status::OK();
 }
 
 Status Storage::CreateBackup(uint64_t *sequence_number) {
-  info("[storage] Start to create new backup");
+  INFO("[storage] Start to create new backup");
   std::lock_guard<std::mutex> lg(config_->backup_mu);
   std::string task_backup_dir = config_->backup_dir;
 
@@ -422,28 +422,28 @@ Status Storage::CreateBackup(uint64_t *sequence_number) {
   rocksdb::Checkpoint *checkpoint = nullptr;
   rocksdb::Status s = rocksdb::Checkpoint::Create(db_.get(), &checkpoint);
   if (!s.ok()) {
-    warn("Failed to create checkpoint object for backup. Error: {}", s.ToString());
+    WARN("Failed to create checkpoint object for backup. Error: {}", s.ToString());
     return {Status::NotOK, s.ToString()};
   }
 
   std::unique_ptr<rocksdb::Checkpoint> checkpoint_guard(checkpoint);
   s = checkpoint->CreateCheckpoint(tmpdir, config_->rocks_db.write_buffer_size * MiB, sequence_number);
   if (!s.ok()) {
-    warn("Failed to create checkpoint (snapshot) for backup. Error: {}", s.ToString());
+    WARN("Failed to create checkpoint (snapshot) for backup. Error: {}", s.ToString());
     return {Status::DBBackupErr, s.ToString()};
   }
 
   // 2) Rename tmp backup to real backup dir
   if (s = rocksdb::DestroyDB(task_backup_dir, rocksdb::Options()); !s.ok()) {
-    warn("[storage] Failed to clean old backup. Error: {}", s.ToString());
+    WARN("[storage] Failed to clean old backup. Error: {}", s.ToString());
     return {Status::NotOK, s.ToString()};
   }
 
   if (s = env_->RenameFile(tmpdir, task_backup_dir); !s.ok()) {
-    warn("[storage] Failed to rename tmp backup. Error: {}", s.ToString());
+    WARN("[storage] Failed to rename tmp backup. Error: {}", s.ToString());
     // Just try best effort
     if (s = rocksdb::DestroyDB(tmpdir, rocksdb::Options()); !s.ok()) {
-      warn("[storage] Failed to clean tmp backup. Error: {}", s.ToString());
+      WARN("[storage] Failed to clean tmp backup. Error: {}", s.ToString());
     }
 
     return {Status::NotOK, s.ToString()};
@@ -452,7 +452,7 @@ Status Storage::CreateBackup(uint64_t *sequence_number) {
   // 'backup_mu_' can guarantee 'backup_creating_time_secs_' is thread-safe
   backup_creating_time_secs_ = util::GetTimeStamp<std::chrono::seconds>();
 
-  info("[storage] Success to create new backup");
+  INFO("[storage] Success to create new backup");
   return Status::OK();
 }
 
@@ -475,15 +475,15 @@ Status Storage::RestoreFromBackup() {
 
   auto s = backup_->RestoreDBFromLatestBackup(config_->db_dir, config_->db_dir);
   if (!s.ok()) {
-    error("[storage] Failed to restore database from the latest backup. Error: {}", s.ToString());
+    ERROR("[storage] Failed to restore database from the latest backup. Error: {}", s.ToString());
   } else {
-    info("[storage] Database was restored from the latest backup");
+    INFO("[storage] Database was restored from the latest backup");
   }
 
   // Reopen DB (should always try to reopen db even if restore failed, replication SST file CRC check may use it)
   auto s2 = Open();
   if (!s2.IsOK()) {
-    error("[storage] Failed to reopen the database. Error: {}", s2.Msg());
+    ERROR("[storage] Failed to reopen the database. Error: {}", s2.Msg());
     return {Status::DBOpenErr, s2.Msg()};
   }
 
@@ -515,7 +515,7 @@ Status Storage::RestoreFromCheckpoint() {
   s = env_->RenameFile(config_->db_dir, tmp_dir);
   if (!s.ok()) {
     if (auto s1 = Open(); !s1.IsOK()) {
-      error("[storage] Failed to reopen database. Error: {}", s1.Msg());
+      ERROR("[storage] Failed to reopen database. Error: {}", s1.Msg());
     }
     return {Status::NotOK, fmt::format("Failed to rename database directory '{}' to '{}'. Error: {}", config_->db_dir,
                                        tmp_dir, s.ToString())};
@@ -525,7 +525,7 @@ Status Storage::RestoreFromCheckpoint() {
   if (s = env_->RenameFile(checkpoint_dir, config_->db_dir); !s.ok()) {
     env_->RenameFile(tmp_dir, config_->db_dir);
     if (auto s1 = Open(); !s1.IsOK()) {
-      error("[storage] Failed to reopen database. Error: {}", s1.Msg());
+      ERROR("[storage] Failed to reopen database. Error: {}", s1.Msg());
     }
     return {Status::NotOK, fmt::format("Failed to rename checkpoint directory '{}' to '{}'. Error: {}", checkpoint_dir,
                                        config_->db_dir, s.ToString())};
@@ -534,18 +534,18 @@ Status Storage::RestoreFromCheckpoint() {
   // Open the new database, restore if replica fails to open
   auto s2 = Open();
   if (!s2.IsOK()) {
-    warn("[storage] Failed to open master checkpoint. Error: {}", s2.Msg());
+    WARN("[storage] Failed to open master checkpoint. Error: {}", s2.Msg());
     rocksdb::DestroyDB(config_->db_dir, rocksdb::Options());
     env_->RenameFile(tmp_dir, config_->db_dir);
     if (auto s1 = Open(); !s1.IsOK()) {
-      error("[storage] Failed to reopen database. Error: {}", s1.Msg());
+      ERROR("[storage] Failed to reopen database. Error: {}", s1.Msg());
     }
     return {Status::DBOpenErr, "Failed to open master checkpoint. Error: " + s2.Msg()};
   }
 
   // Destroy the origin database
   if (s = rocksdb::DestroyDB(tmp_dir, rocksdb::Options()); !s.ok()) {
-    warn("[storage] Failed to destroy the origin database at '{}'. Error: {}", tmp_dir, s.ToString());
+    WARN("[storage] Failed to destroy the origin database at '{}'. Error: {}", tmp_dir, s.ToString());
   }
   return Status::OK();
 }
@@ -570,7 +570,7 @@ void Storage::EmptyDB() {
 
   auto s = rocksdb::DestroyDB(config_->db_dir, rocksdb::Options());
   if (!s.ok()) {
-    error("[storage] Failed to destroy database. Error: {}", s.ToString());
+    ERROR("[storage] Failed to destroy database. Error: {}", s.ToString());
   }
 }
 
@@ -589,9 +589,9 @@ void Storage::PurgeOldBackups(uint32_t num_backups_to_keep, uint32_t backup_max_
   if (num_backups_to_keep == 0 || backup_expired) {
     s = rocksdb::DestroyDB(task_backup_dir, rocksdb::Options());
     if (s.ok()) {
-      info("[storage] Succeeded cleaning old backup that was created at {}", backup_creating_time_secs_);
+      INFO("[storage] Succeeded cleaning old backup that was created at {}", backup_creating_time_secs_);
     } else {
-      info("[storage] Failed cleaning old backup that was created at {}. Error: {}", backup_creating_time_secs_,
+      INFO("[storage] Failed cleaning old backup that was created at {}. Error: {}", backup_creating_time_secs_,
            s.ToString());
     }
   }
@@ -798,7 +798,7 @@ StatusOr<int> Storage::IngestSST(const std::string &sst_dir, const rocksdb::Inge
 
   sst_files = std::move(filtered_files);
   if (sst_files.empty()) {
-    warn("No SST files found in {}", sst_dir);
+    WARN("No SST files found in {}", sst_dir);
     return 0;
   }
 
@@ -963,9 +963,9 @@ void Storage::CheckDBSizeLimit() {
 
   db_size_limit_reached_ = limit_reached;
   if (db_size_limit_reached_) {
-    warn("[storage] ENABLE db_size limit {} GB. Switch kvrocks to read-only mode.", config_->max_db_size);
+    WARN("[storage] ENABLE db_size limit {} GB. Switch kvrocks to read-only mode.", config_->max_db_size);
   } else {
-    warn("[storage] DISABLE db_size limit. Switch kvrocks to read-write mode.");
+    WARN("[storage] DISABLE db_size limit. Switch kvrocks to read-write mode.");
   }
 }
 
@@ -1045,7 +1045,7 @@ Status Storage::ShiftReplId(engine::Context &ctx) {
     rand_str[i] = charset[distrib(gen)];
   }
   replid_ = std::move(rand_str);
-  info("[replication] New replication id: {}", replid_);
+  INFO("[replication] New replication id: {}", replid_);
 
   // Write new replication id into db engine
   return WriteToPropagateCF(ctx, kReplicationIdKey, replid_);
@@ -1122,7 +1122,7 @@ Status Storage::ReplDataManager::GetFullReplDataInfo(Storage *storage, std::stri
     rocksdb::Checkpoint *checkpoint = nullptr;
     rocksdb::Status s = rocksdb::Checkpoint::Create(storage->db_.get(), &checkpoint);
     if (!s.ok()) {
-      warn("Failed to create checkpoint object. Error: {}", s.ToString());
+      WARN("Failed to create checkpoint object. Error: {}", s.ToString());
       return {Status::NotOK, s.ToString()};
     }
 
@@ -1137,10 +1137,10 @@ Status Storage::ReplDataManager::GetFullReplDataInfo(Storage *storage, std::stri
     storage->checkpoint_info_.access_time_secs = now_secs;
     storage->checkpoint_info_.latest_seq = checkpoint_latest_seq;
     if (!s.ok()) {
-      warn("[storage] Failed to create checkpoint (snapshot). Error: {}", s.ToString());
+      WARN("[storage] Failed to create checkpoint (snapshot). Error: {}", s.ToString());
       return {Status::NotOK, s.ToString()};
     }
-    info("[storage] Create checkpoint successfully");
+    INFO("[storage] Create checkpoint successfully");
   } else {
     // Replicas can share checkpoint to replication if the checkpoint existing time is less than a half of WAL TTL.
     int64_t can_shared_time_secs = storage->config_->rocks_db.wal_ttl_seconds / 2;
@@ -1149,7 +1149,7 @@ Status Storage::ReplDataManager::GetFullReplDataInfo(Storage *storage, std::stri
 
     auto now_secs = util::GetTimeStamp<std::chrono::seconds>();
     if (now_secs - storage->GetCheckpointCreateTimeSecs() > can_shared_time_secs) {
-      warn("[storage] Can't use current checkpoint, waiting next checkpoint");
+      WARN("[storage] Can't use current checkpoint, waiting next checkpoint");
       return {Status::NotOK, "Can't use current checkpoint, waiting for next checkpoint"};
     }
 
@@ -1157,10 +1157,10 @@ Status Storage::ReplDataManager::GetFullReplDataInfo(Storage *storage, std::stri
     // or the slave will fall into the full sync loop since it won't create new checkpoint.
     auto s = storage->InWALBoundary(storage->checkpoint_info_.latest_seq);
     if (!s.IsOK()) {
-      warn("[storage] Can't use current checkpoint, error: {}", s.Msg());
+      WARN("[storage] Can't use current checkpoint, error: {}", s.Msg());
       return {Status::NotOK, fmt::format("Can't use current checkpoint, error: {}", s.Msg())};
     }
-    info("[storage] Using current existing checkpoint");
+    INFO("[storage] Using current existing checkpoint");
   }
 
   ulm.unlock();
@@ -1169,7 +1169,7 @@ Status Storage::ReplDataManager::GetFullReplDataInfo(Storage *storage, std::stri
   std::vector<std::string> result;
   auto s = storage->env_->GetChildren(data_files_dir, &result);
   if (!s.ok()) {
-    warn("[storage] Failed to list checkpoint files. Error: {}", s.ToString());
+    WARN("[storage] Failed to list checkpoint files. Error: {}", s.ToString());
     return {Status::NotOK, s.ToString()};
   }
   for (const auto &f : result) {
@@ -1228,9 +1228,9 @@ Status Storage::ReplDataManager::CleanInvalidFiles(Storage *storage, const std::
     auto s = storage->env_->DeleteFile(dir + "/" + *it);
     if (!s.ok()) {
       ret = Status(Status::NotOK, s.ToString());
-      info("[storage] Failed to delete invalid file {} of master checkpoint", *it);
+      INFO("[storage] Failed to delete invalid file {} of master checkpoint", *it);
     } else {
-      info("[storage] Succeed deleting invalid file {} of master checkpoint", *it);
+      INFO("[storage] Succeed deleting invalid file {} of master checkpoint", *it);
     }
   }
   return ret;
@@ -1240,14 +1240,14 @@ int Storage::ReplDataManager::OpenDataFile(Storage *storage, const std::string &
   std::string abs_path = storage->config_->checkpoint_dir + "/" + repl_file;
   auto s = storage->env_->FileExists(abs_path);
   if (!s.ok()) {
-    error("[storage] Data file [{}] not found", abs_path);
+    ERROR("[storage] Data file [{}] not found", abs_path);
     return NullFD;
   }
 
   storage->env_->GetFileSize(abs_path, file_size);
   auto rv = open(abs_path.c_str(), O_RDONLY);
   if (rv < 0) {
-    error("[storage] Failed to open file: {}", strerror(errno));
+    ERROR("[storage] Failed to open file: {}", strerror(errno));
   }
 
   return rv;
@@ -1256,7 +1256,7 @@ int Storage::ReplDataManager::OpenDataFile(Storage *storage, const std::string &
 Status Storage::ReplDataManager::ParseMetaAndSave(Storage *storage, rocksdb::BackupID meta_id, evbuffer *evbuf,
                                                   Storage::ReplDataManager::MetaInfo *meta) {
   auto meta_file = "meta/" + std::to_string(meta_id);
-  debug("[meta] id: {}", meta_id);
+  DEBUG("[meta] id: {}", meta_id);
 
   // Save the meta to tmp file
   auto wf = NewTmpFile(storage, storage->config_->backup_sync_dir, meta_file);
@@ -1266,27 +1266,27 @@ Status Storage::ReplDataManager::ParseMetaAndSave(Storage *storage, rocksdb::Bac
 
   // timestamp;
   UniqueEvbufReadln line(evbuf, EVBUFFER_EOL_LF);
-  debug("[meta] timestamp: {}", line.get());
+  DEBUG("[meta] timestamp: {}", line.get());
   meta->timestamp = std::strtoll(line.get(), nullptr, 10);
   // sequence
   line = UniqueEvbufReadln(evbuf, EVBUFFER_EOL_LF);
-  debug("[meta] seq: {}", line.get());
+  DEBUG("[meta] seq: {}", line.get());
   meta->seq = std::strtoull(line.get(), nullptr, 10);
   // optional metadata
   line = UniqueEvbufReadln(evbuf, EVBUFFER_EOL_LF);
   if (strncmp(line.get(), "metadata", 8) == 0) {
-    debug("[meta] meta: {}", line.get());
+    DEBUG("[meta] meta: {}", line.get());
     meta->meta_data = std::string(line.get(), line.length);
     line = UniqueEvbufReadln(evbuf, EVBUFFER_EOL_LF);
   }
-  debug("[meta] file count: {}", line.get());
+  DEBUG("[meta] file count: {}", line.get());
   // file list
   while (true) {
     line = UniqueEvbufReadln(evbuf, EVBUFFER_EOL_LF);
     if (!line) {
       break;
     }
-    debug("[meta] file info: {}", line.get());
+    DEBUG("[meta] file info: {}", line.get());
     auto cptr = line.get();
     while (*(cptr++) != ' ') {
     }
@@ -1309,7 +1309,7 @@ Status MkdirRecursively(rocksdb::Env *env, const std::string &dir) {
   for (auto pos = dir.find('/', 1); pos != std::string::npos; pos = dir.find('/', pos + 1)) {
     parent = dir.substr(0, pos);
     if (auto s = env->CreateDirIfMissing(parent); !s.ok()) {
-      error("[storage] Failed to create directory '{}' recursively. Error: {}", parent, s.ToString());
+      ERROR("[storage] Failed to create directory '{}' recursively. Error: {}", parent, s.ToString());
       return {Status::NotOK};
     }
   }
@@ -1324,7 +1324,7 @@ std::unique_ptr<rocksdb::WritableFile> Storage::ReplDataManager::NewTmpFile(Stor
   std::string tmp_file = dir + "/" + repl_file + ".tmp";
   auto s = storage->env_->FileExists(tmp_file);
   if (s.ok()) {
-    error("[storage] Data file exists, override");
+    ERROR("[storage] Data file exists, override");
     storage->env_->DeleteFile(tmp_file);
   }
 
@@ -1337,7 +1337,7 @@ std::unique_ptr<rocksdb::WritableFile> Storage::ReplDataManager::NewTmpFile(Stor
   std::unique_ptr<rocksdb::WritableFile> wf;
   s = storage->env_->NewWritableFile(tmp_file, &wf, rocksdb::EnvOptions());
   if (!s.ok()) {
-    error("[storage] Failed to create data file '{}'. Error: {}", tmp_file, s.ToString());
+    ERROR("[storage] Failed to create data file '{}'. Error: {}", tmp_file, s.ToString());
     return nullptr;
   }
 
diff --git a/src/types/redis_hash.cc b/src/types/redis_hash.cc
index 1f31b3279..75159c731 100644
--- a/src/types/redis_hash.cc
+++ b/src/types/redis_hash.cc
@@ -423,7 +423,7 @@ rocksdb::Status Hash::RandField(engine::Context &ctx, const Slice &user_key, int
       break;
     }
     case HashFetchType::kOnlyValue:
-      unreachable();
+      UNREACHABLE();
   }
   return rocksdb::Status::OK();
 }
diff --git a/src/types/redis_tdigest.cc b/src/types/redis_tdigest.cc
index 6b06a0c07..c44ff6b28 100644
--- a/src/types/redis_tdigest.cc
+++ b/src/types/redis_tdigest.cc
@@ -632,16 +632,16 @@ rocksdb::Status TDigest::decodeCentroidFromKeyValue(const rocksdb::Slice& key, c
   auto subkey = ikey.GetSubKey();
   auto type_flg = static_cast<uint8_t>(SegmentType::kGuardFlag);
   if (!GetFixed8(&subkey, &type_flg)) {
-    error("corrupted tdigest centroid key, extract type failed");
+    ERROR("corrupted tdigest centroid key, extract type failed");
     return rocksdb::Status::Corruption("corrupted tdigest centroid key");
   }
   if (static_cast<SegmentType>(type_flg) != SegmentType::kCentroids) {
-    error("corrupted tdigest centroid key type: {}, expect to be {}", type_flg,
+    ERROR("corrupted tdigest centroid key type: {}, expect to be {}", type_flg,
           static_cast<uint8_t>(SegmentType::kCentroids));
     return rocksdb::Status::Corruption("corrupted tdigest centroid key type");
   }
   if (!GetDouble(&subkey, &centroid->mean)) {
-    error("corrupted tdigest centroid key, extract mean failed");
+    ERROR("corrupted tdigest centroid key, extract mean failed");
     return rocksdb::Status::Corruption("corrupted tdigest centroid key");
   }
 
@@ -650,7 +650,7 @@ rocksdb::Status TDigest::decodeCentroidFromKeyValue(const rocksdb::Slice& key, c
 
   if (rocksdb::Slice value_slice = value;  // GetDouble needs a mutable pointer of slice
       !GetDouble(&value_slice, &centroid->weight)) {
-    error("corrupted tdigest centroid value, extract weight failed");
+    ERROR("corrupted tdigest centroid value, extract weight failed");
     return rocksdb::Status::Corruption("corrupted tdigest centroid value");
   }
   return rocksdb::Status::OK();
@@ -697,7 +697,7 @@ rocksdb::Status TDigest::dumpCentroidsAndBuffer(engine::Context& ctx, const std:
       for (uint64_t i = 0; i < metadata.unmerged_nodes; ++i) {
         double tmp_value = std::numeric_limits<double>::quiet_NaN();
         if (!GetDouble(&buffer_slice, &tmp_value)) {
-          error("metadata has {} records, but get {} failed", metadata.unmerged_nodes, i);
+          ERROR("metadata has {} records, but get {} failed", metadata.unmerged_nodes, i);
           return rocksdb::Status::Corruption("corrupted tdigest buffer value");
         }
         buffer->emplace_back(tmp_value);
@@ -738,7 +738,7 @@ rocksdb::Status TDigest::dumpCentroidsAndBuffer(engine::Context& ctx, const std:
   }
 
   if (centroids->size() != metadata.merged_nodes) {
-    error("metadata has {} merged nodes, but got {}", metadata.merged_nodes, centroids->size());
+    ERROR("metadata has {} merged nodes, but got {}", metadata.merged_nodes, centroids->size());
     return rocksdb::Status::Corruption("centroids count mismatch with metadata");
   }
   return rocksdb::Status::OK();
diff --git a/src/types/redis_timeseries.cc b/src/types/redis_timeseries.cc
index fa14fe039..cebf453dd 100644
--- a/src/types/redis_timeseries.cc
+++ b/src/types/redis_timeseries.cc
@@ -93,7 +93,7 @@ std::vector<TSSample> AggregateSamplesByRangeOption(std::vector<TSSample> sample
       case BucketTimestampType::Mid:
         return left + aggregator.bucket_duration / 2;
       default:
-        unreachable();
+        UNREACHABLE();
     }
     return 0;
   };
@@ -301,7 +301,7 @@ std::vector<TSSample> TSDownStreamMeta::AggregateMultiBuckets(
           sample.v = f64_auxs[1] - f64_auxs[0];
           break;
         default:
-          unreachable();
+          UNREACHABLE();
       }
       res.push_back(sample);
       // Reset aux info for the new bucket
@@ -370,7 +370,7 @@ void TSDownStreamMeta::AggregateLatestBucket(nonstd::span<const TSSample> sample
       }
       break;
     default:
-      unreachable();
+      UNREACHABLE();
   }
 }
 
@@ -410,7 +410,7 @@ void TSDownStreamMeta::ResetAuxs() {
       f64_auxs = {TSSample::NAN_VALUE, TSSample::NAN_VALUE};
       break;
     default:
-      unreachable();
+      UNREACHABLE();
   }
 }
 
@@ -811,7 +811,7 @@ double TSAggregator::AggregateSamplesValue(nonstd::span<const TSSample> samples)
       res = Reducer::VarS(samples);
       break;
     default:
-      unreachable();
+      UNREACHABLE();
   }
 
   return res;
diff --git a/src/types/timeseries.cc b/src/types/timeseries.cc
index e76a69ed7..bcec3707b 100644
--- a/src/types/timeseries.cc
+++ b/src/types/timeseries.cc
@@ -36,7 +36,7 @@ TSChunkPtr CreateTSChunkFromData(nonstd::span<const char> data) {
     return std::make_unique<UncompTSChunk>(data);
   } else {
     // TODO: compressed chunk
-    unreachable();
+    UNREACHABLE();
   }
 }
 
@@ -344,7 +344,7 @@ std::string UncompTSChunk::UpsertSamples(SampleBatchSlice batch) const {
 
     // Select next sample by earliest timestamp
     if (existing_sample_iter->ts <= new_samples[new_sample_idx].ts) {
-      candidate = existing_sample_iter;
+      candidate = &*existing_sample_iter;
     } else {
       candidate = &new_samples[new_sample_idx];
       from_new_batch = true;
@@ -560,7 +560,7 @@ std::string UncompTSChunk::UpdateSampleValue(uint64_t ts, double value, bool is_
 
 TSSample UncompTSChunk::GetLatestSample(uint32_t idx) const {
   if (metadata_.count == 0 || idx >= metadata_.count) {
-    unreachable();
+    UNREACHABLE();
   }
   return samples_[metadata_.count - 1 - idx];
 }
diff --git a/utils/kvrocks2redis/main.cc b/utils/kvrocks2redis/main.cc
index acadf08f6..d341e06fd 100644
--- a/utils/kvrocks2redis/main.cc
+++ b/utils/kvrocks2redis/main.cc
@@ -114,13 +114,13 @@ int main(int argc, char *argv[]) {
   }
 
   InitSpdlog(config);
-  info("kvrocks2redis {}", PrintVersion());
+  INFO("kvrocks2redis {}", PrintVersion());
 
   if (config.daemonize) Daemonize();
 
   s = CreatePidFile(config.pidfile);
   if (!s.IsOK()) {
-    error("Failed to create pidfile '{}': {}", config.pidfile, s.Msg());
+    ERROR("Failed to create pidfile '{}': {}", config.pidfile, s.Msg());
     exit(1);
   }
 
@@ -132,7 +132,7 @@ int main(int argc, char *argv[]) {
   engine::Storage storage(&kvrocks_config);
   s = storage.Open(kDBOpenModeAsSecondaryInstance);
   if (!s.IsOK()) {
-    error("Failed to open Kvrocks storage: {}", s.Msg());
+    ERROR("Failed to open Kvrocks storage: {}", s.Msg());
     exit(1);
   }
 
@@ -142,7 +142,7 @@ int main(int argc, char *argv[]) {
   Sync sync(&storage, &writer, &parser, &config);
   hup_handler = [&sync] {
     if (!sync.IsStopped()) {
-      info("Stopping sync");
+      INFO("Stopping sync");
       sync.Stop();
     }
   };
diff --git a/utils/kvrocks2redis/parser.cc b/utils/kvrocks2redis/parser.cc
index 687e997bf..a80f349ab 100644
--- a/utils/kvrocks2redis/parser.cc
+++ b/utils/kvrocks2redis/parser.cc
@@ -178,7 +178,7 @@ Status Parser::ParseWriteBatch(const std::string &batch_string) {
   for (const auto &iter : *resp_commands) {
     auto s = writer_->Write(iter.first, iter.second);
     if (!s.IsOK()) {
-      error("Failed to write to AOF from the write batch. Error: {}", s.Msg());
+      ERROR("Failed to write to AOF from the write batch. Error: {}", s.Msg());
     }
   }
 
diff --git a/utils/kvrocks2redis/redis_writer.cc b/utils/kvrocks2redis/redis_writer.cc
index 98f75e432..d17f9459b 100644
--- a/utils/kvrocks2redis/redis_writer.cc
+++ b/utils/kvrocks2redis/redis_writer.cc
@@ -34,7 +34,7 @@ RedisWriter::RedisWriter(kvrocks2redis::Config *config) : Writer(config) {
     assert(stop_flag_);
   });
   if (!t.IsOK()) {
-    error("Failed to create thread: {}", t.Msg());
+    ERROR("Failed to create thread: {}", t.Msg());
     return;
   }
   t_ = std::move(*t);
@@ -82,14 +82,14 @@ void RedisWriter::Stop() {
 
   if (t_.joinable()) t_.join();
   // handled by sync func
-  info("RedisWriter Stopped");
+  INFO("RedisWriter Stopped");
 }
 
 void RedisWriter::sync() {
   for (const auto &iter : config_->tokens) {
     Status s = readNextOffsetFromFile(iter.first, &next_offsets_[iter.first]);
     if (!s.IsOK()) {
-      error("{}", s.Msg());
+      ERROR("{}", s.Msg());
       return;
     }
   }
@@ -100,13 +100,13 @@ void RedisWriter::sync() {
     for (const auto &iter : config_->tokens) {
       Status s = GetAofFd(iter.first);
       if (!s.IsOK()) {
-        error("{}", s.Msg());
+        ERROR("{}", s.Msg());
         continue;
       }
 
       s = getRedisConn(iter.first, iter.second.host, iter.second.port, iter.second.auth, iter.second.db_number);
       if (!s.IsOK()) {
-        error("{}", s.Msg());
+        ERROR("{}", s.Msg());
         continue;
       }
 
@@ -114,7 +114,7 @@ void RedisWriter::sync() {
         auto getted_line_leng = pread(aof_fds_[iter.first], buffer.get(), chunk_size, next_offsets_[iter.first]);
         if (getted_line_leng <= 0) {
           if (getted_line_leng < 0) {
-            error("failed to read AOF file: {}", strerror(errno));
+            ERROR("failed to read AOF file: {}", strerror(errno));
           }
           break;
         }
@@ -122,13 +122,13 @@ void RedisWriter::sync() {
         std::string con = std::string(buffer.get(), getted_line_leng);
         s = util::SockSend(redis_fds_[iter.first], con);
         if (!s.IsOK()) {
-          error("Failed to send data to redis err: {}", s.Msg());
+          ERROR("Failed to send data to redis err: {}", s.Msg());
           break;
         }
 
         auto line_state = util::SockReadLine(redis_fds_[iter.first]);
         if (!line_state) {
-          error("Failed to read redis response err: {}", s.Msg());
+          ERROR("Failed to read redis response err: {}", s.Msg());
           break;
         }
 
@@ -136,14 +136,14 @@ void RedisWriter::sync() {
         if (line.compare(0, 1, "-") == 0) {
           // Ooops, something went wrong , sync process has been terminated, administrator should be notified
           // when full sync is needed, please remove last_next_seq config file, and restart kvrocks2redis
-          error("CRITICAL - redis sync return error, administrator confirm needed: {}", line);
+          ERROR("CRITICAL - redis sync return error, administrator confirm needed: {}", line);
           Stop();
           return;
         }
 
         s = updateNextOffset(iter.first, next_offsets_[iter.first] + getted_line_leng);
         if (!s.IsOK()) {
-          error("Failed to updating next offset: {}", s.Msg());
+          ERROR("Failed to updating next offset: {}", s.Msg());
           break;
         }
       }
@@ -204,7 +204,7 @@ Status RedisWriter::selectDB(const std::string &ns, int db_number) {
     return s.Prefixed("failed to send SELECT command to socket");
   }
 
-  info("select db request was sent, waiting for response");
+  INFO("select db request was sent, waiting for response");
   std::string line = GET_OR_RET(util::SockReadLine(redis_fds_[ns]).Prefixed("read select db response err"));
   if (line.compare(0, 3, "+OK") != 0) {
     return {Status::NotOK, "[kvrocks2redis] redis select db failed: " + line};
diff --git a/utils/kvrocks2redis/sync.cc b/utils/kvrocks2redis/sync.cc
index 8c0553a9b..e8ab42af0 100644
--- a/utils/kvrocks2redis/sync.cc
+++ b/utils/kvrocks2redis/sync.cc
@@ -55,10 +55,10 @@ Sync::~Sync() {
 void Sync::Start() {
   auto s = readNextSeqFromFile(&next_seq_);
   if (!s.IsOK()) {
-    error(s.Msg());
+    ERROR("{}", s.Msg());
     return;
   }
-  info("Start sync the data from kvrocks to redis");
+  INFO("Start sync the data from kvrocks to redis");
   while (!IsStopped()) {
     s = checkWalBoundary();
     if (!s.IsOK()) {
@@ -66,7 +66,7 @@ void Sync::Start() {
     }
     s = incrementBatchLoop();
     if (!s.IsOK()) {
-      error(s.Msg());
+      ERROR("{}", s.Msg());
     }
   }
 }
@@ -75,7 +75,7 @@ void Sync::Stop() {
   if (stop_flag_) return;
 
   stop_flag_ = true;  // Stopping procedure is asynchronous,
-  info("Sync Stopped");
+  INFO("Sync Stopped");
 }
 
 Status Sync::tryCatchUpWithPrimary() {
@@ -100,7 +100,7 @@ Status Sync::checkWalBoundary() {
     auto batch = iter->GetBatch();
     if (next_seq_ != batch.sequence) {
       if (next_seq_ > batch.sequence) {
-        error("checkWALBoundary with sequence: {}, but GetWALIter return older sequence: {}", next_seq_,
+        ERROR("checkWALBoundary with sequence: {}, but GetWALIter return older sequence: {}", next_seq_,
               batch.sequence);
       }
       return {Status::NotOK};
@@ -111,7 +111,7 @@ Status Sync::checkWalBoundary() {
 }
 
 Status Sync::incrementBatchLoop() {
-  info("Start parsing increment data");
+  INFO("Start parsing increment data");
   std::unique_ptr<rocksdb::TransactionLogIterator> iter;
   while (!IsStopped()) {
     if (!tryCatchUpWithPrimary().IsOK()) {
@@ -123,7 +123,7 @@ Status Sync::incrementBatchLoop() {
         auto batch = iter->GetBatch();
         if (batch.sequence != next_seq_) {
           if (next_seq_ > batch.sequence) {
-            error("checkWALBoundary with sequence: {}, but GetWALIter return older sequence: {}", next_seq_,
+            ERROR("checkWALBoundary with sequence: {}, but GetWALIter return older sequence: {}", next_seq_,
                   batch.sequence);
           }
           return {Status::NotOK};
@@ -146,24 +146,24 @@ Status Sync::incrementBatchLoop() {
 }
 
 void Sync::parseKVFromLocalStorage() {
-  info("Start parsing kv from the local storage");
+  INFO("Start parsing kv from the local storage");
   for (const auto &iter : config_->tokens) {
     auto s = writer_->FlushDB(iter.first);
     if (!s.IsOK()) {
-      error("Failed to flush target redis db in namespace: {}, encounter error: {}", iter.first, s.Msg());
+      ERROR("Failed to flush target redis db in namespace: {}, encounter error: {}", iter.first, s.Msg());
       return;
     }
   }
 
   Status s = parser_->ParseFullDB();
   if (!s.IsOK()) {
-    error("Failed to parse full db, encounter error: {}", s.Msg());
+    ERROR("Failed to parse full db, encounter error: {}", s.Msg());
     return;
   }
   auto last_seq = storage_->GetDB()->GetLatestSequenceNumber();
   s = updateNextSeq(last_seq + 1);
   if (!s.IsOK()) {
-    error("Failed to update next sequence: {}", s.Msg());
+    ERROR("Failed to update next sequence: {}", s.Msg());
   }
 }