gramods
Loading...
Searching...
No Matches
LogFileMessageSink.hh
1
2#ifndef GRAMODS_CORE_LOGFILEMESSAGESINK
3#define GRAMODS_CORE_LOGFILEMESSAGESINK
4
5#include <gmCore/MessageSink.hh>
6
7#include <mutex>
8#include <fstream>
9
10BEGIN_NAMESPACE_GMCORE;
11
16 : public MessageSink {
17
18public:
19
21
27 void setLogFilePath(std::filesystem::path path);
28
36 void setAppend(bool on);
37
44 void setLevel(int l) { level = l; }
45
46 void output(Message msg);
47
48 GM_OFI_DECLARE;
49
50private:
51
52 bool append;
53 std::filesystem::path logfile_path;
54 std::ofstream logfile;
55 int level = 2;
56
57 std::mutex lock;
58};
59
60END_NAMESPACE_GMCORE;
61
62#endif
Message sink that writes to a specified log file.
Definition LogFileMessageSink.hh:16
void setLevel(int l)
Set the level of messages to output.
Definition LogFileMessageSink.hh:44
This is the base type for back-ends taking care of information sent to the Console class.
Definition MessageSink.hh:23