2017-03-11 11:32:19 +01:00
|
|
|
#ifndef LOGGINGCHANNEL_H
|
|
|
|
#define LOGGINGCHANNEL_H
|
|
|
|
|
|
|
|
#include "messages/message.h"
|
|
|
|
|
|
|
|
#include <QDateTime>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
|
|
|
namespace logging {
|
2017-03-11 11:32:19 +01:00
|
|
|
|
|
|
|
class Channel
|
|
|
|
{
|
|
|
|
public:
|
2017-04-12 17:46:44 +02:00
|
|
|
explicit Channel(const QString &_channelName, const QString &_baseDirectory);
|
2017-03-11 11:32:19 +01:00
|
|
|
~Channel();
|
|
|
|
|
|
|
|
void append(std::shared_ptr<messages::Message> message);
|
|
|
|
|
|
|
|
private:
|
2017-04-12 17:46:44 +02:00
|
|
|
QString generateOpeningString(const QDateTime &now = QDateTime::currentDateTime()) const;
|
|
|
|
QString generateClosingString(const QDateTime &now = QDateTime::currentDateTime()) const;
|
2017-03-11 11:32:19 +01:00
|
|
|
|
|
|
|
void appendLine(const QString &line);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString channelName;
|
|
|
|
const QString &baseDirectory;
|
|
|
|
QString fileName;
|
|
|
|
QFile fileHandle;
|
|
|
|
};
|
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace logging
|
|
|
|
} // namespace chatterino
|
2017-03-11 11:32:19 +01:00
|
|
|
|
|
|
|
#endif // LOGGINGCHANNEL_H
|