This commit is contained in:
gabime 2019-05-11 13:52:46 +03:00
parent f809427575
commit 005450ff13
4 changed files with 7 additions and 12 deletions

View File

@ -59,7 +59,8 @@ message(STATUS "Static lib: " ${SPDLOG_STATIC_LIB})
if(SPDLOG_STATIC_LIB) if(SPDLOG_STATIC_LIB)
add_definitions(-DSPDLOG_STATIC_LIB) add_definitions(-DSPDLOG_STATIC_LIB)
file(GLOB SRC_FILES ${HEADER_BASE}/impl/*.cpp) set(SRC_BASE "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(SRC_FILES "${SRC_BASE}/spdlog.cpp" "${SRC_BASE}/format.cc")
add_library(spdlog STATIC ${SRC_FILES}) add_library(spdlog STATIC ${SRC_FILES})
target_include_directories(spdlog PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>") target_include_directories(spdlog PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
target_link_libraries(spdlog -Wl,--as-needed) target_link_libraries(spdlog -Wl,--as-needed)

View File

@ -5,17 +5,14 @@
#pragma once #pragma once
// Very fast asynchronous logger (millions of logs per second on an average // Fast asynchronous logger.
// desktop) // Uses pre allocated queue.
// Uses pre allocated lockfree queue for maximum throughput even under large
// number of threads.
// Creates a single back thread to pop messages from the queue and log them. // Creates a single back thread to pop messages from the queue and log them.
// //
// Upon each log write the logger: // Upon each log write the logger:
// 1. Checks if its log level is enough to log the message // 1. Checks if its log level is enough to log the message
// 2. Push a new copy of the message to a queue (or block the caller until // 2. Push a new copy of the message to a queue (or block the caller until
// space is available in the queue) // space is available in the queue)
// 3. will throw spdlog_ex upon log exceptions
// Upon destruction, logs all remaining messages in the queue before // Upon destruction, logs all remaining messages in the queue before
// destructing.. // destructing..

View File

@ -341,5 +341,5 @@ protected:
} // namespace spdlog } // namespace spdlog
#ifndef SPDLOG_STATIC_LIB #ifndef SPDLOG_STATIC_LIB
#include "logger-inl.h #include "logger-inl.h"
#endif #endif

View File

@ -1,4 +1,5 @@
#include <mutex> #include "spdlog/spdlog.h"
#include "spdlog/details/null_mutex.h" #include "spdlog/details/null_mutex.h"
#include "spdlog/logger.h" #include "spdlog/logger.h"
@ -7,9 +8,6 @@
#include "spdlog/async_logger.h" #include "spdlog/async_logger.h"
#include "spdlog/async_logger-inl.h" #include "spdlog/async_logger-inl.h"
#include "spdlog/async_logger.h"
#include "spdlog/async_logger-inl.h"
#include "spdlog/details/log_msg.h" #include "spdlog/details/log_msg.h"
#include "spdlog/details/log_msg-inl.h" #include "spdlog/details/log_msg-inl.h"
@ -42,7 +40,6 @@ template class spdlog::details::mpmc_blocking_queue<spdlog::details::async_msg>;
#include "spdlog/sinks/ansicolor_sink.h" #include "spdlog/sinks/ansicolor_sink.h"
#include "spdlog/sinks/ansicolor_sink-inl.h" #include "spdlog/sinks/ansicolor_sink-inl.h"
// template instantiate stdout_mt, stdout_st, stderr_mt, stderr_st
template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stdout, spdlog::details::console_mutex>; template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stdout, spdlog::details::console_mutex>;
template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stdout, spdlog::details::console_nullmutex>; template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stdout, spdlog::details::console_nullmutex>;
template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stderr, spdlog::details::console_mutex>; template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stderr, spdlog::details::console_mutex>;