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

aleksraiden pushed a commit to branch aleksraiden-glog-new
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/aleksraiden-glog-new by this 
push:
     new c9537064 Revert "Fix clang-format"
c9537064 is described below

commit c9537064fe17bdeb401aca7af82f42145f32a16f
Author: Aleks Lozovyuk <[email protected]>
AuthorDate: Thu Nov 14 11:45:22 2024 +0200

    Revert "Fix clang-format"
    
    This reverts commit 3fcf43e5c0bf0be4a5a9128b459e9ac519181439.
---
 src/cli/main.cc | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/cli/main.cc b/src/cli/main.cc
index 2ce5f013..efe1c542 100644
--- a/src/cli/main.cc
+++ b/src/cli/main.cc
@@ -31,6 +31,7 @@
 #include <ostream>
 
 #include "daemon_util.h"
+#include "glog/log_severity.h"
 #include "io_util.h"
 #include "pid_util.h"
 #include "scope_exit.h"
@@ -100,7 +101,7 @@ static void InitGoogleLog(const Config *config) {
 
   if (util::EqualICase(config->log_dir, "stdout")) {
     for (int level = google::INFO; level <= google::FATAL; level++) {
-      google::SetLogDestination(level, "");
+      google::SetLogDestination(static_cast<google::LogSeverity>(level), "");
     }
     FLAGS_stderrthreshold = google::ERROR;
     FLAGS_logtostdout = true;
@@ -108,7 +109,7 @@ static void InitGoogleLog(const Config *config) {
   } else {
     FLAGS_log_dir = config->log_dir + "/";
     if (config->log_retention_days != -1) {
-      google::EnableLogCleaner(config->log_retention_days);
+      google::EnableLogCleaner(std::chrono::hours(24) * 
config->log_retention_days);
     }
   }
 }
@@ -116,6 +117,9 @@ static void InitGoogleLog(const Config *config) {
 int main(int argc, char *argv[]) {
   srand(static_cast<unsigned>(util::GetTimeStamp()));
 
+  google::InitGoogleLogging("kvrocks");
+  auto glog_exit = MakeScopeExit(google::ShutdownGoogleLogging);
+
   evthread_use_pthreads();
   auto event_exit = MakeScopeExit(libevent_global_shutdown);
 
@@ -138,8 +142,6 @@ int main(int argc, char *argv[]) {
 
   crc64_init();
   InitGoogleLog(&config);
-  google::InitGoogleLogging("kvrocks");
-  auto glog_exit = MakeScopeExit(google::ShutdownGoogleLogging);
   LOG(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

Reply via email to