1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 19:50:34 +00:00

Explicitly informs about the logging path and how to change it with the --log_dir flag. This is specially useful in MacOS, where the default path is not /tmp but a lengthly, not-easy-to-memorize folder name. This change requires Boost 1.45 or above. Ubuntu 10.10 shipped Boost 1.42, so this change breaks compatibility with Ubuntu 10.10. Feel free to remove the boost::filesystem::temp_directory_path() call if you want to continue using Boost 1.42. The --log_dir flag will still work.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@211 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2012-07-15 01:08:18 +00:00
parent d579d0d8e5
commit b67be26aa2

View File

@ -73,7 +73,7 @@ int main(int argc, char** argv)
google::SetUsageMessage(intro_help);
//google::SetVersionString("0.1");
google::SetVersionString("0.1");
google::ParseCommandLineFlags(&argc, &argv, true);
std::cout << "Initializing GNSS-SDR... Please wait." << std::endl;
@ -81,19 +81,27 @@ int main(int argc, char** argv)
google::InitGoogleLogging(argv[0]);
if (FLAGS_log_dir.empty())
{
// temp_directory_path() is only available from Boost 1.45. Ubuntu 10.10 ships with 1.42
// 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;
// temp_directory_path() is only available from
// Boost 1.45. Ubuntu 10.10 ships with 1.42
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
{
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;
std::cout << "The path "
<< FLAGS_log_dir
<< " does not exist, attempting to create it"
<< std::endl;
boost::filesystem::create_directory(p);
}
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());
@ -108,7 +116,9 @@ int main(int argc, char** argv)
// report the elapsed time
gettimeofday(&tv, NULL);
long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
std::cout << "Total GNSS-SDR run time " << ((double)(end - begin))/1000000.0 << " [seconds]" << std::endl;
std::cout << "Total GNSS-SDR run time "
<< ((double)(end - begin))/1000000.0
<< " [seconds]" << std::endl;
google::ShutDownCommandLineFlags();
std::cout << "GNSS-SDR program ended." << std::endl;