mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
feat(display)!: Add libdisplaydevice dependency and output name mapping (#2894)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <boost/log/expressions.hpp>
|
||||
#include <boost/log/sinks.hpp>
|
||||
#include <boost/log/sources/severity_logger.hpp>
|
||||
#include <display_device/logging.h>
|
||||
|
||||
// local includes
|
||||
#include "logging.h"
|
||||
@@ -106,6 +107,7 @@ namespace logging {
|
||||
}
|
||||
|
||||
setup_av_logging(min_log_level);
|
||||
setup_libdisplaydevice_logging(min_log_level);
|
||||
|
||||
sink = boost::make_shared<text_sink>();
|
||||
|
||||
@@ -159,6 +161,37 @@ namespace logging {
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
setup_libdisplaydevice_logging(int min_log_level) {
|
||||
constexpr int min_level { static_cast<int>(display_device::Logger::LogLevel::verbose) };
|
||||
constexpr int max_level { static_cast<int>(display_device::Logger::LogLevel::fatal) };
|
||||
const auto log_level { static_cast<display_device::Logger::LogLevel>(std::min(std::max(min_level, min_log_level), max_level)) };
|
||||
|
||||
display_device::Logger::get().setLogLevel(log_level);
|
||||
display_device::Logger::get().setCustomCallback([](const display_device::Logger::LogLevel level, const std::string &message) {
|
||||
switch (level) {
|
||||
case display_device::Logger::LogLevel::verbose:
|
||||
BOOST_LOG(verbose) << message;
|
||||
break;
|
||||
case display_device::Logger::LogLevel::debug:
|
||||
BOOST_LOG(debug) << message;
|
||||
break;
|
||||
case display_device::Logger::LogLevel::info:
|
||||
BOOST_LOG(info) << message;
|
||||
break;
|
||||
case display_device::Logger::LogLevel::warning:
|
||||
BOOST_LOG(warning) << message;
|
||||
break;
|
||||
case display_device::Logger::LogLevel::error:
|
||||
BOOST_LOG(error) << message;
|
||||
break;
|
||||
case display_device::Logger::LogLevel::fatal:
|
||||
BOOST_LOG(fatal) << message;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
log_flush() {
|
||||
if (sink) {
|
||||
|
||||
Reference in New Issue
Block a user