mirror of
https://github.com/hyprwm/hyprutils.git
synced 2025-12-20 05:50:11 +01:00
cli/logger: add redirection of connections
This commit is contained in:
parent
a9fe9748ae
commit
96df6f6535
2 changed files with 18 additions and 3 deletions
|
|
@ -87,6 +87,9 @@ namespace Hyprutils::CLI {
|
|||
|
||||
void log(eLogLevel level, const std::string_view& msg);
|
||||
|
||||
CLogger* getLogger();
|
||||
void redirect(CLogger& logger);
|
||||
|
||||
template <typename... Args>
|
||||
// NOLINTNEXTLINE
|
||||
void log(eLogLevel level, std::format_string<Args...> fmt, Args&&... args) {
|
||||
|
|
|
|||
|
|
@ -179,3 +179,15 @@ void CLoggerConnection::log(eLogLevel level, const std::string_view& msg) {
|
|||
|
||||
m_impl->log(level, msg, m_name);
|
||||
}
|
||||
|
||||
CLogger* CLoggerConnection::getLogger() {
|
||||
if (!m_impl)
|
||||
return nullptr;
|
||||
|
||||
return m_logger;
|
||||
}
|
||||
|
||||
void CLoggerConnection::redirect(CLogger& logger) {
|
||||
m_impl = logger.m_impl;
|
||||
m_logger = &logger;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue