fix: use qlogging in eventsub lib (through a hoop) (#6161)

This commit is contained in:
pajlada
2025-04-19 17:10:12 +02:00
committed by GitHub
parent 9d557146b4
commit 1f10935d78
14 changed files with 134 additions and 14 deletions
@@ -0,0 +1,27 @@
#pragma once
#include <string_view>
namespace chatterino::eventsub::lib {
class Logger
{
public:
virtual ~Logger() = default;
virtual void debug(std::string_view msg) = 0;
virtual void warn(std::string_view msg) = 0;
};
class NullLogger : public Logger
{
public:
void debug(std::string_view msg) override
{
}
void warn(std::string_view msg) override
{
}
};
} // namespace chatterino::eventsub::lib
@@ -1,5 +1,7 @@
#pragma once
#include "twitch-eventsub-ws/logger.hpp"
#include <boost/asio.hpp>
#include <boost/beast/core.hpp>
#include <boost/beast/ssl.hpp>
@@ -23,7 +25,8 @@ public:
// Resolver and socket require an io_context
explicit Session(boost::asio::io_context &ioc,
boost::asio::ssl::context &ctx,
std::unique_ptr<Listener> listener);
std::unique_ptr<Listener> listener,
std::shared_ptr<Logger> log_);
// Start the asynchronous operation
void run(std::string _host, std::string _port, std::string _path,
@@ -63,6 +66,7 @@ private:
void checkKeepalive();
std::shared_ptr<Logger> log;
boost::asio::ip::tcp::resolver resolver;
boost::beast::websocket::stream<
boost::beast::ssl_stream<boost::beast::tcp_stream>>