diff options
author | gabime <gmelman1@gmail.com> | 2018-05-24 00:09:54 +0300 |
---|---|---|
committer | gabime <gmelman1@gmail.com> | 2018-05-24 00:09:54 +0300 |
commit | 67a6eaf23ed38cf37ee872dbf513443ca28869dd (patch) | |
tree | 598ab2dd560fe0d46168b0c497e2c91601ae5ac0 | |
parent | f4db1c510cf9228dce61388452889311bc1c4a73 (diff) | |
parent | 2aa25109efc5fe20eea799c69d84a7e7feeda1e7 (diff) |
Merge branch 'master' of https://github.com/gabime/spdlog
-rw-r--r-- | include/spdlog/contrib/sinks/step_file_sink.h | 17 | ||||
-rw-r--r-- | include/spdlog/details/async_log_helper.h | 1 |
2 files changed, 15 insertions, 3 deletions
diff --git a/include/spdlog/contrib/sinks/step_file_sink.h b/include/spdlog/contrib/sinks/step_file_sink.h index 7e90e0ad..395a534d 100644 --- a/include/spdlog/contrib/sinks/step_file_sink.h +++ b/include/spdlog/contrib/sinks/step_file_sink.h @@ -58,9 +58,22 @@ struct default_step_file_name_calculator }; /* + * The default action when recording starts + */ +struct default_action_when_recording_starts +{ + // Write the start message to the beginning of the file and return its size + static size_t beginning_of_file() + { + return 0; + } +}; + +/* * Rotating file sink based on size and a specified time step */ -template<class Mutex, class FileNameCalc = default_step_file_name_calculator> +template<class Mutex, class FileNameCalc = default_step_file_name_calculator, + class RecordingStartActions = default_action_when_recording_starts> class step_file_sink SPDLOG_FINAL : public base_sink<Mutex> { public: @@ -113,7 +126,7 @@ protected: std::tie(_current_filename, std::ignore) = FileNameCalc::calc_filename(_base_filename, _tmp_ext); _file_helper.open(_current_filename); _tp = _next_tp(); - _current_size = msg.formatted.size(); + _current_size = msg.formatted.size() + RecordingStartActions::beginning_of_file(); } _file_helper.write(msg); } diff --git a/include/spdlog/details/async_log_helper.h b/include/spdlog/details/async_log_helper.h index 82a8ea84..a6d18e2e 100644 --- a/include/spdlog/details/async_log_helper.h +++ b/include/spdlog/details/async_log_helper.h @@ -23,7 +23,6 @@ #include <condition_variable> #include <exception> #include <functional> -#include <iostream> #include <memory> #include <string> #include <thread> |