@@ -30,22 +30,15 @@ using namespace Hyprutils::Memory;
3030#define SP CSharedPointer
3131#define WP CWeakPointer
3232
33- static void aqLog (Aquamarine::eBackendLogLevel level, std::string msg) {
34- if (Env::envEnabled (" HT_QUIET" ))
35- return ;
36-
37- if (g_logger)
38- g_logger->log (HT_LOG_DEBUG, " [AQ] {}" , msg);
39- else
40- std::println (" {}" , msg);
41- }
42-
4333CBackend::CBackend () {
4434 pipe (m_sLoopState.exitfd );
4535 pipe (m_sLoopState.wakeupfd );
4636
4737 Aquamarine::SBackendOptions options{};
48- options.logFunction = ::aqLog;
38+ g_logger->m_aqLoggerConnection = makeShared<Hyprutils::CLI::CLoggerConnection>(g_logger->m_logger );
39+ g_logger->m_aqLoggerConnection ->setLogLevel (Hyprutils::CLI::LOG_WARN); // don't print debug logs, unless AQ_TRACE is set, then aq will set it
40+ g_logger->m_aqLoggerConnection ->setName (" aquamarine" );
41+ options.logConnection = g_logger->m_aqLoggerConnection ;
4942
5043 std::vector<Aquamarine::SBackendImplementationOptions> implementations;
5144 Aquamarine::SBackendImplementationOptions option;
@@ -65,11 +58,18 @@ CBackend::~CBackend() {
6558 close (m_sLoopState.wakeupfd [1 ]);
6659}
6760
61+ IBackend::SBackendCreationData::SBackendCreationData () = default;
62+
63+ SP<IBackend> IBackend::createWithData (const IBackend::SBackendCreationData& data) {
64+ g_logger->m_loggerConnection = data.pLogConnection ;
65+ g_logger->updateLogLevel ();
66+ return IBackend::create ();
67+ }
68+
6869SP<IBackend> IBackend::create () {
6970 if (g_backend)
7071 return nullptr ;
7172 g_backend = SP<CBackend>(new CBackend ());
72- g_logger = SP<CBackendLogger>(new CBackendLogger ());
7373 g_config = makeShared<CConfigManager>();
7474 g_config->parse ();
7575 g_palette = CPalette::palette ();
@@ -94,7 +94,7 @@ void CBackend::destroy() {
9494}
9595
9696void CBackend::setLogFn (LogFn&& fn) {
97- m_logFn = std::move (fn);
97+ g_logger-> m_logFn = std::move (fn);
9898}
9999
100100SP<CPalette> CBackend::getPalette () {
0 commit comments