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

commit 387a72ab0ff469e29c85242033289083dcd6d50b
Author: Aleks Lozovyuk <[email protected]>
AuthorDate: Mon Nov 11 13:45:40 2024 +0200

    Add fix
---
 src/cli/main.cc      | 5 +++--
 src/config/config.cc | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/cli/main.cc b/src/cli/main.cc
index 3eaf4b13..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);
     }
   }
 }
diff --git a/src/config/config.cc b/src/config/config.cc
index f14dc78c..e15144ed 100644
--- a/src/config/config.cc
+++ b/src/config/config.cc
@@ -597,7 +597,7 @@ void Config::initFieldCallback() {
              }
 
              if (log_retention_days != -1) {
-               google::EnableLogCleaner(log_retention_days);
+               google::EnableLogCleaner(std::chrono::hours(24) * 
log_retention_days);
              } else {
                google::DisableLogCleaner();
              }

Reply via email to