NexusForce
1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
file_sink.hpp
浏览该文件的文档.
1
#ifndef NEFORCE_LOGGING_FILE_SINK_HPP__
2
#define NEFORCE_LOGGING_FILE_SINK_HPP__
3
10
11
#include "
NeForce/core/async/mutex.hpp
"
12
#include "
NeForce/core/file/file.hpp
"
13
#include "
NeForce/logging/log_sink.hpp
"
14
NEFORCE_BEGIN_NAMESPACE__
15
21
36
class
NEFORCE_API
file_sink
final :
public
log_sink
{
37
private
:
38
file
file_;
39
mutex
mutex_;
40
path
base_filename_;
41
string
current_date_;
42
size_t
max_file_size_;
43
size_t
current_size_;
44
int
file_index_;
45
bool
enable_date_rotation_;
46
55
void
open_new_file();
56
62
void
rotate_file();
63
70
void
rotate_by_date(
string
today);
71
72
public
:
83
explicit
file_sink
(
path
filename,
size_t
max_file_size = 10 * 1024 * 1024,
bool
enable_date_rotation =
true
);
84
92
void
log
(
const
log_event
& event)
override
;
93
99
void
flush
()
override
;
100
};
101
// Logging
103
104
NEFORCE_END_NAMESPACE__
105
#endif
// NEFORCE_LOGGING_FILE_SINK_HPP__
file_sink::log
void log(const log_event &event) override
写入日志事件
file_sink::flush
void flush() override
刷新文件缓冲区
file_sink::file_sink
file_sink(path filename, size_t max_file_size=10 *1024 *1024, bool enable_date_rotation=true)
构造函数
file
文件操作类
定义
file.hpp:43
log_sink
日志输出目标基类
定义
log_sink.hpp:29
mutex
非递归互斥锁
定义
mutex.hpp:43
path
文件路径类
定义
path.hpp:36
file.hpp
文件操作类
log_sink.hpp
日志输出目标
mutex.hpp
互斥锁
log_event
日志事件结构体
定义
log_event.hpp:70
include
NeForce
logging
file_sink.hpp
制作者
1.16.0