mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-15 11:45:47 +00:00
adding an option to remove logging
This commit is contained in:
parent
c22005eda1
commit
073d36e77f
@ -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_GENERIC_ARCH "Builds a portable binary" OFF)
|
||||||
option(ENABLE_PACKAGING "Enable software packaging" OFF)
|
option(ENABLE_PACKAGING "Enable software packaging" OFF)
|
||||||
option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF)
|
option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF)
|
||||||
|
option(ENABLE_LOG "Enable logging" ON)
|
||||||
if(ENABLE_PACKAGING)
|
if(ENABLE_PACKAGING)
|
||||||
set(ENABLE_GENERIC_ARCH ON)
|
set(ENABLE_GENERIC_ARCH ON)
|
||||||
endif(ENABLE_PACKAGING)
|
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}")
|
set_property(TARGET glog-${glog_RELEASE} PROPERTY IMPORTED_LOCATION "${GLOG_LIBRARIES}")
|
||||||
endif(NOT GLOG_FOUND OR ${LOCAL_GFLAGS})
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -34,6 +34,10 @@
|
|||||||
#define GNSS_SDR_VERSION "0.0.5"
|
#define GNSS_SDR_VERSION "0.0.5"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GOOGLE_STRIP_LOG
|
||||||
|
#define GOOGLE_STRIP_LOG 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -131,34 +135,37 @@ int main(int argc, char** argv)
|
|||||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||||
std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait." << std::endl;
|
std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait." << std::endl;
|
||||||
|
|
||||||
google::InitGoogleLogging(argv[0]);
|
if(GOOGLE_STRIP_LOG == 0)
|
||||||
if (FLAGS_log_dir.empty())
|
|
||||||
{
|
{
|
||||||
std::cout << "Logging will be done at "
|
google::InitGoogleLogging(argv[0]);
|
||||||
<< boost::filesystem::temp_directory_path()
|
if (FLAGS_log_dir.empty())
|
||||||
<< std::endl
|
|
||||||
<< "Use gnss-sdr --log_dir=/path/to/log to change that."
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const boost::filesystem::path p (FLAGS_log_dir);
|
|
||||||
if (!boost::filesystem::exists(p))
|
|
||||||
{
|
{
|
||||||
std::cout << "The path "
|
std::cout << "Logging will be done at "
|
||||||
<< FLAGS_log_dir
|
<< boost::filesystem::temp_directory_path()
|
||||||
<< " does not exist, attempting to create it."
|
<< std::endl
|
||||||
|
<< "Use gnss-sdr --log_dir=/path/to/log to change that."
|
||||||
<< std::endl;
|
<< 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;
|
else
|
||||||
|
{
|
||||||
|
const boost::filesystem::path p (FLAGS_log_dir);
|
||||||
|
if (!boost::filesystem::exists(p))
|
||||||
|
{
|
||||||
|
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::unique_ptr<ControlThread> control_thread(new ControlThread());
|
std::unique_ptr<ControlThread> control_thread(new ControlThread());
|
||||||
|
Loading…
Reference in New Issue
Block a user