mirror-chatterino2/src/singletons/helper/loggingchannel.hpp

40 lines
880 B
C++
Raw Normal View History

#pragma once
2017-06-11 09:31:45 +02:00
#include "messages/message.hpp"
#include <QDateTime>
#include <QFile>
#include <QString>
#include <boost/noncopyable.hpp>
#include <memory>
2017-04-14 17:52:22 +02:00
namespace chatterino {
namespace singletons {
class LoggingChannel : boost::noncopyable
{
explicit LoggingChannel(const QString &_channelName, const QString &_baseDirectory);
public:
~LoggingChannel();
void addMessage(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;
void appendLine(const QString &line);
private:
QString channelName;
const QString &baseDirectory;
QString fileName;
QFile fileHandle;
friend class LoggingManager;
};
} // namespace singletons
2017-04-14 17:52:22 +02:00
} // namespace chatterino