mirror-chatterino2/src/singletons/Logging.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
839 B
C++
Raw Normal View History

#pragma once
#include "util/QStringHash.hpp"
#include "util/ThreadGuard.hpp"
#include <QString>
#include <map>
#include <memory>
#include <unordered_set>
namespace chatterino {
2018-06-26 16:37:59 +02:00
class Settings;
struct Message;
using MessagePtr = std::shared_ptr<const Message>;
class LoggingChannel;
class Logging
{
public:
Logging(Settings &settings);
void addMessage(const QString &channelName, MessagePtr message,
const QString &platformName);
private:
using PlatformName = QString;
using ChannelName = QString;
std::map<PlatformName,
std::map<ChannelName, std::unique_ptr<LoggingChannel>>>
loggingChannels_;
// Keeps the value of the `loggedChannels` settings
std::unordered_set<ChannelName> onlyLogListedChannels;
ThreadGuard threadGuard;
};
} // namespace chatterino