Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.3)

# project variables
project(spdlog_setup VERSION 0.3.0 LANGUAGES CXX)
set(SPDLOG_MIN_VERSION "0.14.0")
set(SPDLOG_MIN_VERSION "1.0.0")

# general fixed compiler settings
if(${MSVC})
Expand Down
14 changes: 13 additions & 1 deletion include/spdlog_setup/details/conf_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ static constexpr auto MAX_FILES = "max_files";
static constexpr auto MAX_SIZE = "max_size";
static constexpr auto NAME = "name";
static constexpr auto PATTERN = "pattern";
static constexpr auto ROTATE_ON_OPEN = "rotate_on_open";
static constexpr auto ROTATION_HOUR = "rotation_hour";
static constexpr auto ROTATION_MINUTE = "rotation_minute";
static constexpr auto SINKS = "sinks";
Expand Down Expand Up @@ -697,6 +698,7 @@ auto rotating_file_sink_from_table(
using names::BASE_FILENAME;
using names::MAX_FILES;
using names::MAX_SIZE;
using names::ROTATE_ON_OPEN;

// fmt
using fmt::format;
Expand Down Expand Up @@ -731,8 +733,13 @@ auto rotating_file_sink_from_table(
"Missing '{}' field of u64 value for rotating_file_sink",
MAX_FILES));

const auto rotate_on_open = value_from_table_or<bool>(
sink_table,
ROTATE_ON_OPEN,
false);

return make_shared<RotatingFileSink>(
base_filename, max_filesize, max_files);
base_filename, max_filesize, max_files, rotate_on_open);
}

template <class DailyFileSink>
Expand Down Expand Up @@ -1054,6 +1061,11 @@ inline void setup_loggers_impl(
auto global_pattern_opt =
value_from_table_opt<string>(config, GLOBAL_PATTERN);

if (global_pattern_opt)
{
spdlog::set_pattern(*global_pattern_opt);
}

for (const auto &logger_table : *loggers) {
const auto name = value_from_table<string>(
logger_table,
Expand Down