1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2024-11-23 00:33:44 +00:00

Add logging lib spdlog.

This commit is contained in:
King_DuckZ 2017-05-03 09:31:41 +01:00
parent 73323c9ee7
commit c892ed2df8
4 changed files with 14 additions and 4 deletions

3
.gitmodules vendored
View file

@ -10,3 +10,6 @@
[submodule "lib/houdini/houdini"] [submodule "lib/houdini/houdini"]
path = lib/houdini/houdini path = lib/houdini/houdini
url = https://github.com/vmg/houdini.git url = https://github.com/vmg/houdini.git
[submodule "lib/spdlog"]
path = lib/spdlog
url = https://github.com/gabime/spdlog.git

1
lib/spdlog Submodule

@ -0,0 +1 @@
Subproject commit 4a2580231259f464674d8bd998e5fb378694c98d

View file

@ -45,6 +45,7 @@ target_include_directories(${PROJECT_NAME} SYSTEM
PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/better-enums PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/better-enums
PRIVATE ${SourceHighlight_INCLUDE_DIR} PRIVATE ${SourceHighlight_INCLUDE_DIR}
PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/utf8_v2_3_4/source PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/utf8_v2_3_4/source
PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/spdlog/include
) )
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
PRIVATE ${Boost_LIBRARIES} PRIVATE ${Boost_LIBRARIES}
@ -52,6 +53,7 @@ target_link_libraries(${PROJECT_NAME}
PRIVATE ${SourceHighlight_LIBRARIES} PRIVATE ${SourceHighlight_LIBRARIES}
PRIVATE mstch PRIVATE mstch
PRIVATE houdini PRIVATE houdini
PRIVATE pthread
) )
target_compile_definitions(${PROJECT_NAME} target_compile_definitions(${PROJECT_NAME}
PRIVATE BOOST_SPIRIT_USE_PHOENIX_V3=1 PRIVATE BOOST_SPIRIT_USE_PHOENIX_V3=1

View file

@ -26,7 +26,7 @@
#include "pathname/pathname.hpp" #include "pathname/pathname.hpp"
#include "duckhandy/compatibility.h" #include "duckhandy/compatibility.h"
#include "settings_bag.hpp" #include "settings_bag.hpp"
#include <iostream> #include <spdlog/spdlog.h>
#include <string> #include <string>
#include <fstream> #include <fstream>
#include <iterator> #include <iterator>
@ -78,9 +78,13 @@ int main() {
using tawashi::PastieResponse; using tawashi::PastieResponse;
using tawashi::Response; using tawashi::Response;
#if !defined(NDEBUG) //Prepare the logger
std::cerr << "Loading config: \"" << config_file_path() << "\"\n"; spdlog::set_pattern("[%Y-%m-%d %T %z] - %v");
#endif spdlog::set_level(spdlog::level::debug);
auto statuslog = spdlog::stderr_logger_st("statuslog");
statuslog->debug("Loading config: \"{}\"\n", config_file_path());
std::ifstream conf(config_file_path()); std::ifstream conf(config_file_path());
conf >> std::noskipws; conf >> std::noskipws;
auto ini = SafeStackObject<tawashi::IniFile>(std::istream_iterator<char>(conf), std::istream_iterator<char>()); auto ini = SafeStackObject<tawashi::IniFile>(std::istream_iterator<char>(conf), std::istream_iterator<char>());