Skip to content

"verbose" command line argument to log to stdout #1587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Cemu/Logging/CemuLogging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "util/helpers/helpers.h"
#include "config/CemuConfig.h"
#include "config/ActiveSettings.h"
#include "config/LaunchSettings.h"

#include <mutex>
#include <condition_variable>
Expand Down Expand Up @@ -144,6 +145,9 @@ bool cemuLog_log(LogType type, std::string_view text)
if (!cemuLog_isLoggingEnabled(type))
return false;

if (LaunchSettings::Verbose())
std::cout << text << std::endl;

cemuLog_writeLineToLog(text);

const auto it = std::find_if(g_logging_window_mapping.cbegin(), g_logging_window_mapping.cend(),
Expand Down
6 changes: 6 additions & 0 deletions src/config/LaunchSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
desc.add_options()
("help,h", "This help screen")
("version,v", "Displays the version of Cemu")
#if !BOOST_OS_WINDOWS
("verbose", "Log to stdout")
#endif

("game,g", po::wvalue<std::wstring>(), "Path of game to launch")
("title-id,t", po::value<std::string>(), "Title ID of the title to be launched (overridden by --game)")
Expand Down Expand Up @@ -125,6 +128,9 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
return false; // exit in main
}

if (vm.count("verbose"))
s_verbose = true;

if (vm.count("game"))
{
std::wstring tmp = vm["game"].as<std::wstring>();
Expand Down
4 changes: 4 additions & 0 deletions src/config/LaunchSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class LaunchSettings
static std::optional<bool> RenderUpsideDownEnabled() { return s_render_upside_down; }
static std::optional<bool> FullscreenEnabled() { return s_fullscreen; }

static bool Verbose() { return s_verbose; }

static bool GDBStubEnabled() { return s_enable_gdbstub; }
static bool NSightModeEnabled() { return s_nsight_mode; }

Expand All @@ -40,6 +42,8 @@ class LaunchSettings

inline static std::optional<bool> s_render_upside_down{};
inline static std::optional<bool> s_fullscreen{};

inline static bool s_verbose = false;

inline static bool s_enable_gdbstub = false;
inline static bool s_nsight_mode = false;
Expand Down
Loading