MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
file_sink.hpp
1#ifndef MSTL_LOGGING_FILE_SINK_HPP__
2#define MSTL_LOGGING_FILE_SINK_HPP__
3#include "MSTL/core/file/file.hpp"
5#include "log_sink.hpp"
7
8class MSTL_API file_sink final : public log_sink {
9private:
10 file file_;
11 _MSTL recursive_mutex mutex_;
12 path base_filename_;
13 string current_date_;
14 size_t max_file_size_;
15 size_t current_size_;
16 int file_index_;
17 bool enable_date_rotation_;
18
19 void open_new_file();
20 void rotate_file();
21 void rotate_by_date(string today);
22 static string default_format(log_event ev);
23
24public:
25 explicit file_sink(path filename,
26 size_t max_file_size = 10 * 1024 * 1024,
27 bool enable_date_rotation = true);
28
29 void log(const log_event& event) override;
30 void flush() override;
31};
32
34#endif // MSTL_LOGGING_FILE_SINK_HPP__
#define _MSTL
全局命名空间MSTL前缀
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
MSTL互斥锁