forked from sus-ziti-uni-hd/epics-Logfile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
output_stream_file.h
39 lines (29 loc) · 921 Bytes
/
output_stream_file.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* SPDX-License-Identifier: MIT */
#pragma once
#include "output_stream.h"
#include "logfile_export.h"
#include <chrono>
#include <fstream>
namespace SuS {
namespace logfile {
class LOGFILE_EXPORT output_stream_file : public output_stream {
public:
output_stream_file(const std::string &_filename,
std::streampos _maxsize = 10 * 1024 * 1024);
virtual ~output_stream_file();
virtual bool do_write(const log_event &_le) override;
virtual std::string name() override;
private:
const std::string m_filename;
std::ofstream m_stream;
std::streampos m_maxsize;
bool m_isopen;
bool close();
bool open();
bool rotate();
bool archive(const std::chrono::system_clock::time_point &t =
std::chrono::system_clock::now());
static std::string formatCData(const std::string &_data);
}; // class output_stream_file
} // namespace logfile
} // namespace SuS