adding an option to remove logging

This commit is contained in:
Carles Fernandez 2015-05-23 11:20:26 +02:00
parent c22005eda1
commit 073d36e77f
2 changed files with 37 additions and 24 deletions

View File

@ -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)
################################################################################

View File

@ -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,6 +135,8 @@ int main(int argc, char** argv)
google::ParseCommandLineFlags(&argc, &argv, true);
std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait." << std::endl;
if(GOOGLE_STRIP_LOG == 0)
{
google::InitGoogleLogging(argv[0]);
if (FLAGS_log_dir.empty())
{
@ -160,6 +166,7 @@ int main(int argc, char** argv)
}
std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl;
}
}
std::unique_ptr<ControlThread> control_thread(new ControlThread());