diff --git a/juci/CMakeLists.txt b/juci/CMakeLists.txt index 625d06a..c98f47e 100644 --- a/juci/CMakeLists.txt +++ b/juci/CMakeLists.txt @@ -3,6 +3,7 @@ set(project_name juci) set(module juci_to_python_api) project (${project_name}) +add_definitions(-DBOOST_LOG_DYN_LINK) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/") @@ -52,7 +53,7 @@ endif() #Boost_INCLUDE_DIRS - Boost include directories #Boost_LIBRARY_DIRS - Link directories for Boost libraries #Boost_LIBRARIES - Boost component libraries to be linked -find_package(Boost 1.5 REQUIRED COMPONENTS python timer system filesystem) +find_package(Boost 1.55 COMPONENTS python thread log system filesystem REQUIRED) #If boost is not found if(${Boost_FOUND}) diff --git a/juci/juci.cc b/juci/juci.cc index b2afc98..e09efd6 100644 --- a/juci/juci.cc +++ b/juci/juci.cc @@ -6,8 +6,7 @@ int main(int argc, char *argv[]) { argv, "no.sout.juci"); + init_logging(); Window window; - - //api::LoadPlugin("juci_api_test"); return app->run(window); } diff --git a/juci/logging.h b/juci/logging.h new file mode 100644 index 0000000..c779488 --- /dev/null +++ b/juci/logging.h @@ -0,0 +1,26 @@ +#ifndef JUCI_LOGGING_H_ +#define JUCI_LOGGING_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace boost::log; + +#define TRACE(x) BOOST_LOG_TRIVIAL(trace) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; +#define DEBUG(x) BOOST_LOG_TRIVIAL(debug) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; +#define INFO(x) BOOST_LOG_TRIVIAL(info) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; +#define WARNING(x) BOOST_LOG_TRIVIAL(warning) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; +#define ERROR(x) BOOST_LOG_TRIVIAL(error) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; +#define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; + +void init_logging() { + add_file_log("juci.log"); +} + +#endif // JUCI_LOGGING_H_