Skip to content

Commit 24d2632

Browse files
committed
init commit
1 parent 1c50b16 commit 24d2632

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ FetchContent_Declare(
3333
GIT_TAG v1.12.0
3434
)
3535
FetchContent_MakeAvailable(spdlog)
36+
add_definitions(-DSPDLOG_USE_STD_FORMAT -DSPDLOG_USE_STD_FORMAT_HO)
3637

3738
add_subdirectory(src)
3839

src/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
add_library(core INTERFACE)
22
target_include_directories(core INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/core)
3-
target_link_libraries(core INTERFACE spdlog::spdlog)
3+
target_link_libraries(core INTERFACE spdlog::spdlog_header_only)
44

55
add_library(engine INTERFACE)
66
target_include_directories(engine INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/engine)
77

88
add_executable(exchange_simulator sim/main.cpp)
9-
target_link_libraries(exchange_simulator PRIVATE core engine)
9+
target_link_libraries(exchange_simulator PRIVATE core engine spdlog::spdlog_header_only)
10+
target_include_directories(exchange_simulator PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

src/core/logger.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55

66
namespace es {
77

8-
inline void info(std::string_view msg) {
9-
spdlog::info("{}", msg);
10-
}
8+
#define LOG_INFO(...) SPDLOG_INFO(__VA_ARGS__)
9+
#define LOG_WARN(...) SPDLOG_WARN(__VA_ARGS__)
10+
#define LOG_ERROR(...) SPDLOG_ERROR(__VA_ARGS__)
11+
#define LOG_DEBUG(...) SPDLOG_DEBUG(__VA_ARGS__)
12+
#define LOG_TRACE(...) SPDLOG_TRACE(__VA_ARGS__)
13+
#define LOG_CRITICAL(...) SPDLOG_CRITICAL(__VA_ARGS__)
1114

1215
} // namespace es

src/sim/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include "core/logger.h"
1+
#include <core/logger.h>
22

33
int main() {
4-
es::info("ExchangeSimulator skeleton");
4+
SPDLOG_INFO("ExchangeSimulator skeleton");
55
return 0;
66
}

0 commit comments

Comments
 (0)