Skip to content

Commit

Permalink
Merge pull request #152 from fixstars/feature/fix-logging-in-dso
Browse files Browse the repository at this point in the history
Fixed logging in dll
  • Loading branch information
iitaku authored Nov 8, 2023
2 parents e0d7c4f + 8bb93ff commit d02268e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
6 changes: 3 additions & 3 deletions cmake/IonUtil.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ function(ion_run NAME COMPILE_NAME)
add_custom_command(OUTPUT ${HEADER} ${STATIC_LIB}
COMMAND ${CMAKE_SOURCE_DIR}/script/invoke.bat $<TARGET_FILE:${COMPILE_NAME}>
HL_TARGET ${IER_TARGET_STRING}
PATH ${Halide_DIR}/../../../bin/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>
PATH ${CMAKE_BINARY_DIR}/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>
PATH ${CMAKE_BINARY_DIR}/src/bb/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>
PATH ${Halide_DIR}/../../../bin/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>$<$<CONFIG:RelWithDebInfo>:Release>
PATH ${CMAKE_BINARY_DIR}/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>$<$<CONFIG:RelWithDebInfo>:Release>
PATH ${CMAKE_BINARY_DIR}/src/bb/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>$<$<CONFIG:RelWithDebInfo>:Release>
DEPENDS ${COMPILE_NAME} ${OUTPUT_PATH}
WORKING_DIRECTORY ${OUTPUT_PATH})
endif()
Expand Down
10 changes: 10 additions & 0 deletions src/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@

#include "log.h"

namespace ion {
namespace log {

std::shared_ptr<spdlog::logger> get() {
return spdlog::get("ion");
}

} // log
} // ion

namespace {

struct Logger {
Expand Down
13 changes: 7 additions & 6 deletions src/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@

namespace ion {
namespace log {
template<class... Types> static void critical(Types... args) { spdlog::get("ion")->critical(args...); }
template<class... Types> static void error (Types... args) { spdlog::get("ion")->error (args...); }
template<class... Types> static void warn (Types... args) { spdlog::get("ion")->warn (args...); }
template<class... Types> static void info (Types... args) { spdlog::get("ion")->info (args...); }
template<class... Types> static void debug (Types... args) { spdlog::get("ion")->debug (args...); }
template<class... Types> static void trace (Types... args) { spdlog::get("ion")->trace (args...); }
std::shared_ptr<spdlog::logger> get();
template<class... Types> static void critical(Types... args) { get()->critical(args...); }
template<class... Types> static void error (Types... args) { get()->error (args...); }
template<class... Types> static void warning (Types... args) { get()->warning (args...); }
template<class... Types> static void info (Types... args) { get()->info (args...); }
template<class... Types> static void debug (Types... args) { get()->debug (args...); }
template<class... Types> static void trace (Types... args) { get()->trace (args...); }
} // log
} // ion

Expand Down

0 comments on commit d02268e

Please sign in to comment.