Chatterino
LoggingChannel.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "messages/Message.hpp"
4 
5 #include <QDateTime>
6 #include <QFile>
7 #include <QString>
8 #include <boost/noncopyable.hpp>
9 
10 #include <memory>
11 
12 namespace chatterino {
13 
14 class Logging;
15 
16 class LoggingChannel : boost::noncopyable
17 {
18  explicit LoggingChannel(const QString &_channelName,
19  const QString &platform);
20 
21 public:
23  void addMessage(MessagePtr message);
24 
25 private:
26  void openLogFile();
27 
28  QString generateOpeningString(
29  const QDateTime &now = QDateTime::currentDateTime()) const;
30  QString generateClosingString(
31  const QDateTime &now = QDateTime::currentDateTime()) const;
32 
33  void appendLine(const QString &line);
34 
35  QString generateDateString(const QDateTime &now);
36 
37  const QString channelName;
38  const QString platform;
39  QString baseDirectory;
40  QString subDirectory;
41 
42  QFile fileHandle;
43 
44  QString dateString;
45 
46  friend class Logging;
47 };
48 
49 } // namespace chatterino
Definition: Logging.hpp:14
~LoggingChannel()
Definition: LoggingChannel.cpp:50
Definition: Application.cpp:48
void addMessage(MessagePtr message)
Definition: LoggingChannel.cpp:88
std::shared_ptr< const Message > MessagePtr
Definition: Channel.hpp:18
Definition: LoggingChannel.hpp:16