Added a log system and options to it.

This commit is contained in:
Pcornat 2021-02-16 19:07:45 +01:00
parent dffa80faf3
commit f1f9045f4b
No known key found for this signature in database
GPG Key ID: 873C3ACCF970C74E
4 changed files with 30 additions and 2 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "external/spdlog"]
path = external/spdlog
url = https://github.com/gabime/spdlog.git

View File

@ -6,13 +6,24 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_COMPILER_LAUNCHER ccache) set(CMAKE_CXX_COMPILER_LAUNCHER ccache)
# options for spdlog
set(SPDLOG_ENABLE_PCH ON CACHE BOOL "Build static or shared library using precompiled header to speed up compilation time")
set(SPDLOG_BUILD_WARNINGS ON CACHE BOOL "Enable compiler warnings")
set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "Use external fmt library instead of bundled")
set(SPDLOG_PREVENT_CHILD_FD ON CACHE BOOL "Prevent from child processes to inherit log file descriptors")
set(SPDLOG_NO_THREAD_ID ON CACHE BOOL "prevent spdlog from querying the thread id on each log call if thread id is not needed")
set(SPDLOG_NO_TLS ON CACHE BOOL "prevent spdlog from using thread local storage")
add_subdirectory(external/spdlog)
# end
find_package(Boost REQUIRED COMPONENTS system) find_package(Boost REQUIRED COMPONENTS system)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
find_package(OpenMP REQUIRED) find_package(OpenMP REQUIRED)
include_directories(${Boost_INCLUDE_DIR} ${OpenSSL_INCLUDE_DIR}) include_directories(${Boost_INCLUDE_DIR} ${OpenSSL_INCLUDE_DIR})
set(COMPILE_DEFINITIONS set(COMPILE_DEFINITIONS
$<$<CONFIG:DEBUG>:_GLIBCXX_DEBUG> $<$<CONFIG:DEBUG>:_LIBCPP_DEBUG>
BOOST_ASIO_NO_DEPRECATED BOOST_ASIO_NO_DEPRECATED
BOOST_ASIO_NO_TS_EXECUTORS BOOST_ASIO_NO_TS_EXECUTORS
#[[_FORTIFY_SOURCE=2]] #[[_FORTIFY_SOURCE=2]]
@ -66,4 +77,4 @@ target_precompile_headers(GeminiServer PRIVATE ${HEADERS})
target_compile_definitions(GeminiServer PRIVATE ${COMPILE_DEFINITIONS}) target_compile_definitions(GeminiServer PRIVATE ${COMPILE_DEFINITIONS})
target_compile_options(GeminiServer PRIVATE ${COMPILE_FLAGS}) target_compile_options(GeminiServer PRIVATE ${COMPILE_FLAGS})
target_link_options(GeminiServer ${LINKER_OPTIONS}) target_link_options(GeminiServer ${LINKER_OPTIONS})
target_link_libraries(GeminiServer ${LINKER_FLAGS}) target_link_libraries(GeminiServer ${LINKER_FLAGS} spdlog::spdlog)

View File

@ -14,6 +14,19 @@ What we want is a high performance server using asynchrony at first, and then ma
The configuration of the server is made through a JSON file `config.json`. The JSON parser is [simdjson](https://github.com/simdjson/simdjson) directly integrated The configuration of the server is made through a JSON file `config.json`. The JSON parser is [simdjson](https://github.com/simdjson/simdjson) directly integrated
in our source code. in our source code.
### Structure of the file
- content
- path : string, folder to the content of your site.
- cache
- enable_cache: bool, to enable cache of files or not
- cache_size : unsigned int, the maximum size in bytes to put in cache
- ssl
- pem_path : string
- cert_path : string
## Dependencies
It uses a bundled version of `spdlog` as a git submodule, but it does not use the `fmt` lib that is inside `spdlog`.
## Documentation ## Documentation
The doc of the code is made with [doxygen](https://www.doxygen.nl/), the `Doxyfile` is at the root of the repo. The doc of the code is made with [doxygen](https://www.doxygen.nl/), the `Doxyfile` is at the root of the repo.

1
external/spdlog vendored Submodule

@ -0,0 +1 @@
Subproject commit 42c5eb59c9a44e4fafa4c5dae95ecd8269df5f35