mirror of
https://github.com/hyprwm/aquamarine.git
synced 2025-12-20 02:30:02 +01:00
backend: move logger to backend
This commit is contained in:
parent
561ae7fbe1
commit
a43bedccec
3 changed files with 8 additions and 6 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include "Session.hpp"
|
||||
|
||||
namespace Aquamarine {
|
||||
class CLogger;
|
||||
class IOutput;
|
||||
class IPointer;
|
||||
class IKeyboard;
|
||||
|
|
@ -165,6 +166,7 @@ namespace Aquamarine {
|
|||
SBackendOptions options;
|
||||
Hyprutils::Memory::CWeakPointer<CBackend> self;
|
||||
std::vector<Hyprutils::Memory::CSharedPointer<SPollFD>> sessionFDs;
|
||||
Hyprutils::Memory::CSharedPointer<CLogger> logger;
|
||||
|
||||
struct {
|
||||
int fd = -1;
|
||||
|
|
|
|||
|
|
@ -59,12 +59,13 @@ Hyprutils::Memory::CSharedPointer<CBackend> Aquamarine::CBackend::create(const s
|
|||
auto backend = SP<CBackend>(new CBackend());
|
||||
|
||||
backend->options = options;
|
||||
backend->logger = Hyprutils::Memory::makeShared<CLogger>();
|
||||
backend->implementationOptions = backends;
|
||||
backend->self = backend;
|
||||
|
||||
g_logger->m_loggerConnection = options.logConnection;
|
||||
g_logger->m_logFn = options.logFunction;
|
||||
g_logger->updateLevels();
|
||||
backend->logger->m_loggerConnection = options.logConnection;
|
||||
backend->logger->m_logFn = options.logFunction;
|
||||
backend->logger->updateLevels();
|
||||
|
||||
if (backends.size() <= 0)
|
||||
return nullptr;
|
||||
|
|
@ -183,7 +184,8 @@ bool Aquamarine::CBackend::start() {
|
|||
}
|
||||
|
||||
void Aquamarine::CBackend::log(eBackendLogLevel level, const std::string& msg) {
|
||||
g_logger->log(level, msg);
|
||||
if (logger)
|
||||
logger->log(level, msg);
|
||||
}
|
||||
|
||||
std::vector<Hyprutils::Memory::CSharedPointer<SPollFD>> Aquamarine::CBackend::getPollFDs() {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,4 @@ namespace Aquamarine {
|
|||
std::function<void(eBackendLogLevel, std::string)> m_logFn;
|
||||
Hyprutils::Memory::CSharedPointer<Hyprutils::CLI::CLoggerConnection> m_loggerConnection;
|
||||
};
|
||||
|
||||
inline Hyprutils::Memory::CSharedPointer<CLogger> g_logger = Hyprutils::Memory::makeShared<CLogger>();
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue