From 0122439de6813ba4e9eae1fb5976c651049cc246 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Sun, 22 Oct 2023 23:45:58 -0400 Subject: [PATCH] prevent initializing glog twice --- src/rime/setup.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rime/setup.cc b/src/rime/setup.cc index 309183878..f549ad1a8 100644 --- a/src/rime/setup.cc +++ b/src/rime/setup.cc @@ -89,7 +89,11 @@ RIME_API void SetupLogging(const char* app_name, // Do not allow other users to read/write log files created by current // process. FLAGS_logfile_mode = 0600; - google::InitGoogleLogging(app_name); + if (google::IsGoogleLoggingInitialized()) { + LOG(WARNING) << "Glog is already initialized."; + } else { + google::InitGoogleLogging(app_name); + } #endif // RIME_ENABLE_LOGGING }