Skip to content
Snippets Groups Projects
Commit be243aa6 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Feature/logging

parent 0dc2b851
No related branches found
No related tags found
No related merge requests found
Showing
with 3174 additions and 21 deletions
......@@ -138,11 +138,13 @@ if (WIN32) # TODO(nick) Should do based upon compiler (VS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
set(CMAKE_CXX_FLAGS_DEBUG "-DFTL_DEBUG -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "/O2")
set(OS_LIBS "")
else()
add_definitions(-DUNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -msse3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -pg -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -mfpmath=sse")
set(OS_LIBS "dl")
endif()
SET(CMAKE_USE_RELATIVE_PATHS ON)
......
......@@ -4,7 +4,8 @@
* See LICENSE.
*/
#include <glog/logging.h>
#define LOGURU_WITH_STREAMS 1
#include <loguru.hpp>
#include <ftl/config.h>
#include <ftl/configuration.hpp>
#include <ftl/depth_camera.hpp>
......
......@@ -2,7 +2,8 @@
#ifdef HAVE_PCL
#include <glog/logging.h>
#define LOGURU_WITH_STREAMS 1
#include <loguru.hpp>
#include <pcl/common/transforms.h>
#include <pcl/registration/transformation_estimation_svd.h>
......@@ -66,7 +67,7 @@ float fitPlaneError(PointCloud<PointXYZ>::Ptr cloud_in, float distance_threshold
proj.setModelCoefficients(coefficients);
proj.filter(cloud_proj);
LOG_ASSERT(cloud_in->size() == cloud_proj.size());
CHECK(cloud_in->size() == cloud_proj.size());
// todo: which error score is suitable? (using MSE)
float score = 0.0;
......
......@@ -3,7 +3,8 @@
#include <ftl/scene_rep_hash_sdf.hpp>
#include <ftl/ray_cast_sdf.hpp>
#include <glog/logging.h>
#define LOGURU_WITH_STREAMS 1
#include <loguru.hpp>
using ftl::rgbd::VirtualSource;
using std::mutex;
......
......@@ -4,7 +4,8 @@
* See LICENSE.
*/
#include <glog/logging.h>
#define LOGURU_WITH_STREAMS 1
#include <loguru.hpp>
#include <ftl/configuration.hpp>
#include <ctpl_stl.h>
// #include <zlib.h>
......
#include <ftl/middlebury.hpp>
#include <glog/logging.h>
#include <loguru.hpp>
#include <ftl/rgbd.hpp>
#include <string>
......
#include <glog/logging.h>
#include <loguru.hpp>
#include <ftl/streamer.hpp>
#include <vector>
// #include <zlib.h>
......
......@@ -3,6 +3,7 @@ set(COMMONSRC
src/uri.cpp
src/configuration.cpp
src/configurable.cpp
src/loguru.cpp
src/opencv_to_pcl.cpp
)
......@@ -17,7 +18,7 @@ target_include_directories(ftlcommon PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(ftlcommon glog::glog ${OpenCV_LIBS} ${PCL_LIBRARIES} ${URIPARSER_LIBRARIES})
target_link_libraries(ftlcommon Threads::Threads ${OS_LIBS} ${OpenCV_LIBS} ${PCL_LIBRARIES} ${URIPARSER_LIBRARIES})
add_subdirectory(test)
......@@ -2,7 +2,8 @@
#ifndef _FTL_CONFIGURABLE_HPP_
#define _FTL_CONFIGURABLE_HPP_
#include <glog/logging.h>
#define LOGURU_REPLACE_GLOG 1
#include <loguru.hpp>
#include <nlohmann/json.hpp>
#include <string>
#include <tuple>
......
......@@ -2,6 +2,8 @@
#ifndef _FTL_COMMON_CONFIGURATION_HPP_
#define _FTL_COMMON_CONFIGURATION_HPP_
#define LOGURU_REPLACE_GLOG 1
#include <loguru.hpp>
#include <nlohmann/json.hpp>
//#include <ftl/configurable.hpp>
#include <string>
......
This diff is collapsed.
#include <glog/logging.h>
#define LOGURU_REPLACE_GLOG 1
#include <loguru.hpp>
#include <ftl/config.h>
#ifdef WIN32
......@@ -9,6 +10,10 @@
#include <unistd.h>
#endif
#ifndef WIN32
#include <signal.h>
#endif
#include <nlohmann/json.hpp>
#include <ftl/configuration.hpp>
#include <ftl/configurable.hpp>
......@@ -378,10 +383,28 @@ static void process_options(Configurable *root, const map<string, string> &opts)
}
}
static void signalIntHandler( int signum ) {
std::cout << "Closing...\n";
// cleanup and close up stuff here
// terminate program
exit(0);
}
Configurable *ftl::config::configure(int argc, char **argv, const std::string &root) {
loguru::init(argc, argv, "--verbosity");
argc--;
argv++;
loguru::g_preamble_date = false;
loguru::g_preamble_uptime = false;
loguru::g_preamble_thread = false;
#ifndef WIN32
signal(SIGINT,signalIntHandler);
#endif // WIN32
// Process Arguments
auto options = read_options(&argv, &argc);
......
This diff is collapsed.
......@@ -5,20 +5,23 @@ add_executable(configurable_unit
../src/uri.cpp
../src/config.cpp
../src/configuration.cpp
../src/loguru.cpp
./configurable_unit.cpp
)
target_include_directories(configurable_unit PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../include")
target_link_libraries(configurable_unit
${URIPARSER_LIBRARIES}
glog::glog)
Threads::Threads ${OS_LIBS})
### URI ########################################################################
add_executable(uri_unit
./tests.cpp
../src/uri.cpp
../src/loguru.cpp
./uri_unit.cpp)
target_include_directories(uri_unit PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../include")
target_link_libraries(uri_unit
Threads::Threads ${OS_LIBS}
${URIPARSER_LIBRARIES})
......
#include "catch.hpp"
#define LOGURU_REPLACE_GLOG 1
#include <loguru.hpp>
#include <ftl/configurable.hpp>
using ftl::Configurable;
......
......@@ -12,8 +12,8 @@
#include <winsock2.h>
#endif
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <glog/logging.h>
//#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <loguru.hpp>
#include <ftl/net/protocol.hpp>
#include <ftl/net/dispatcher.hpp>
#include <ftl/uri.hpp>
......
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <glog/logging.h>
//#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <loguru.hpp>
#include <ftl/net/dispatcher.hpp>
#include <ftl/net/peer.hpp>
#include <iostream>
......
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <glog/logging.h>
//#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <loguru.hpp>
#include <ftl/uri.hpp>
#include <ftl/net/listener.hpp>
......
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <glog/logging.h>
//#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <loguru.hpp>
#include <ctpl_stl.h>
#ifndef NOMINMAX
......
......@@ -2,8 +2,8 @@
* Copyright 2019 Nicolas Pope.
*/
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <glog/logging.h>
//#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <loguru.hpp>
#include <cstring>
#include <ftl/net/ws_internal.hpp>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment