[hamradio-commits] [gnss-sdr] 135/251: adding an option to remove logging
Carles Fernandez
carles_fernandez-guest at moszumanska.debian.org
Wed Sep 2 00:22:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
carles_fernandez-guest pushed a commit to branch master
in repository gnss-sdr.
commit 073d36e77f32c676cfa0325f623a1e41d2a3c434
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date: Sat May 23 11:20:26 2015 +0200
adding an option to remove logging
---
CMakeLists.txt | 6 ++++++
src/main/main.cc | 51 +++++++++++++++++++++++++++++----------------------
2 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f22c839..16d260c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,7 @@ option(ENABLE_OPENCL "Enable building of processing blocks implemented with Open
option(ENABLE_GENERIC_ARCH "Builds a portable binary" OFF)
option(ENABLE_PACKAGING "Enable software packaging" OFF)
option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF)
+option(ENABLE_LOG "Enable logging" ON)
if(ENABLE_PACKAGING)
set(ENABLE_GENERIC_ARCH ON)
endif(ENABLE_PACKAGING)
@@ -596,6 +597,11 @@ else(NOT GLOG_FOUND OR ${LOCAL_GFLAGS})
set_property(TARGET glog-${glog_RELEASE} PROPERTY IMPORTED_LOCATION "${GLOG_LIBRARIES}")
endif(NOT GLOG_FOUND OR ${LOCAL_GFLAGS})
+if(NOT ENABLE_LOG)
+ message(STATUS "Logging is not enabled")
+ add_definitions(-DGOOGLE_STRIP_LOG=1)
+endif(NOT ENABLE_LOG)
+
################################################################################
diff --git a/src/main/main.cc b/src/main/main.cc
index 258b422..2a9ddc3 100644
--- a/src/main/main.cc
+++ b/src/main/main.cc
@@ -34,6 +34,10 @@
#define GNSS_SDR_VERSION "0.0.5"
#endif
+#ifndef GOOGLE_STRIP_LOG
+#define GOOGLE_STRIP_LOG 0
+#endif
+
#include <ctime>
#include <cstdlib>
#include <memory>
@@ -131,34 +135,37 @@ int main(int argc, char** argv)
google::ParseCommandLineFlags(&argc, &argv, true);
std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait." << std::endl;
- google::InitGoogleLogging(argv[0]);
- if (FLAGS_log_dir.empty())
- {
- std::cout << "Logging will be done at "
- << boost::filesystem::temp_directory_path()
- << std::endl
- << "Use gnss-sdr --log_dir=/path/to/log to change that."
- << std::endl;
- }
- else
+ if(GOOGLE_STRIP_LOG == 0)
{
- const boost::filesystem::path p (FLAGS_log_dir);
- if (!boost::filesystem::exists(p))
+ google::InitGoogleLogging(argv[0]);
+ if (FLAGS_log_dir.empty())
{
- std::cout << "The path "
- << FLAGS_log_dir
- << " does not exist, attempting to create it."
+ std::cout << "Logging will be done at "
+ << boost::filesystem::temp_directory_path()
+ << std::endl
+ << "Use gnss-sdr --log_dir=/path/to/log to change that."
<< std::endl;
- boost::system::error_code ec;
- boost::filesystem::create_directory(p, ec);
- if(ec != 0)
+ }
+ else
+ {
+ const boost::filesystem::path p (FLAGS_log_dir);
+ if (!boost::filesystem::exists(p))
{
- std::cout << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended." << std::endl;
- google::ShutDownCommandLineFlags();
- std::exit(0);
+ std::cout << "The path "
+ << FLAGS_log_dir
+ << " does not exist, attempting to create it."
+ << std::endl;
+ boost::system::error_code ec;
+ boost::filesystem::create_directory(p, ec);
+ if(ec != 0)
+ {
+ std::cout << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended." << std::endl;
+ google::ShutDownCommandLineFlags();
+ std::exit(0);
+ }
}
+ std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl;
}
- std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl;
}
std::unique_ptr<ControlThread> control_thread(new ControlThread());
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git
More information about the pkg-hamradio-commits
mailing list