Unverified Commit 8c82136a authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

print the entire path of the file printing relative to the project root (#1723)

parent bcddc600
......@@ -278,6 +278,8 @@ if (NGRAPH_HALIDE)
include(cmake/external_halide.cmake)
endif()
add_definitions(-DPROJECT_ROOT_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
add_subdirectory(src)
if (NGRAPH_UNIT_TEST_ENABLE)
......
......@@ -56,6 +56,10 @@ namespace ngraph
}
constexpr const char* get_file_name(ConstString s) { return find_last(s, '/'); }
constexpr const char* trim_file_name(ConstString root, ConstString s)
{
return s.get_ptr(root.size());
}
enum class LOG_TYPE
{
_LOG_TYPE_ERROR,
......@@ -102,21 +106,21 @@ namespace ngraph
#define NGRAPH_ERR \
ngraph::LogHelper(ngraph::LOG_TYPE::_LOG_TYPE_ERROR, \
ngraph::get_file_name(__FILE__), \
ngraph::trim_file_name(PROJECT_ROOT_DIR, __FILE__), \
__LINE__, \
ngraph::default_logger_handler_func) \
.stream()
#define NGRAPH_WARN \
ngraph::LogHelper(ngraph::LOG_TYPE::_LOG_TYPE_WARNING, \
ngraph::get_file_name(__FILE__), \
ngraph::trim_file_name(PROJECT_ROOT_DIR, __FILE__), \
__LINE__, \
ngraph::default_logger_handler_func) \
.stream()
#define NGRAPH_INFO \
ngraph::LogHelper(ngraph::LOG_TYPE::_LOG_TYPE_INFO, \
ngraph::get_file_name(__FILE__), \
ngraph::trim_file_name(PROJECT_ROOT_DIR, __FILE__), \
__LINE__, \
ngraph::default_logger_handler_func) \
.stream()
......@@ -124,7 +128,7 @@ namespace ngraph
#ifdef NGRAPH_DEBUG_ENABLE
#define NGRAPH_DEBUG \
ngraph::LogHelper(ngraph::LOG_TYPE::_LOG_TYPE_DEBUG, \
ngraph::get_file_name(__FILE__), \
ngraph::trim_file_name(PROJECT_ROOT_DIR, __FILE__), \
__LINE__, \
ngraph::default_logger_handler_func) \
.stream()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment