Project setup
This commit is contained in:
18
examples/logging/CMakeLists.txt
Normal file
18
examples/logging/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(oatmeal)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
add_executable(logging "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp")
|
||||
target_include_directories(logging PRIVATE oatmeal SharedUtils)
|
||||
target_link_libraries(logging oatmeal SharedUtils)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set_target_properties(logging PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/Debug/")
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
set_target_properties(logging PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/Release/")
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
set_target_properties(logging PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/Relwithdeb/")
|
||||
endif()
|
||||
|
||||
17
examples/logging/main.cpp
Normal file
17
examples/logging/main.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <cstdint>
|
||||
#include "shared/logger.h"
|
||||
|
||||
int main() {
|
||||
OatmealUtils::initLogging();
|
||||
OatmealUtils::createLogger("logger", nullptr);
|
||||
|
||||
OatmealUtils::get("logger")->debug("This is a debug message!");
|
||||
OatmealUtils::get("logger")->info("This is an info message!");
|
||||
OatmealUtils::get("logger")->warn("This is a warning message!");
|
||||
OatmealUtils::get("logger")->critical("This is a critical message!");
|
||||
uint32_t a = 5;
|
||||
std::string b = "Test string arg!";
|
||||
OatmealUtils::get("logger")->info("String arg: {} uint32_t args: {}", b, a);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user