From 8bb93ff42be4f83554be7249565e37a5d598ee6a Mon Sep 17 00:00:00 2001 From: Takuro Iizuka Date: Wed, 8 Nov 2023 01:30:03 -0800 Subject: [PATCH] Fixed logging in dll --- cmake/IonUtil.cmake | 6 +++--- src/log.cc | 10 ++++++++++ src/log.h | 13 +++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/cmake/IonUtil.cmake b/cmake/IonUtil.cmake index c34844d0..9b578109 100644 --- a/cmake/IonUtil.cmake +++ b/cmake/IonUtil.cmake @@ -60,9 +60,9 @@ function(ion_run NAME COMPILE_NAME) add_custom_command(OUTPUT ${HEADER} ${STATIC_LIB} COMMAND ${CMAKE_SOURCE_DIR}/script/invoke.bat $ HL_TARGET ${IER_TARGET_STRING} - PATH ${Halide_DIR}/../../../bin/$<$:Release>$<$:Debug> - PATH ${CMAKE_BINARY_DIR}/$<$:Release>$<$:Debug> - PATH ${CMAKE_BINARY_DIR}/src/bb/$<$:Release>$<$:Debug> + PATH ${Halide_DIR}/../../../bin/$<$:Release>$<$:Debug>$<$:Release> + PATH ${CMAKE_BINARY_DIR}/$<$:Release>$<$:Debug>$<$:Release> + PATH ${CMAKE_BINARY_DIR}/src/bb/$<$:Release>$<$:Debug>$<$:Release> DEPENDS ${COMPILE_NAME} ${OUTPUT_PATH} WORKING_DIRECTORY ${OUTPUT_PATH}) endif() diff --git a/src/log.cc b/src/log.cc index 8ccde7a4..167c5153 100644 --- a/src/log.cc +++ b/src/log.cc @@ -5,6 +5,16 @@ #include "log.h" +namespace ion { +namespace log { + +std::shared_ptr get() { + return spdlog::get("ion"); +} + +} // log +} // ion + namespace { struct Logger { diff --git a/src/log.h b/src/log.h index 24ec49af..4db5a1b3 100644 --- a/src/log.h +++ b/src/log.h @@ -5,12 +5,13 @@ namespace ion { namespace log { -template static void critical(Types... args) { spdlog::get("ion")->critical(args...); } -template static void error (Types... args) { spdlog::get("ion")->error (args...); } -template static void warn (Types... args) { spdlog::get("ion")->warn (args...); } -template static void info (Types... args) { spdlog::get("ion")->info (args...); } -template static void debug (Types... args) { spdlog::get("ion")->debug (args...); } -template static void trace (Types... args) { spdlog::get("ion")->trace (args...); } +std::shared_ptr get(); +template static void critical(Types... args) { get()->critical(args...); } +template static void error (Types... args) { get()->error (args...); } +template static void warning (Types... args) { get()->warning (args...); } +template static void info (Types... args) { get()->info (args...); } +template static void debug (Types... args) { get()->debug (args...); } +template static void trace (Types... args) { get()->trace (args...); } } // log } // ion