Settings: Avoid log.h include

pull/3579/head
Stenzek 4 weeks ago
parent 6c1ee0ca87
commit c5d309f320
No known key found for this signature in database

@ -63,6 +63,9 @@ enum class Channel : u32
MaxCount
};
// Default log level.
static constexpr Log::Level DEFAULT_LOG_LEVEL = Log::Level::Info;
// Packs a level and channel into one 16-bit number.
using MessageCategory = u32;
[[maybe_unused]] ALWAYS_INLINE constexpr u32 PackCategory(Channel channel, Level level, Color colour)

@ -6674,7 +6674,7 @@ void FullscreenUI::DrawAdvancedSettingsPage()
DrawEnumSetting(bsi, FSUI_VSTR("Log Level"),
FSUI_VSTR("Sets the verbosity of messages logged. Higher levels will log more messages."), "Logging",
"LogLevel", Settings::DEFAULT_LOG_LEVEL, &Settings::ParseLogLevelName, &Settings::GetLogLevelName,
"LogLevel", Log::DEFAULT_LOG_LEVEL, &Settings::ParseLogLevelName, &Settings::GetLogLevelName,
&Settings::GetLogLevelDisplayName, Log::Level::MaxCount);
DrawToggleSetting(bsi, FSUI_VSTR("Log To System Console"), FSUI_VSTR("Logs messages to the console window."),
"Logging", "LogToConsole", false);

@ -13,6 +13,7 @@
#include "common/assert.h"
#include "common/bitutils.h"
#include "common/gsvector.h"
#include "common/log.h"
#include "common/timer.h"
#include "imgui.h"

@ -1193,7 +1193,7 @@ bool Settings::AreGPUDeviceSettingsChanged(const Settings& old_settings) const
void Settings::SetDefaultLogConfig(SettingsInterface& si)
{
si.SetStringValue("Logging", "LogLevel", GetLogLevelName(DEFAULT_LOG_LEVEL));
si.SetStringValue("Logging", "LogLevel", GetLogLevelName(Log::DEFAULT_LOG_LEVEL));
si.SetBoolValue("Logging", "LogTimestamps", true);
#if !defined(_WIN32) && !defined(__ANDROID__)
@ -1215,8 +1215,8 @@ void Settings::SetDefaultLogConfig(SettingsInterface& si)
void Settings::UpdateLogConfig(const SettingsInterface& si)
{
const Log::Level log_level =
ParseLogLevelName(si.GetStringValue("Logging", "LogLevel", GetLogLevelName(DEFAULT_LOG_LEVEL)).c_str())
.value_or(DEFAULT_LOG_LEVEL);
ParseLogLevelName(si.GetStringValue("Logging", "LogLevel", GetLogLevelName(Log::DEFAULT_LOG_LEVEL)).c_str())
.value_or(Log::DEFAULT_LOG_LEVEL);
const bool log_timestamps = si.GetBoolValue("Logging", "LogTimestamps", true);
const bool log_to_console = si.GetBoolValue("Logging", "LogToConsole", false);
const bool log_to_debug = si.GetBoolValue("Logging", "LogToDebug", false);

@ -7,7 +7,6 @@
#include "util/audio_stream.h"
#include "common/log.h"
#include "common/small_string.h"
#include <array>
@ -18,6 +17,10 @@
class SettingsInterface;
namespace Log {
enum class Level : u32;
}
enum class RenderAPI : u8;
enum class MediaCaptureBackend : u8;
@ -619,8 +622,6 @@ struct Settings : public GPUSettings
static constexpr u8 DEFAULT_ACHIEVEMENT_NOTIFICATION_TIME = 5;
static constexpr u8 DEFAULT_LEADERBOARD_NOTIFICATION_TIME = 10;
static constexpr Log::Level DEFAULT_LOG_LEVEL = Log::Level::Info;
static constexpr SaveStateCompressionMode DEFAULT_SAVE_STATE_COMPRESSION_MODE = SaveStateCompressionMode::ZstDefault;
static const MediaCaptureBackend DEFAULT_MEDIA_CAPTURE_BACKEND;

@ -177,7 +177,7 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* dialog, QWidget*
m_ui.logLevel->addItem(QString::fromUtf8(Settings::GetLogLevelDisplayName(static_cast<Log::Level>(i))));
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.logLevel, "Logging", "LogLevel", &Settings::ParseLogLevelName,
&Settings::GetLogLevelName, Settings::DEFAULT_LOG_LEVEL);
&Settings::GetLogLevelName, Log::DEFAULT_LOG_LEVEL);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToConsole, "Logging", "LogToConsole", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToDebug, "Logging", "LogToDebug", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToWindow, "Logging", "LogToWindow", false);

@ -200,7 +200,7 @@ void LogWindow::updateLogLevelUi()
{
const Log::Level level =
Settings::ParseLogLevelName(Host::GetBaseStringSettingValue("Logging", "LogLevel", "").c_str())
.value_or(Settings::DEFAULT_LOG_LEVEL);
.value_or(Log::DEFAULT_LOG_LEVEL);
const QList<QAction*> actions = m_level_menu->actions();
for (u32 i = 0; i < actions.size(); i++)

@ -2541,7 +2541,7 @@ void MainWindow::connectSignals()
&Settings::GetDisplayCropModeDisplayName, Settings::DEFAULT_DISPLAY_CROP_MODE, DisplayCropMode::MaxCount);
SettingWidgetBinder::BindMenuToEnumSetting(m_ui.menuLogLevel, "Logging", "LogLevel", &Settings::ParseLogLevelName,
&Settings::GetLogLevelName, &Settings::GetLogLevelDisplayName,
Settings::DEFAULT_LOG_LEVEL, Log::Level::MaxCount);
Log::DEFAULT_LOG_LEVEL, Log::Level::MaxCount);
connect(m_ui.menuLogChannels, &QMenu::aboutToShow, this, &MainWindow::onDebugLogChannelsMenuAboutToShow);
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionLogToSystemConsole, "Logging", "LogToConsole",
false);

Loading…
Cancel
Save