From 2f922375edec5dc4e4ad24b97cf18b1670be123c Mon Sep 17 00:00:00 2001 From: Paul-Edouard Sarlin Date: Thu, 8 Feb 2024 22:59:33 +0100 Subject: [PATCH] Initialize glog only if not already done --- _pyceres/logging.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/_pyceres/logging.h b/_pyceres/logging.h index 05c78fd..bf6df04 100644 --- a/_pyceres/logging.h +++ b/_pyceres/logging.h @@ -211,8 +211,10 @@ void BindLogging(py::module& m) { .value("ERROR", Logging::LogSeverity::GLOG_ERROR) .value("FATAL", Logging::LogSeverity::GLOG_FATAL) .export_values(); - google::InitGoogleLogging(""); - google::InstallFailureSignalHandler(); - google::InstallFailureFunction(&PyBindLogTermination); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging(""); + google::InstallFailureSignalHandler(); + google::InstallFailureFunction(&PyBindLogTermination); + } FLAGS_alsologtostderr = true; }