mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-31 11:19:18 +00:00
Add flags for logging configuration
This commit is contained in:
parent
33a38f4ec6
commit
c8c6325535
@ -26,7 +26,7 @@ if(ENABLE_GLOG_AND_GFLAGS)
|
||||
target_link_libraries(gnss-sdr PRIVATE Gflags::gflags Glog::glog)
|
||||
target_compile_definitions(gnss-sdr PUBLIC -DUSE_GLOG_AND_GFLAGS=1)
|
||||
else()
|
||||
target_link_libraries(gnss-sdr PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry)
|
||||
target_link_libraries(gnss-sdr PRIVATE absl::flags absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize absl::log_sink absl::log_sink_registry)
|
||||
endif()
|
||||
|
||||
if(NOT ENABLE_LOG)
|
||||
|
@ -57,6 +57,7 @@ using namespace google;
|
||||
#include <absl/flags/parse.h>
|
||||
#include <absl/flags/usage.h>
|
||||
#include <absl/flags/usage_config.h>
|
||||
#include <absl/log/flags.h>
|
||||
#include <absl/log/globals.h>
|
||||
#include <absl/log/initialize.h>
|
||||
#include <absl/log/log.h>
|
||||
@ -124,6 +125,7 @@ int main(int argc, char** argv)
|
||||
absl::SetFlagsUsageConfig(empty_config);
|
||||
absl::SetProgramUsageMessage(intro_help);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
|
||||
#endif
|
||||
std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait.\n";
|
||||
}
|
||||
@ -147,7 +149,6 @@ int main(int argc, char** argv)
|
||||
|
||||
if (GOOGLE_STRIP_LOG == 0)
|
||||
{
|
||||
// google::InitGoogleLogging(argv[0]);
|
||||
#if USE_GLOG_AND_GFLAGS
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
if (FLAGS_log_dir.empty())
|
||||
@ -212,7 +213,13 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_GLOG_AND_GFLAGS
|
||||
#else
|
||||
else
|
||||
{
|
||||
absl::SetMinLogLevel(absl::LogSeverityAtLeast::kInfinity); // do not log
|
||||
}
|
||||
#endif
|
||||
std::chrono::time_point<std::chrono::system_clock> start;
|
||||
std::chrono::time_point<std::chrono::system_clock> end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
@ -623,7 +623,7 @@ if(ENABLE_UNIT_TESTING)
|
||||
target_link_libraries(run_tests PRIVATE Gflags::gflags Glog::glog)
|
||||
target_compile_definitions(run_tests PRIVATE -DUSE_GLOG_AND_GFLAGS=1)
|
||||
else()
|
||||
target_link_libraries(run_tests PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize)
|
||||
target_link_libraries(run_tests PRIVATE absl::flags absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize)
|
||||
endif()
|
||||
target_include_directories(run_tests
|
||||
INTERFACE
|
||||
@ -773,7 +773,7 @@ if(ENABLE_FPGA)
|
||||
target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE Gflags::gflags Glog::glog)
|
||||
target_compile_definitions(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE -DUSE_GLOG_AND_GFLAGS=1)
|
||||
else()
|
||||
target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize)
|
||||
target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE absl::flags absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize)
|
||||
endif()
|
||||
target_include_directories(gps_l1_ca_dll_pll_tracking_test_fpga
|
||||
INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files
|
||||
@ -872,7 +872,7 @@ if(ENABLE_SYSTEM_TESTING)
|
||||
if(ENABLE_GLOG_AND_GFLAGS)
|
||||
set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog)
|
||||
else()
|
||||
set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::flags absl::log absl::log_initialize absl::log_sink absl::log_sink_registry)
|
||||
set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::flags absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize absl::log_sink absl::log_sink_registry)
|
||||
endif()
|
||||
if(NOT ENABLE_PACKAGING)
|
||||
add_system_test(ttff
|
||||
@ -896,7 +896,7 @@ if(ENABLE_SYSTEM_TESTING)
|
||||
if(ENABLE_GLOG_AND_GFLAGS)
|
||||
set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog)
|
||||
else()
|
||||
set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry)
|
||||
set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize absl::log_sink absl::log_sink_registry)
|
||||
endif()
|
||||
add_system_test(position_test
|
||||
CMAKE_ARGS -DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
|
||||
@ -969,7 +969,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
|
||||
target_link_libraries(flowgraph_test PRIVATE Gflags::gflags Glog::glog)
|
||||
target_compile_definitions(flowgraph_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1)
|
||||
else()
|
||||
target_link_libraries(flowgraph_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize)
|
||||
target_link_libraries(flowgraph_test PRIVATE absl::flags absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize)
|
||||
endif()
|
||||
|
||||
target_include_directories(flowgraph_test
|
||||
@ -1026,7 +1026,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
|
||||
target_link_libraries(gnss_block_test PRIVATE Gflags::gflags Glog::glog)
|
||||
target_compile_definitions(gnss_block_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1)
|
||||
else()
|
||||
target_link_libraries(gnss_block_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize)
|
||||
target_link_libraries(gnss_block_test PRIVATE absl::flags absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize)
|
||||
endif()
|
||||
|
||||
target_include_directories(gnss_block_test
|
||||
@ -1078,7 +1078,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
|
||||
target_link_libraries(gnuradio_block_test PRIVATE Gflags::gflags Glog::glog)
|
||||
target_compile_definitions(gnuradio_block_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1)
|
||||
else()
|
||||
target_link_libraries(gnuradio_block_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize)
|
||||
target_link_libraries(gnuradio_block_test PRIVATE absl::flags absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize)
|
||||
endif()
|
||||
|
||||
xcode_remove_warning_duplicates(gnuradio_block_test)
|
||||
@ -1114,7 +1114,7 @@ if(ENABLE_GLOG_AND_GFLAGS)
|
||||
target_link_libraries(matio_test PRIVATE Gflags::gflags Glog::glog)
|
||||
target_compile_definitions(matio_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1)
|
||||
else()
|
||||
target_link_libraries(matio_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize)
|
||||
target_link_libraries(matio_test PRIVATE absl::flags absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize)
|
||||
endif()
|
||||
|
||||
target_include_directories(matio_test
|
||||
@ -1164,7 +1164,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
|
||||
target_link_libraries(acq_test PRIVATE Gflags::gflags Glog::glog)
|
||||
target_compile_definitions(acq_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1)
|
||||
else()
|
||||
target_link_libraries(acq_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize)
|
||||
target_link_libraries(acq_test PRIVATE absl::flags absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize)
|
||||
endif()
|
||||
target_include_directories(acq_test
|
||||
INTERFACE
|
||||
@ -1250,7 +1250,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
|
||||
target_link_libraries(trk_test PRIVATE Gflags::gflags Glog::glog)
|
||||
target_compile_definitions(trk_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1)
|
||||
else()
|
||||
target_link_libraries(trk_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize)
|
||||
target_link_libraries(trk_test PRIVATE absl::flags absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize)
|
||||
endif()
|
||||
if(USE_GENERIC_LAMBDAS)
|
||||
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
|
||||
@ -1313,7 +1313,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
|
||||
target_link_libraries(control_thread_test PRIVATE Gflags::gflags Glog::glog)
|
||||
target_compile_definitions(control_thread_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1)
|
||||
else()
|
||||
target_link_libraries(control_thread_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize)
|
||||
target_link_libraries(control_thread_test PRIVATE absl::flags absl::flags_parse absl::log $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> absl::log_initialize)
|
||||
endif()
|
||||
|
||||
xcode_remove_warning_duplicates(control_thread_test)
|
||||
|
@ -39,6 +39,7 @@ DECLARE_string(log_dir);
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <absl/flags/flag.h>
|
||||
#include <absl/flags/parse.h>
|
||||
#include <absl/log/flags.h>
|
||||
#include <absl/log/initialize.h>
|
||||
#include <absl/log/log.h>
|
||||
#include <absl/log/log_sink.h>
|
||||
|
@ -52,6 +52,7 @@ using namespace google;
|
||||
#else
|
||||
#include <absl/flags/flag.h>
|
||||
#include <absl/flags/parse.h>
|
||||
#include <absl/log/flags.h>
|
||||
#include <absl/log/log.h>
|
||||
#endif
|
||||
|
||||
|
@ -38,6 +38,7 @@ DECLARE_string(log_dir);
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <absl/flags/flag.h>
|
||||
#include <absl/flags/parse.h>
|
||||
#include <absl/log/flags.h>
|
||||
#include <absl/log/globals.h>
|
||||
#include <absl/log/initialize.h>
|
||||
#include <absl/log/log.h>
|
||||
@ -220,7 +221,6 @@ int main(int argc, char **argv)
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
absl::LogSink *testLogSink = new TestingLogSink;
|
||||
absl::AddLogSink(testLogSink);
|
||||
// absl::SetMinLogLevel(absl::LogSeverityAtLeast::kInfinity);
|
||||
absl::InitializeLog();
|
||||
#endif
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user